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

Unary negation does not work correctly when using CONST #542

Closed
a740g opened this issue Sep 22, 2024 · 0 comments · Fixed by #560
Closed

Unary negation does not work correctly when using CONST #542

a740g opened this issue Sep 22, 2024 · 0 comments · Fixed by #560
Labels
bug Something isn't working

Comments

@a740g
Copy link
Contributor

a740g commented Sep 22, 2024

Describe the bug
Unary negation does not work correctly when using CONST. As @mkilgore figured out, the unary negation only works correctly for integers. See here.

To Reproduce

CONST C1! = -1.4!
CONST C2! = -0.4!
CONST C3! = 0.4!
CONST C4! = 1.4!

PRINT C1, C2, C3, C4

The above code prints: -1 0 .4 1.4

Expected behavior
It should handle unary negation correctly for both integer and floating-point values.

Additional context
This was first reported here.

@a740g a740g added the bug Something isn't working label Sep 22, 2024
mkilgore added a commit to mkilgore/QB64pe that referenced this issue Oct 28, 2024
Negation was only making use of the integer value when calculating the
negative, resulting in incorrect values when the original was actually a
floating-point value.

Fixes: QB64-Phoenix-Edition#542
mkilgore added a commit to mkilgore/QB64pe that referenced this issue Oct 28, 2024
Negation was only making use of the integer value when calculating the
negative, resulting in incorrect values when the original was actually a
floating-point value.

Fixes: QB64-Phoenix-Edition#542
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant