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

Godot Editor math not as expected; float results becoming ints #44961

Closed
CitrusWire opened this issue Jan 6, 2021 · 4 comments
Closed

Godot Editor math not as expected; float results becoming ints #44961

CitrusWire opened this issue Jan 6, 2021 · 4 comments
Labels

Comments

@CitrusWire
Copy link

Godot version:
3.2.3

OS/device including version:
Win 7

Issue description:
Editor math (i.e. type 1*2 in transform position) is awesome. But if a number contains only integers you get the wrong result if it should be a float; it always rounds it to a integer.

Steps to reproduce:
1/2.0 == 0.5
1/2 == 0 (Wrong)

But conversely, if the input has a float in, you get back an integer.
2*0.5 == 1
1/0.5 == 2

Rounding float results to integers if the two inputs are integers is rarely going to be the desired outcome. While it can be worked around, it's non-obvious what's going on (I only recognised it quickly because I've seen it before.)

Minimal reproduction project:

@Zireael07
Copy link
Contributor

If you type only integers, you get integers back (there are no "float results" involved). This is working as expected imho.

@CitrusWire
Copy link
Author

CitrusWire commented Jan 6, 2021

If you type only integers, you get integers back (there are no "float results" involved). This is working as expected imho.

What do you type into a calculator when you want to halve something?

x / 2
x * 0.5
x / 2.0

99% of people will type the first. They will then blindly assume the result is correct.
This is a calculator, it is not working as most people would expect a calculator to work.

@KoBeWi
Copy link
Member

KoBeWi commented Jan 6, 2021

This is intended, inspector fields follow the same math logic as scripts. See godotengine/godot-proposals#1866

@KoBeWi KoBeWi closed this as completed Jan 6, 2021
@KoBeWi KoBeWi added the archived label Jan 6, 2021
@CitrusWire
Copy link
Author

@KoBeWi - It may be as intended but I maintain it's still a bug, albeit one of design not implementation. This interface is a tool, not a (over-strictly-typed) programming language, see my calculator example above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants