News for hackers. Stuff that matters.
Re:Std: Clamp generates less efficient assembly than std:min... by ska on Tuesday January 16, 2024 @01:09PM (#39016505)
> A lot of people seem to use floats without knowing how inaccurate floats are,

Small nit, but floats aren't inaccurate, they have non uniform precision. Some float operations can be inaccurate, but that's rather path dependent...

One problem with -ffast-math is that a) it sounds appealing and b) people don't understand floats, so lots of people turn it on without understanding what it does, and that can introduce subtle problems in code they didn't write.

Sometimes in computational code it makes sense e.g. to get rid of denorms, but a very small fraction of programmers understand this properly, or ever will.

I wish they had named it something scary sounding.

Re:Std: Clamp generates less efficient assembly than std:min... by dahart on Tuesday January 16, 2024 @03:08PM (#39018378)
I am talking about float operations, of course. And they’re all inaccurate, generally speaking, because they round. Fast math rounding error is not much larger than rounding error without fast mast.
Re:Std: Clamp generates less efficient assembly than std:min... by account42 on Wednesday January 17, 2024 @05:27AM (#39025913)
> Sometimes in computational code it makes sense e.g. to get rid of denorms, but a very small fraction of programmers understand this properly, or ever will.

"Some times" here being almost all the time. It is rare that your code will break without denormals if it doesn't already have precision problems with them.