[chronojump/michrolab] Needed on previous commits



commit 8fbd42acbfbcca49f4521c347a4a5085ea8b50c9
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Sep 13 16:59:49 2022 +0200

    Needed on previous commits

 src/utilMath.cs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/utilMath.cs b/src/utilMath.cs
index 9f9ab8957..988eceddc 100644
--- a/src/utilMath.cs
+++ b/src/utilMath.cs
@@ -16,7 +16,7 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  *  Copyright (C) 2016, 2019   Xavier Padullés <x padulles gmail com>
- *  Copyright (C) 2016-2017, 2019-2020   Xavier de Blas <xaviblas gmail com>
+ *  Copyright (C) 2016-2017, 2019-2022   Xavier de Blas <xaviblas gmail com>
  */
 
 using System;
@@ -633,6 +633,13 @@ public static class MathUtil
                return min;
        }
 
+       public static double GetProportion (double d, double min, double max)
+       {
+               d -= min;
+               max -= min;
+               return UtilAll.DivideSafe(d, max);
+       }
+
        /*
           on raceAnalyzer we want a proportion of a value between a list of values, and we want 0 is 
included.
           Maybe in that list the min is above 0, so shouldInclude0 fixes it


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