zlacker

[parent] [thread] 2 comments
1. ska+(OP)[view] [source] 2024-01-16 18:09:04
> 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.

replies(2): >>dahart+du >>accoun+Kr2
2. dahart+du[view] [source] 2024-01-16 20:08:13
>>ska+(OP)
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.
3. accoun+Kr2[view] [source] 2024-01-17 10:27:47
>>ska+(OP)
> 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.

[go to top]