Skip to content

Float zero - #723

Merged
cbmarini merged 1 commit into
form-dev:masterfrom
cbmarini:float-zero
Jan 14, 2026
Merged

cbmarini merged 1 commit into
form-dev:masterfrom
cbmarini:float-zero

Conversation

@cbmarini

@cbmarini cbmarini commented Oct 7, 2025

Copy link
Copy Markdown
Collaborator

This fixes the bug in tokenize that lead to a crash for 0.0 as an input float:

  • 0.0, 0., .0 etc become the integer 0. Maybe this needs to become a float?
  • If there is a real 0.0 that is represented as a float_, this is now also represented with four arguments:
    float_(prec,0,0,0). Previously, this was float_(prec,0,0), but this was not a proper float according to TestFloat which expects four arguments in float_.

@coveralls

coveralls commented Oct 7, 2025 •

Copy link
Copy Markdown

Coverage Status

coverage: 53.351% (-0.004%) from 53.355%
when pulling 012fff7 on cbmarini:float-zero
into f0423c7 on form-dev:master.

@jodavies

jodavies commented Oct 7, 2025

Copy link
Copy Markdown
Collaborator

Just to record here what we discussed on Zoom: a user-input 0.0 should be a floating zero and remain until a chop removes it, consistent with 0.0 produced by term processing.

- Recognize 0.0 as a valid float in CheckFloat and tokenize.
- Represent 0.0 as float_(prec,0,0,0) (instead of float_(prec,0,0))  so it is accepted by TestFloat.
- Keep terms with floating-point coefficient 0.0 after sorting; they can be removed explicitly via Chop.
- Allow Chop to accept 0 and 0.0 as arguments (although it would have not effect).
- Fix related float-handling bugs in CoIf.
- Add tests covering multiple representations of floating-point zero.
@cbmarini
cbmarini merged commit 4d1d77d into form-dev:master Jan 14, 2026
84 checks passed
@cbmarini
cbmarini deleted the float-zero branch January 14, 2026 09:27
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