Skip to content

Conversation

davidcw
Copy link

@davidcw davidcw commented Jul 17, 2025

Improve Mac/Windows consistency in parsing very small and large floats represented in scientific-notation.

The original "strtofloatval()" function defined in "lib/lexer.lxx" exhibited different behavior on Windows vs Mac. On Windows (Windows 11, Intel) floating point values such as "4.94065645841247e-324" returned "true". On Mac (Sequoia 15.5, M3 Max) the same floating point value returned "false".

This PR replaces the inconsistent behavior of the original numerical parser "std::istringstream iss(s)" with "std::strtod".

@guidotack
Copy link
Member

Thanks for the patch. I think we'll have to be a bit careful with strtod because it is locale-dependent. If you have an idea how to work around that, it would be great if you could update this PR.

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.

2 participants