summaryrefslogtreecommitdiff
path: root/pi.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2000-02-11 17:06:41 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2000-02-11 17:06:41 +0000
commit8d64bb8333b9fe58ffd77011034d68b0f495546c (patch)
treea8366fded616cb85143768046003d8aeb8d79691 /pi.c
parent196552fe90e73a9d012038c44c74a64b36cf6faf (diff)
downloadmpfr-8d64bb8333b9fe58ffd77011034d68b0f495546c.tar.gz
renamed to mpfr_const_pi
unsigned char -> mp_rnd_t git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@462 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'pi.c')
-rw-r--r--pi.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/pi.c b/pi.c
index 322a2ab1c..ae5169996 100644
--- a/pi.c
+++ b/pi.c
@@ -1,4 +1,4 @@
-/* mpfr_pi -- compute Pi
+/* mpfr_const_pi -- compute Pi
Copyright (C) 1999 PolKA project, Inria Lorraine and Loria
@@ -56,17 +56,17 @@ S(N)-S'(N) <= sum(1, n=0..N-1) = N
so Pi*16^N-S'(N) <= N+1 (as 1/4/N^2 < 1)
*/
-mpfr_t __mpfr_pi; /* stored value of Pi */
-int __mpfr_pi_prec=0; /* precision of stored value */
-char __mpfr_pi_rnd; /* rounding mode of stored value */
+mpfr_t __mpfr_const_pi; /* stored value of Pi */
+int __mpfr_const_pi_prec=0; /* precision of stored value */
+mp_rnd_t __mpfr_const_pi_rnd; /* rounding mode of stored value */
void
#if __STDC__
-mpfr_pi(mpfr_ptr x, unsigned char rnd_mode)
+mpfr_const_pi(mpfr_ptr x, mp_rnd_t rnd_mode)
#else
-mpfr_pi(x, rnd_mode)
- mpfr_ptr x;
- unsigned char rnd_mode;
+mpfr_const_pi(x, rnd_mode)
+ mpfr_ptr x;
+ mp_rnd_t rnd_mode;
#endif
{
int N, oldN, n, prec; mpz_t pi, num, den, d3, d2, tmp; mpfr_t y;
@@ -74,11 +74,12 @@ mpfr_pi(x, rnd_mode)
prec=PREC(x);
/* has stored value enough precision ? */
- if ((prec==__mpfr_pi_prec && rnd_mode==__mpfr_pi_rnd) ||
- (prec<=__mpfr_pi_prec &&
- mpfr_can_round(__mpfr_pi, __mpfr_pi_prec, __mpfr_pi_rnd, rnd_mode, prec)))
+ if ((prec==__mpfr_const_pi_prec && rnd_mode==__mpfr_const_pi_rnd) ||
+ (prec<=__mpfr_const_pi_prec &&
+ mpfr_can_round(__mpfr_const_pi, __mpfr_const_pi_prec,
+ __mpfr_const_pi_rnd, rnd_mode, prec)))
{
- mpfr_set(x, __mpfr_pi, rnd_mode); return;
+ mpfr_set(x, __mpfr_const_pi, rnd_mode); return;
}
/* need to recompute */
@@ -123,9 +124,9 @@ mpfr_pi(x, rnd_mode)
mpz_clear(tmp); mpfr_clear(y);
/* store computed value */
- if (__mpfr_pi_prec==0) mpfr_init2(__mpfr_pi, prec);
- else mpfr_set_prec(__mpfr_pi, prec);
- mpfr_set(__mpfr_pi, x, rnd_mode);
- __mpfr_pi_prec=prec;
- __mpfr_pi_rnd=rnd_mode;
+ if (__mpfr_const_pi_prec==0) mpfr_init2(__mpfr_const_pi, prec);
+ else mpfr_set_prec(__mpfr_const_pi, prec);
+ mpfr_set(__mpfr_const_pi, x, rnd_mode);
+ __mpfr_const_pi_prec=prec;
+ __mpfr_const_pi_rnd=rnd_mode;
}