From 0b3f1cc70a409c5d83a558f4e66d6c02819f1bd9 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Mon, 16 Dec 2019 23:36:59 -0500 Subject: [PATCH] [Mono] Make Sign methods consistent with GDScript and System.Math --- modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs index 54821fe7903d..ddfed180b50b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs @@ -266,12 +266,14 @@ public static real_t Round(real_t s) public static int Sign(int s) { + if (s == 0) return 0; return s < 0 ? -1 : 1; } - public static real_t Sign(real_t s) + public static int Sign(real_t s) { - return s < 0f ? -1f : 1f; + if (s == 0) return 0; + return s < 0 ? -1 : 1; } public static real_t Sin(real_t s)