summaryrefslogtreecommitdiffstats
path: root/lib/libc/sparc64/fpu
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2008-04-12 03:10:13 +0000
committerdas <das@FreeBSD.org>2008-04-12 03:10:13 +0000
commit23ad2eb9b87a1b76703064e329c17c7cb6a5fd4c (patch)
tree0d5c98006b8f69a5dd86142c65565c09b3818729 /lib/libc/sparc64/fpu
parentcb01b0e6f4b9eefe594948e894c37d77fa055f6e (diff)
downloadFreeBSD-src-23ad2eb9b87a1b76703064e329c17c7cb6a5fd4c.zip
FreeBSD-src-23ad2eb9b87a1b76703064e329c17c7cb6a5fd4c.tar.gz
Fix some bugs that caused sparc64's quad precision sqrt to get
the wrong answer for virtually all inputs. Thanks to remko for access to a sparc64 box for testing.
Diffstat (limited to 'lib/libc/sparc64/fpu')
-rw-r--r--lib/libc/sparc64/fpu/fpu_sqrt.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/sparc64/fpu/fpu_sqrt.c b/lib/libc/sparc64/fpu/fpu_sqrt.c
index b49b63b..364384b 100644
--- a/lib/libc/sparc64/fpu/fpu_sqrt.c
+++ b/lib/libc/sparc64/fpu/fpu_sqrt.c
@@ -334,7 +334,7 @@ __fpu_sqrt(fe)
FPU_SUBC(d0, x0, t0);
if ((int)d0 >= 0) {
x0 = d0, x1 = d1, x2 = d2;
- q |= bit;
+ q = bit;
y1 |= 1; /* now t1, y1 are set in concrete */
}
ODD_DOUBLE;
@@ -366,12 +366,12 @@ __fpu_sqrt(fe)
FPU_SUBCS(d2, x2, t2);
FPU_SUBCS(d1, x1, t1);
FPU_SUBC(d0, x0, t0);
- ODD_DOUBLE;
if ((int)d0 >= 0) {
- x0 = d0, x1 = d1, x2 = d2;
- q |= bit;
+ x0 = d0, x1 = d1, x2 = d2; x3 = d3;
+ q = bit;
y2 |= 1;
}
+ ODD_DOUBLE;
while ((bit >>= 1) != 0) {
EVEN_DOUBLE;
t3 = y3 | bit;
@@ -380,7 +380,7 @@ __fpu_sqrt(fe)
FPU_SUBCS(d1, x1, t1);
FPU_SUBC(d0, x0, t0);
if ((int)d0 >= 0) {
- x0 = d0, x1 = d1, x2 = d2;
+ x0 = d0, x1 = d1, x2 = d2; x3 = d3;
q |= bit;
y3 |= bit << 1;
}
OpenPOWER on IntegriCloud