Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Strip integer part in "decimals" #22251

Merged
merged 1 commit into from
Sep 20, 2018

Conversation

aaronfranke
Copy link
Member

@aaronfranke aaronfranke commented Sep 19, 2018

CC @akien-mga Fixes #22216 See also #21425 Suggested milestone: 3.1.

@DeuxAlpha
Copy link

Nice! One thing I'd like to mention is that the precision goes up to maxn-1, as I'm sure you know. To increase the decimal points it checks against, both maxn as well as the doubles within the sd-array have to be increased (i.e. 1.000000005 currently returns 0, but by increasing them by one, returns 9).

@aaronfranke
Copy link
Member Author

aaronfranke commented Sep 19, 2018

@DeuxAlpha Note that when grabbing the value from a single-precision float around 1, it cuts off at 7 (or less, if the number is large). But yes, I've changed that to go up to 9 like it did before.

@akien-mga
Copy link
Member

Why not include the same fix in modules/mono/glue/Managed/Files/Mathf.cs as done initially in the other PR?

@aaronfranke
Copy link
Member Author

aaronfranke commented Sep 20, 2018

@akien-mga The current C# "Decimals" behaves as a decimal counter ("1.2345" returns 4) so I think whoever implemented that must've been confused of what the C++ implementation was. The GDscript and C++ behavior is not present in C# yet. I can't fix code which doesn't exist. This is why I added it to my other PR instead of making a new one, but I made one here since you requested it.

If I changed the C# code in this PR, then it would be basically the same as the other PR except for lacking the adding of the "step_decimals" GDscript alias. May as well merge the other one.

@akien-mga akien-mga merged commit a21ee5a into godotengine:master Sep 20, 2018
@akien-mga
Copy link
Member

Thanks, looks good.

@aaronfranke aaronfranke deleted the decimal-int-strip branch September 20, 2018 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants