Sujet : Re: "A diagram of C23 basic types"
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 27. Jun 2025, 00:58:39
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103kmrf$3nvfg$3@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : Pan/0.162 (Pokrosvk)
On Thu, 26 Jun 2025 12:51:19 -0000 (UTC), Waldek Hebisch wrote:
When working with such (low for me) precisions dynamic allocation of
memory is major cost item, frequently more important than calculation.
To avoid this cost one needs stack allocatation.
What you may not realize is that, on current machines, there is about a
100:1 speed difference between accessing CPU registers and accessing main
memory.
Whether that main memory access is doing “stack allocation” or “heap
allocation” is going to make very little difference to this.
Also, when using binary underlying representation decimal rounding
is much more expensive than binary one, so with such representation
cost of decimal computation is significantly higher.
This may take more computation, but if the calculation time is dominated
by memory access time to all those digits, how much difference is that
going to make, really?
Floating point computations naturally are approximate. In most cases
exact details of rounding do not matter much.
It often surprises you when they do. That’s why a handy rule of thumb is
to test your calculation with all four IEEE 754 rounding modes, to ensure
that the variation in the result remains minor. If it doesn’t ... then
watch out.
To put it differently, decimal floating point is a marketing stint by
IBM.
Not sure IBM has any marketing power left to inflict their own ideas on
the computing industry. Decimal calculations just make sense because the
results are less surprising to normal people.