floating point - Flush to Zero when a computation results in a denormal number in linux -
a computation in c code producing gradual underflow, , when happens program terminating sigfpe. how can flush result 0 when gradual underflow (denormal) results computation, , not terminate execution? (i working on redhat linux machine). thanks.
you haven't specified architecture - i'm going take guess it's relatively recent x86[-64], in case can manipulate sse control register using _mm_getcsr
, _mm_setcsr
, specified in <xmmintrin.h>
(or <immintrin.h>
) header.
the 'flush-to-zero' bit set 0x8000, , 'denormals-are-zero' (for inputs / src) set 0x0040.
_mm_setcsr(_mm_getcsr() | 0x8040);
or <pmmintrin.h>
(sse3) :
_mm_setcsr(_mm_getcsr() | (_mm_flush_zero_on | _mm_denormals_zero_on));
this might make easier determine source of underflow, shouldn't considered solution, since fp environment no longer ieee-754 compliant.
Comments
Post a Comment