-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Server Programmability
-
ALL
-
Programmability 2024-11-11, Programmability 2024-11-25
See comment and demo code in SERVER-96176.
strtod relies on C locale. This means that its interpretation of numeric formatting can vary from user to user if we accept global locale changes. In the default "C" locale we're fine. We just have to make sure we never change it, e.g. via a setlocale(LC_ALL, "") call. This would a user-friendly thing to do but will screw up our processing.
It also relies on floating point rounding mode, which is another global setting we may or may not control.
These two factors make strtod potentially risky, and we should not use it.
We should switch to std::from_chars even if it's slow, at least it's correct.
- related to
-
SERVER-96176 Avoid unnecessary string copies in NumberParser for double parsing
- Open