Boost logo

Boost :

From: Kostas Savvidis (kotika98_at_[hidden])
Date: 2025-01-31 19:36:14


> On 31 Jan 2025, at 19:51, Christopher Kormanyos <e_float_at_[hidden]> wrote:
>
> It is for doing exact decimal
> calculations, if you want to do them.

This we know cannot be done.
Floating point calculations with exact decimal fractions give non-exact result
when you hit the limits machine precision, as has been discussed already in this thread by other people.

For reference, near the limits of machine precision decimal64 is worse than double, and here is just one example,
it is a very general phenomenon:

decimal64 d = 12345678900123456;
cout << std::setprecision(16) << std::fixed << d << "\n";

double s = 12345678900123456;
cout << std::setprecision(16) << std::fixed << s << "\n";

12345678900123460.0000000000000000
12345678900123456.0000000000000000

Cheers,
Kostas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk