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

Issue with math.clamp and -0 #43

Closed
blargh2015 opened this issue May 8, 2022 · 0 comments · Fixed by #44
Closed

Issue with math.clamp and -0 #43

blargh2015 opened this issue May 8, 2022 · 0 comments · Fixed by #44
Assignees

Comments

@blargh2015
Copy link

blargh2015 commented May 8, 2022

While mathematically, it's true the -0 == 0 (and Lua agrees with that), this is probably not expected behavior:

game.print("clamp of -0 is "..math.clamp(-0, 0, 100))

Results in:
clamp of -0 is -0

The desired output here would have been
clamp of -0 is 0

On the fence if this is a "bug" per se, but if people are using clamp (and in my case, using as a percentage), displaying "-0%" is a little ugly and slightly unexpected.

@Nexela Nexela self-assigned this May 10, 2022
Nexela added a commit that referenced this issue May 10, 2022
raiguard pushed a commit that referenced this issue May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants