You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it removes all underscores (accepted inside OCaml literals, eg. 123_456) before calling the C strtod function. The only difference between those two inputs (after underscore removal) is that whitespace is either before or after the input. (On my system?) strtod is specified to ignore optional whitespace before the string, but not after, which explains the behavior.
I don't think it is necessary for OCaml to add complex workarounds for the limitations or surprising parts of those functions implementation or specification.
The problem is that underscores outside OCaml literals are accepted here.
I'm happy with "won't fix", but seems to me that underscores should only be
removed when they are actually part of a literal, like "___1.2__e__222".
My impression is that although this behavior is indeed quirky, it is not a bug either (it parses float just fine), and trying to fix it would risk introducing regressions. However, if someone proposes a patch that is nice (simple and readable) that fixes this and is easy to analyze for absence of regressions, why not?
Original bug ID: 7188
Reporter: skrah
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2017-09-24T15:32:06Z)
Resolution: won't fix
Priority: low
Severity: minor
Version: 4.02.1
Category: standard library
Bug description
The first of these two should probably also raise:
float_of_string "___ 1.2";;
float_of_string "1.2 ___";;
Exception: Failure "float_of_string".
The text was updated successfully, but these errors were encountered: