-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Division in inspector returns 0.001 #61956
Comments
This is expected behavior of the Expression evaluator. Integer division is performed if both operands are integers. The type of the property in the inspector has no bearing on Expression's behavior. |
This may be expected behavior currently. That's why I'm filing a bug. It's wrong. |
If we want this behavior, then the inspector should display all floating points ending with ".0". Having an inspector which treats input differently than output is wrong. For example, I have a floating point which shows as |
I see the point in displaying numbers with .0, however in my case (and the OP's too) it wouldn't fix the issue, as I'm inputting the whole expression. Ex:
While it makes sense from an operational point of view, I often use divisions for things like fraction of textures for UV (1/8, 1/16...) and inverse (frequency = 1/duration). Is there a way we could still interpret divisions inside a float field as if all numbers were float, Lua style? Well, at least I know the trick now, and will add a decimal point I was looking for a place to document this, but https://docs.godotengine.org/en/stable/tutorials/editor/inspector_dock.html doesn't mention numerical expressions at all and https://docs.godotengine.org/en/stable/tutorials/scripting/evaluating_expressions.html (which is probably used for the inspector too) is on code side. EDIT: since the 0.001 is a special case when value is clamped, should we rename the issue to a more generic title like |
Godot version
4.0.dev b9375ea
System information
Windows 10.0.19044.1706
Issue description
I wanted to divide an imported file by 64, so I typed
1/64
into the root scale and it showed 0.001.Typing 1/64.0 gives roughly the correct answer.
I think it's treating it as integer division, but this is not correct because these variables are floats.
Steps to reproduce
Minimal reproduction project
None. It happens in an empty project
The text was updated successfully, but these errors were encountered: