+1 vote

if I have 1.333 and want to round to 1.33
if I have 1.555 and want to round to 1.56

Is it like this in video?

related to an answer for: Float rounding issue
in Engine by (95 points)

2 Answers

+1 vote

Would pad_decimals() work for you? It only works with strings tough.

by (325 points)

I'm not sure, I will look into it, thanks

0 votes

You can use stepify.

stepify(1.333, 0.01) # 1.33
stepify(1.555, 0.01) # 1.56
by (156 points)

Actually, this is what I am using and doesn't work.
FYI, I am receiving user input as a float.
This question was related to my original post: https://godotengine.org/qa/50161/float-rounding-issue
Here's a video I made to show the issue.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.