From bace9f570d9d0861eeeeb9255b0f30aa2868fea1 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Thu, 22 Sep 2022 20:17:13 -0700 Subject: [PATCH] add Fix64.Step --- src/Math/Fixed/Fix64.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Math/Fixed/Fix64.cs b/src/Math/Fixed/Fix64.cs index 310d43d..808cefb 100644 --- a/src/Math/Fixed/Fix64.cs +++ b/src/Math/Fixed/Fix64.cs @@ -204,6 +204,14 @@ namespace MoonWorks.Math.Fixed return ((value - min) * (newMax - newMin)) / (max - min) + newMin; } + /// + /// Returns Floor(value / step) * step. Nearest multiple of step to a specified value + /// + public static Fix64 Step(Fix64 value, Fix64 step) + { + return Fix64.Floor(value / step) * step; + } + // Trigonometry functions ///