Fix x86 sqrt rounding (bug 14032)

Joseph S. Myers joseph@codesourcery.com
Thu Nov 28 17:28:00 GMT 2013


On Wed, 27 Nov 2013, Rich Felker wrote:

> Setting the rounding precision is likely to be much slower, and has
> issues with signals (signal handlers could be invoked with wrong
> rounding precision, resulting in completely wrong results). Also, in

I've no idea about speed (we don't currently have sqrt benchmarks checked 
in), but setting precision is certainly simpler, and we have various 
existing functions that do so in order to work correctly (IBM libm 
functions that rely on 53-bit precision for their internal operations).  
The signal handlers issue is as discussed lately for AS-safety: as per 
C11, you shouldn't rely on any particular floating-point environment in a 
signal handler and so should do fegetenv (&old_env) / fesetenv 
(FE_DFL_ENV) / (rest of signal handler) / fesetenv (&old_env) if doing 
floating point in a signal handler.  Failure of FE_DFL_ENV to set rounding 
precision to extended is (part of) bug 16068.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list