summaryrefslogtreecommitdiff
path: root/libc/sysdeps/ieee754/dbl-64/mpsqrt.c
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2011-10-25 16:50:31 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2011-10-25 16:50:31 +0000
commitc86ab84d63b20aff7cf391414009a38477fe7137 (patch)
treeeb92a78a0fd85b83317300f94a1dbed8ca414fb9 /libc/sysdeps/ieee754/dbl-64/mpsqrt.c
parent4bbe4e2185c5484328182720ff7b3bb4f9593bff (diff)
Merge changes between r15532 and r15557 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@15558 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps/ieee754/dbl-64/mpsqrt.c')
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mpsqrt.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/libc/sysdeps/ieee754/dbl-64/mpsqrt.c b/libc/sysdeps/ieee754/dbl-64/mpsqrt.c
index 9945de306..d1a80f909 100644
--- a/libc/sysdeps/ieee754/dbl-64/mpsqrt.c
+++ b/libc/sysdeps/ieee754/dbl-64/mpsqrt.c
@@ -1,8 +1,7 @@
-
/*
* IBM Accurate Mathematical Library
* written by International Business Machines Corp.
- * Copyright (C) 2001 Free Software Foundation
+ * Copyright (C) 2001, 2011 Free Software Foundation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -33,6 +32,12 @@
#include "endian.h"
#include "mpa.h"
+#ifndef SECTION
+# define SECTION
+#endif
+
+#include "mpsqrt.h"
+
/****************************************************************************/
/* Multi-Precision square root function subroutine for precision p >= 4. */
/* The relative error is bounded by 3.501*r**(1-p), where r=2**24. */
@@ -41,20 +46,20 @@
/* p as integer. Routine computes sqrt(*x) and stores result in *y */
/****************************************************************************/
-double fastiroot(double);
-
-void __mpsqrt(mp_no *x, mp_no *y, int p) {
-#include "mpsqrt.h"
+static double fastiroot(double);
+void
+SECTION
+__mpsqrt(mp_no *x, mp_no *y, int p) {
int i,m,ex,ey;
double dx,dy;
mp_no
mphalf = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}},
+ 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
+ 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}},
mp3halfs = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
+ 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
+ 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
mp_no mpxn,mpz,mpu,mpt1,mpt2;
/* Prepare multi-precision 1/2 and 3/2 */
@@ -65,7 +70,7 @@ void __mpsqrt(mp_no *x, mp_no *y, int p) {
__mp_dbl(&mpxn,&dx,p); dy=fastiroot(dx); __dbl_mp(dy,&mpu,p);
__mul(&mpxn,&mphalf,&mpz,p);
- m=mp[p];
+ m=__mpsqrt_mp[p];
for (i=0; i<m; i++) {
__mul(&mpu,&mpu,&mpt1,p);
__mul(&mpt1,&mpz,&mpt2,p);
@@ -82,7 +87,9 @@ void __mpsqrt(mp_no *x, mp_no *y, int p) {
/* Compute a double precision approximation for 1/sqrt(x) */
/* with the relative error bounded by 2**-51. */
/***********************************************************/
-double fastiroot(double x) {
+static double
+SECTION
+fastiroot(double x) {
union {int i[2]; double d;} p,q;
double y,z, t;
int n;