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 Variant conversion to float instead of double #44306

Merged
merged 1 commit into from
Dec 21, 2020

Conversation

Demindiro
Copy link
Contributor

@Demindiro Demindiro commented Dec 11, 2020

real_t is defined as a float (or a double depending on a flag it seems?) in core/math/math_defs.h and Variant::construct was thus casting to a float.

Instead of using a double, maybe it is better to fix whatever is causing the flag not to be set?

godot/core/math/math_defs.h

Lines 109 to 113 in 2a4f0bc

#ifdef REAL_T_IS_DOUBLE
typedef double real_t;
#else
typedef float real_t;
#endif

Closes #44303

@Calinou Calinou added this to the 3.2 milestone Dec 12, 2020
Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Variant::REAL is a double, not real_t (which is used for vectors/etc). I also checked on master, the problem doesn't exist there, so this is a 3.x specific problem. Note: I haven't actually checked that this solves the linked issue.

Instead of using a double, maybe it is better to fix whatever is causing the flag not to be set?

See godotengine/godot-proposals#892

Copy link
Contributor

@qarmin qarmin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked and it fixed my issue.

@akien-mga akien-mga merged commit 9c3293b into godotengine:3.2 Dec 21, 2020
@akien-mga
Copy link
Member

Thanks!

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.

5 participants