Re:Std: Clamp generates less efficient assembly than std:min...
by phkahler on Tuesday January 16, 2024 @09:27AM
(#39013562)
I've never understood why generating exceptions is preferable to just using higher precision.
[ Parent
| on HN ]
Re:Std: Clamp generates less efficient assembly than std:min...
by gumby on Tuesday January 16, 2024 @09:57AM
(#39013922)
Higher precision isn’t always available. IEEE 754 is an unusually well-thought-through standard (thanks to some smart people with a lot of painful experience) and is pretty good at justifying its decisions, some of which are surprising (far from obvious) to anyone not steeped in it.
Re:Std: Clamp generates less efficient assembly than std:min...
by cogman10 on Tuesday January 16, 2024 @10:46AM
(#39014619)
The main problem with floats in general is they are designed primarily for scientific computing.
We are fortunately starting to see newer (well, not that new now) CPU instructions like FMA that make more accurate decimal representations not take such huge performance hits.
Re:Std: Clamp generates less efficient assembly than std:min...
by adgjlsfhk1 on Tuesday January 16, 2024 @12:18PM
(#39015863)
what does fma have to do with decimal numbers?
Re:Std: Clamp generates less efficient assembly than std:min...
by cogman10 on Tuesday January 16, 2024 @12:51PM
(#39016309)
Oh shoot, nvm, I thought it was an optimization for integers.
Really it'll be the SIMD style instructions that speeds things up.
Re:Std: Clamp generates less efficient assembly than std:min...
by dahart on Tuesday January 16, 2024 @10:42AM
(#39014559)
On a GPU, higher precision can cost between 2 and 64 times more than single precision, with typical ratios for consumer cards being 16 or 32. Even on the CPU, fp64 workloads tend to run at half the speed on real data due to the extra bandwidth needed for higher precision.