diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-01-03 11:16:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-03 11:16:44 +0100 |
commit | 529f710ec0540b9d3f61a6d75559f13af2f069d2 (patch) | |
tree | af1483d1a65770bc667555040fb45d45d711fd18 | |
parent | da625654e53bb10dce46204621ccfe0e619a38cc (diff) | |
parent | 0b3f1cc70a409c5d83a558f4e66d6c02819f1bd9 (diff) |
Merge pull request #34456 from aaronfranke/its-a-sign
[Mono] Make Sign methods consistent with GDScript and System.Math
-rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs | 6 |
1 files 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 54821fe790..ddfed180b5 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs @@ -266,12 +266,14 @@ namespace Godot 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) |