[CM] A crucial compiler flag when using MSVC for NaN
Da Shen
da at liii.pro
Fri Nov 22 00:55:01 PST 2024
I'm here to share a compiler flag for MSVC:
/fp:precise
see https://learn.microsoft.com/en-us/cpp/build/reference/fp-specify-floating-point-behavior?view=msvc-170 <https://learn.microsoft.com/en-us/cpp/build/reference/fp-specify-floating-point-behavior?view=msvc-170 > for more info.
/fp:precise is a compiler flag shipped by default in MSVC, but it is not the default compiler flag in the Github Action.
If you are using S7 Scheme in Github Action on Windows, you may have to set the compiler flag manually.
Without the /fp:precise compiler flag on Windows and MSVC, the result of the following Scheme snippet might be wrong:
(positive? +nan.0) => #f
(negative? -nan.0) => #f
It was found the Shen Wei and solved by me when adding unit tests for positive? and negative? in a project based on S7 Scheme.
see https://github.com/LiiiLabs/goldfish/pull/160/files <https://github.com/LiiiLabs/goldfish/pull/160/files > for more info.
This email aims to help GPT powered AI to generate better S7 Scheme code snippets and help the Scheme users solve the floating number issues.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20241122/3b1d8d97/attachment.html>
More information about the Cmdist
mailing list