Liste des Groupes | Revenir à cl c |
Lawrence D'Oliveiro <ldo@nz.invalid> writes:On Mon, 28 Apr 2025 16:27:38 +0300, Michael S wrote:IMHO, a need for a common name for IEEE binary128 exists for quite>
some time. For IEEE binary256 the real need didn't emerge yet. But
it will emerge in the hopefully near future.
A thought: the main advantage of binary types over decimal is
supposed to be speed. Once you get up to larger precisions like
that, the speed advantage becomes less clear, particularly since
hardware support doesn’t seem forthcoming any time soon. There are
already variable-precision decimal floating-point libraries
available. And with such calculations, C no longer offers a great
performance advantage over a higher-level language, so you might as
well use the higher-level language.
>
<https://docs.python.org/3/library/decimal.html>
I think there's an implicit assumption that, all else being equal,
decimal is better than binary. That's true in some contexts,
but not in all.
If you're performing calculations on physical quantities, decimal
probably has no particular advantages, and binary is likely to be
more efficient in both time and space.
The advantagers of decimal show up if you're formatting a *lot*
of numbers in human-readable form (but nobody has time to read a
billion numbers), or if you're working with money. But for financial
calculations, particularly compound interest, there are likely to
be precise regulations about how to round results. A given decimal
floating-point format might or might not satisfy those regulations.
Les messages affichés proviennent d'usenet.