summaryrefslogtreecommitdiff
path: root/lib/libc/arch/sparc64
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2014-09-12 22:04:19 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2014-09-12 22:04:19 +0000
commitd43a94c7b29958481b667b3b4c25ae9acbac39e2 (patch)
treec0a0fcf4e645043d948de66e7c09399ddceeb7aa /lib/libc/arch/sparc64
parent907480c0ee9b9b19d6be11473b2aa9ac42d336e2 (diff)
Fix some bugs in the _Qp_sqrt implementation that would limit the accuracy
of the result in many cases. From FreeBSD allbeit with some changes to keep the coding style consistent. This fixes the asinhl(4) issue reported by dickman@ on tech@.
Diffstat (limited to 'lib/libc/arch/sparc64')
-rw-r--r--lib/libc/arch/sparc64/fpu/fpu_sqrt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/arch/sparc64/fpu/fpu_sqrt.c b/lib/libc/arch/sparc64/fpu/fpu_sqrt.c
index be0e9d57ea8..5318f2dac0a 100644
--- a/lib/libc/arch/sparc64/fpu/fpu_sqrt.c
+++ b/lib/libc/arch/sparc64/fpu/fpu_sqrt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpu_sqrt.c,v 1.3 2013/11/26 20:33:07 deraadt Exp $ */
+/* $OpenBSD: fpu_sqrt.c,v 1.4 2014/09/12 22:04:18 kettenis Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -372,12 +372,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;
+ x0 = d0, x1 = d1, x2 = d2, x3 = d3;
q |= bit;
y2 |= 1;
}
+ ODD_DOUBLE;
while ((bit >>= 1) != 0) {
EVEN_DOUBLE;
t3 = y3 | bit;
@@ -386,7 +386,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;
}