diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-05-01 08:16:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-01 08:16:10 +0200 |
commit | 8afc9c3938af385be17aab92ec5c4adcbfb0781a (patch) | |
tree | 466c4f416ce27811fa7f6f0d8d31c9c396895e8c /modules/mono/glue/Managed/Files/MathfEx.cs | |
parent | a8194eaef30a32a5d8595fa16b279924ce184cc9 (diff) | |
parent | 620ec4703fa8790ac01a8c1e05212d85776cf9b9 (diff) |
Merge pull request #21425 from aaronfranke/decimal-functions
Make "decimal" functions more consistent
Diffstat (limited to 'modules/mono/glue/Managed/Files/MathfEx.cs')
-rw-r--r-- | modules/mono/glue/Managed/Files/MathfEx.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/mono/glue/Managed/Files/MathfEx.cs b/modules/mono/glue/Managed/Files/MathfEx.cs index d6eb65b097..b96f01bc2e 100644 --- a/modules/mono/glue/Managed/Files/MathfEx.cs +++ b/modules/mono/glue/Managed/Files/MathfEx.cs @@ -21,6 +21,16 @@ namespace Godot public const real_t Epsilon = 1e-06f; #endif + public static int DecimalCount(real_t s) + { + return DecimalCount((decimal)s); + } + + public static int DecimalCount(decimal s) + { + return BitConverter.GetBytes(decimal.GetBits(s)[3])[2]; + } + public static int CeilToInt(real_t s) { return (int)Math.Ceiling(s); |