Skip to content

Commit 052975d

Browse files
authoredSep 21, 2021
Update README.md
1 parent d35f404 commit 052975d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed
 

‎README.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ struct from_chars_result {
2828
```
2929

3030
It parses the character sequence [first,last) for a number. It parses floating-point numbers expecting
31-
a locale-independent format equivalent to what is used by `std::strtod` in the default ("C") locale.
31+
a locale-independent format equivalent to the C++17 from_chars function.
3232
The resulting floating-point value is the closest floating-point values (using either float or double),
3333
using the "round to even" convention for values that would otherwise fall right in-between two values.
3434
That is, we provide exact parsing according to the IEEE standard.
3535

36+
3637
Given a successful parse, the pointer (`ptr`) in the returned value is set to point right after the
3738
parsed number, and the `value` referenced is set to the parsed value. In case of error, the returned
3839
`ec` contains a representative error, otherwise the default (`std::errc()`) value is stored.
@@ -64,10 +65,20 @@ the type `fast_float::chars_format`. It is a bitset value: we check whether
6465
to determine whether we allow the fixed point and scientific notation respectively.
6566
The default is `fast_float::chars_format::general` which allows both `fixed` and `scientific`.
6667

67-
The library seeks to follow the C++17 (see 20.19.3.(7.1)) specification. In particular, it forbids leading spaces and the leading '+' sign.
68+
The library seeks to follow the C++17 (see [20.19.3](http://eel.is/c++draft/charconv.from.chars).(7.1)) specification.
69+
* The `from_chars` function does not skip leading white-space characters.
70+
* [A leading `+` sign](https://en.cppreference.com/w/cpp/utility/from_chars) is forbidden.
71+
* It is generally impossible to represent a decimal value exactly as binary floating-point number (`float` and `double` types). We seek the nearest value. We round to an even mantissa when we are in-between two binary floating-point numbers.
72+
73+
Furthermore, we have the following restrictions:
74+
* We only support `float` and `double` types at this time.
75+
* We only support the decimal format: we do not support hexadecimal strings.
76+
* For values that are either very large or very small (e.g., `1e9999`), we represent it using the infinity or negative infinity value.
6877

6978
We support Visual Studio, macOS, Linux, freeBSD. We support big and little endian. We support 32-bit and 64-bit systems.
7079

80+
81+
7182
## Using commas as decimal separator
7283

7384

0 commit comments

Comments
 (0)
Please sign in to comment.