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

Incorrect formatting of decimal values #400

Open
reidst opened this issue Aug 16, 2024 · 1 comment · May be fixed by #408
Open

Incorrect formatting of decimal values #400

reidst opened this issue Aug 16, 2024 · 1 comment · May be fixed by #408
Assignees
Labels
A-Confirmed Definitely a bug C-Moderate Effort Should take a moderate amount of time to address. S-Nice to have Minor importance U-Pretty Printing Z-Bug

Comments

@reidst
Copy link
Collaborator

reidst commented Aug 16, 2024

Describe the bug
The decimal formatting of some negative rational values is incorrect.

To Reproduce

Welcome to Disco, version 0.1.6!

A language for programming discrete mathematics.

Disco> 0.1 - 0.2
0.-1
Disco> 0.2 * -6
-1.-2
Disco> 0.3 * (-0.3)
0.-11

Expected vs actual behavior
The negative sign should always be to the left of the decimal and appear at most once. The misplacement of the negative sign affects the logic of the formatting, as can be seen in the 0.3 * (-0.3) example, which has a representation structurally similar to the equal expression -0.1 + 0.01 but not the correct representation -0.09.

Additional context
After group consideration, the resolution may be to remove decimal representation entirely from the language, or at least extract formatting data from the expressions themselves and into a REPL command, e.g. Disco> :decimal <expr>.

@reidst reidst added C-Moderate Effort Should take a moderate amount of time to address. U-Pretty Printing A-Confirmed Definitely a bug S-Nice to have Minor importance Z-Bug labels Aug 16, 2024
@byorgey byorgey self-assigned this Oct 31, 2024
@byorgey
Copy link
Member

byorgey commented Oct 31, 2024

Apparently this bug has existed, untested, since basically forever. Fortunately the fix looks to be fairly simple. We can leave the issue of removing decimal representation entirely for later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Confirmed Definitely a bug C-Moderate Effort Should take a moderate amount of time to address. S-Nice to have Minor importance U-Pretty Printing Z-Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants