From 1c9afd69051a64cf085c6fb3674a444ff9a43857 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 6 Feb 2020 11:34:54 -0500 Subject: fix excess precision in return value of i386 atan[2][f] for functions implemented in C, this is a requirement of C11 (F.6); strictly speaking that text does not apply to standard library functions, but it seems to be intended to apply to them, and C2x is expected to make it a requirement. failure to drop excess precision is particularly bad for inverse trig functions, where a value with excess precision can be outside the range of the function (entire range, or range for a particular subdomain), breaking reasonable invariants a caller may expect. --- src/math/i386/atan2.s | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/math/i386/atan2.s') diff --git a/src/math/i386/atan2.s b/src/math/i386/atan2.s index 76b95f31..8bc441b1 100644 --- a/src/math/i386/atan2.s +++ b/src/math/i386/atan2.s @@ -4,7 +4,8 @@ atan2: fldl 4(%esp) fldl 12(%esp) fpatan - fstl 4(%esp) + fstpl 4(%esp) + fldl 4(%esp) mov 8(%esp),%eax add %eax,%eax cmp $0x00200000,%eax -- cgit v1.2.1