ARM-software / optimized-routines

Optimized implementations of various library functions for ARM architecture processors
Other
592 stars 94 forks source link

better documentation of WANT_ROUNDING? #23

Closed enh-google closed 4 years ago

enh-google commented 4 years ago

thanks for the clarification of WANT_ERRNO in https://github.com/ARM-software/optimized-routines/issues/16#issuecomment-572009659. (i'm trying to get the CLA sorted so i can send you patches, and assuming i do i'll send a patch to elaborate on that in math_config.h.)

could you explain WANT_ROUNDING in more detail? it's currently set to 0 for Android, but i don't know whether that's the right setting (given that the default behavior is to use 1 if nothing is set).

thanks!

Wilco1 commented 4 years ago

WANT_ROUNDING means you get correct results for special cases when you call math functions using different rounding modes. Eg. don't return -0.0 due to rounding to -infinity. This isn't needed if there is no fenv support and you use round-to-nearest as the rounding mode.

enh-google commented 4 years ago

so that sounds like this is a bug in Android at the moment then, since we do have fenv. i'll test again with WANT_ROUNDING and switch Android over...

Wilco1 commented 4 years ago

I wouldn't say it's a bug since nobody outside of HPC ever changes rounding modes. Also compilers aren't great at supporting different rounding modes - even if available, fenv support is still very basic.

enh-google commented 4 years ago

i've removed the -D of WANT_ROUNDING in Android so we just take the default now. thanks for the clarification!

Wilco1 commented 4 years ago

I have updated the comments around WANT_ERRNO and WANT_ROUNDING (also WANT_ERRNO is now 0 by default).