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

[raymath] Oddities with division #4687

Closed
redbullmarky opened this issue Jan 14, 2025 · 1 comment
Closed

[raymath] Oddities with division #4687

redbullmarky opened this issue Jan 14, 2025 · 1 comment

Comments

@redbullmarky
Copy link

Issue description

Using raylib 5.5 (installed via vcpkg), I came across unexpected behaviour with one of the new C++ Vector2 operators.

Code Example

Vector2 v1 = { 5.f, 5.f };
Vector2 v2 = { 5.f, 5.f };
Vector2 v3 = { 5.f, 5.f };
Vector2 v4 = { 5.f, 5.f };

v1 = v1 / 2.f;
v2 /= 2.f;

v3 *= 2.f;
v4 = v4 * 2.f;

Essentially the issue is the difference between the results produced for v1 & v2. I added v3 and v4 examples just for comparison etc.

But the results:

v1 -> 2.5, 2.5  <-- ok
v2 -> 10, 10   <-- not right?
v3 -> 10, 10   <-- ok
v4 -> 10, 10   <-- ok

Looking at the code in raymath.h, it does seem like /= is identical to *= operator logic.

@redbullmarky
Copy link
Author

Apologies, not sure how I missed it the first time but the latest codebase appears to have resolved this.

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

No branches or pull requests

1 participant