sleef icon indicating copy to clipboard operation
sleef copied to clipboard

intermediate denormal numbers?

Open kkimdev opened this issue 8 years ago • 3 comments

I guess denormals can appear in intermediate variables. But not all architectures support denormal, or denormal can be disabled by user with FTZ flag. Have we reviewed precision for such cases?

kkimdev avatar Dec 27 '16 19:12 kkimdev

Denormals should be treated correctly. Please check the source code for tester2*.c. A few functions cannot handle denormals very well. For those functions, the error range is specified as max(DBL_MIN, xxULPs).

shibatch avatar Dec 28 '16 04:12 shibatch

Just to clarify: even if input x is not a denormal number, for example, I guess the following two functions can result different outputs, because denormal numbers can appear during computation.

_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
// x is not necessarily denormal
xsinf(x);
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_OFF);
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_OFF);
// x is not necessarily denormal
xsinf(x);

Perhaps supporting FTZ/DAZ flags == ON is out of the scope, but to my understanding some architectures don't support denormals at all (ARM Neon?). Likely it's not a big issue but I think it's good to review that if there is some difference between FTZ/DAZ on & off.

kkimdev avatar Dec 28 '16 04:12 kkimdev

Although it is not mentioned, SLEEF implicitly assumes IEEE 754 compliance. For AARCH32, flush to zero mode is supported in an ad-hoc way.

shibatch avatar Dec 28 '16 04:12 shibatch