PEP 680: Note that double precision float is a recommendation not requirement (GH-2278)
This commit is contained in:
parent
579627054d
commit
e647fcedbd
19
pep-0680.rst
19
pep-0680.rst
|
@ -333,14 +333,17 @@ support could be added later in a backward-compatible way.
|
|||
Removing support for ``parse_float`` in ``tomllib.load[s]``
|
||||
-----------------------------------------------------------
|
||||
|
||||
This option is not strictly necessary, since TOML floats are "IEEE 754 binary64
|
||||
values", which is equivalent to a Python ``float`` on most architectures.
|
||||
However, parsing floats differently, such as to ``decimal.Decimal``, allows
|
||||
users extra precision beyond that promised by the TOML format. In the
|
||||
author of ``tomli``'s experience, this is particularly useful in scientific and
|
||||
financial applications. This is also useful for other cases that need greater
|
||||
precision, or where end-users include non-developers who may not be aware of
|
||||
the limits of binary64 floats.
|
||||
This option is not strictly necessary, since TOML floats should be implemented
|
||||
as "IEEE 754 binary64 values", which is equivalent to a Python ``float`` on most
|
||||
architectures.
|
||||
|
||||
The TOML specification uses the word "SHOULD", however, implying a
|
||||
recommendation that can be ignored for valid reasons. Parsing floats
|
||||
differently, such as to ``decimal.Decimal``, allows users extra precision beyond
|
||||
that promised by the TOML format. In the author of ``tomli``'s experience, this
|
||||
is particularly useful in scientific and financial applications. This is also
|
||||
useful for other cases that need greater precision, or where end-users include
|
||||
non-developers who may not be aware of the limits of binary64 floats.
|
||||
|
||||
There are also niche architectures where the Python ``float`` is not a IEEE 754
|
||||
binary64 value. The ``parse_float`` argument allows users to achieve correct
|
||||
|
|
Loading…
Reference in New Issue