[chronojump] Util.GetHeightInCentimeters can send/receive a double



commit 745281059d58b059632ed0c63a8d3ba2a47c8663
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Dec 11 13:19:29 2019 +0100

    Util.GetHeightInCentimeters can send/receive a double

 src/util.cs | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/util.cs b/src/util.cs
index 58f96c01..892b78fb 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -463,13 +463,15 @@ public class Util
                return myStringBuilder.ToString();
        }
 
-       
+
+       //old code sends and returns strings
        public static string GetHeightInCentimeters (string time) {
+               return GetHeightInCentimeters (Convert.ToDouble(time)).ToString();
+       }
+       //new code (2019 ...) sends and returns doubles
+       public static double GetHeightInCentimeters (double tv) {
                // s = 4.9 * (tv/2)^2
-               double timeAsDouble = Convert.ToDouble(time);
-               double height = 100 * 4.9 * Math.Pow( timeAsDouble / 2.0 , 2 );
-
-               return height.ToString();
+               return 100 * 4.9 * Math.Pow( tv / 2.0 , 2 );
        }
        
        public static double WeightFromKgToPercent (double jumpKg, double personKg) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]