]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix scaling bugs which gave innaccuracies and spurious underflows in csqrt()
authorBruce Evans <bde@FreeBSD.org>
Tue, 17 Jul 2018 10:44:16 +0000 (10:44 +0000)
committerBruce Evans <bde@FreeBSD.org>
Tue, 17 Jul 2018 10:44:16 +0000 (10:44 +0000)
commit9d7dc1361589162e083fea4062b86ecebe3952f3
tree92bb41fe665c05a29cecf5f4594602642894f909
parent52ff436841c4cfb708b9ce6c064cf813a8795afb
Fix scaling bugs which gave innaccuracies and spurious underflows in csqrt()
and csqrtl().

When one component is huge and the other is tiny, scaling down the tiny
component gave spurious underflow.

When both components are denormal, not scaling them up gave inaccuracies
of 34+ ulps on not very carefully selected args.  Fixing this reduces the
maximum error to 1.6 ulps on the same set of args (mosly not denormal ones).

The scaling used multiplication of a complex variable by 2, but clang messes
this on amd64 up by losing the sign of -0.0.  Calculate the components
separately, as is well known to be needed for operations on more exceptional
values.
lib/msun/src/s_csqrt.c
lib/msun/src/s_csqrtl.c