| ▲ | dooglius 5 hours ago | |||||||
FWIW one can configure floating point exceptions at runtime at no overhead, see `man 3 fenv` | ||||||||
| ▲ | jcranmer 3 hours ago | parent | next [-] | |||||||
It's no overhead in the same sense that zero-cost exception-handling is zero-cost: turning them on properly (e.g., #pragma STDC FENV_ACCESS ON or equivalent command-line flags) disables a fair amount of optimizations which incurs an overhead in and of itself. | ||||||||
| ||||||||
| ▲ | dzaima 4 hours ago | parent | prev | next [-] | |||||||
Except gcc doesn't actually support it to any sane extent (it ignores and warns on "#pragma STDC FENV_ACCESS ON", which C requires for fenv.h to actually function; and as such gcc makes a bunch invalid optimizations); clang supports it, but only as of somewhat-recently. | ||||||||
| ▲ | westurner 4 hours ago | parent | prev [-] | |||||||
fenv: https://manpages.debian.org/testing/manpages-dev/fenv.3.en.h... : > These eleven functions were defined in C99, and describe the handling of floating-point rounding and exceptions (overflow, zero-divide, etc.). | ||||||||