From 685a68b7b831a1103881aba5bcbbc71273d54f89 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 14 Apr 2023 09:31:49 -0500 Subject: [PATCH] Fix c# math sign functions for #993 --- Source/Engine/Core/Math/Mathd.cs | 2 +- Source/Engine/Core/Math/Mathf.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Core/Math/Mathd.cs b/Source/Engine/Core/Math/Mathd.cs index cf2c20eb3..f200b8865 100644 --- a/Source/Engine/Core/Math/Mathd.cs +++ b/Source/Engine/Core/Math/Mathd.cs @@ -395,7 +395,7 @@ namespace FlaxEngine /// public static double Sign(double f) { - return f < 0d ? -1d : 1d; + return f > 0.0d ? 1.0d : f < 0.0d ? -1.0d : 0.0d; } /// diff --git a/Source/Engine/Core/Math/Mathf.cs b/Source/Engine/Core/Math/Mathf.cs index 08ee103c0..b0411133b 100644 --- a/Source/Engine/Core/Math/Mathf.cs +++ b/Source/Engine/Core/Math/Mathf.cs @@ -548,7 +548,7 @@ namespace FlaxEngine /// public static float Sign(float f) { - return f < 0f ? -1f : 1f; + return f > 0.0f ? 1.0f : f < 0.0f ? -1.0f : 0.0f; } ///