Skip to content

feat: DH-21391: Add unit test that highlights edge cases of float vs double parsing#303

Merged
kosak merged 4 commits intodeephaven:mainfrom
kosak:kosak_parser-fidelity-test
Jan 13, 2026
Merged

feat: DH-21391: Add unit test that highlights edge cases of float vs double parsing#303
kosak merged 4 commits intodeephaven:mainfrom
kosak:kosak_parser-fidelity-test

Conversation

@kosak
Copy link
Contributor

@kosak kosak commented Jan 13, 2026

This is a subtle topic, but there are a a few edge cases where users will get slightly different floating point answers than expected when using our library. These all boil down to the same reasons:

There are cases where the Java expression Float.parse(s) can differ from (float)Double.parse(s). We use (the equivalent of) the latter everywhere for type inferencing reasons and because our double parser is a third-party library that is very fast.

We are already aware of this, and we provide FloatStrictParser for users that want strict behavior that is exactly Float.parse(s).

This issue adds a unit test that exercises FloatStrictParser and highlights its differences.

@kosak kosak requested a review from lbooker42 January 13, 2026 16:54
@kosak kosak self-assigned this Jan 13, 2026
@kosak kosak force-pushed the kosak_parser-fidelity-test branch 2 times, most recently from fc1f425 to b751efa Compare January 13, 2026 16:56
@kosak kosak force-pushed the kosak_parser-fidelity-test branch from b751efa to 49108fa Compare January 13, 2026 17:02
Copy link
Member

@devinrsmith devinrsmith left a comment

Choose a reason for hiding this comment

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

LGTM, let Larry approve?

@kosak kosak merged commit cbf79f7 into deephaven:main Jan 13, 2026
3 checks passed
@kosak kosak deleted the kosak_parser-fidelity-test branch January 13, 2026 19:27
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants