From 455f4048df87c2d0d2f62b73197fdae86d2254c8 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Thu, 9 Mar 2023 13:52:45 -0800 Subject: [PATCH] MathHelper.Quantize uses round instead of floor --- src/Math/MathHelper.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Math/MathHelper.cs b/src/Math/MathHelper.cs index 67f7d0a7..e7f7a568 100644 --- a/src/Math/MathHelper.cs +++ b/src/Math/MathHelper.cs @@ -282,7 +282,12 @@ namespace MoonWorks.Math public static float Quantize(float value, float step) { - return (float) System.Math.Floor(value / step) * step; + return System.MathF.Round(value / step) * step; + } + + public static Fixed.Fix64 Quantize(Fixed.Fix64 value, Fixed.Fix64 step) + { + return Fixed.Fix64.Round(value / step) * step; } ///