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 to Mod and \ in CONST #398

Merged
merged 3 commits into from
Oct 15, 2023
Merged

Fix to Mod and \ in CONST #398

merged 3 commits into from
Oct 15, 2023

Conversation

SteveMcNeill
Copy link
Member

As per the sample code below:

Const a = 5 Mod 2.8
Const b = 5 \ 2.8
Print a; "="; 5 Mod 2.8
Print b; "="; 5 \ 2.8

Old output was wrong. Patch should make the CONST values the same as what QB64 normally generates for us.

As per the sample code below:

Const a = 5 Mod 2.8
Const b = 5 \ 2.8
Print a; "="; 5 Mod 2.8
Print b; "="; 5 \ 2.8

Old output was wrong.  Patch should make the CONST values the same as what QB64 normally generates for us.
Copy link
Contributor

@mkilgore mkilgore left a comment

Choose a reason for hiding this comment

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

LGTM :)

A bit of history: This bug was introduced by me in #126, a fix for QB64Official/qb64#4. The issue here was then reported in QB64Official/qb64#53 (and noticed by us) and recently fixed over in QB64Official in QB64Official/qb64#54 by simply reverting my old change and reintroducing the bug in QB64Official/qb64#4.

Using _Round() instead of FIX() is the proper solution as it matches what QB64 does when converting the Double argument to Mod into an integer, ensuring that the = 0 comparison is accurate while not changing the behavior of Mod.

@SteveMcNeill SteveMcNeill merged commit 1b50788 into QB64-Phoenix-Edition:main Oct 15, 2023
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

Successfully merging this pull request may close these issues.

3 participants