Boost logo

Boost :

From: Christopher Kormanyos (e_float_at_[hidden])
Date: 2025-01-31 20:39:17


>> 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:
I'm not sure, but I think you mightbe thinking too wide. At the extremeportion of the precision, binaryand decimal have similar (I guess)exactness.
This whole thing is for calculationswith things like 10, 100, or 1/10or even 1 / 100-million which seemsto be that new crypto currency cent.
It is these kinds of things thatget better and within the middleof the range.
If you don't like Decimal, thengo tell them to take it out ofIEEE-754:2008 and also get them toremove _Decimal from C23 please.When you get these two thingsdone, we can haggle about inclusion(ot not).
- Chris

    On Friday, January 31, 2025 at 08:38:29 PM GMT+1, Kostas Savvidis <kotika98_at_[hidden]> wrote:
 
 

> 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