diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-01-15 20:43:58 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-01-15 20:43:58 +0000 |
commit | 554c80edbaa49a580feef2d77cb0587c4654addb (patch) | |
tree | b938ca5fbe65ea2b0906e4d7dbf09778ab571a19 /zeta.c | |
parent | 69d30f6014322ed7d0bc147b90b0f1ed43476eea (diff) | |
download | mpfr-554c80edbaa49a580feef2d77cb0587c4654addb.tar.gz |
Standard prototype only. Particular cases added.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2176 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'zeta.c')
-rw-r--r-- | zeta.c | 36 |
1 files changed, 26 insertions, 10 deletions
@@ -1,6 +1,6 @@ /* mpfr_zeta -- Riemann Zeta function at a floating-point number -Copyright 1999, 2000, 2001, 2002 Free Software Foundation. +Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation. This file is part of the MPFR Library. @@ -27,20 +27,36 @@ MA 02111-1307, USA. */ #include "longlong.h" int -#if __STDC__ mpfr_zeta (mpfr_ptr result, mpfr_srcptr op, mp_rnd_t rnd_mode) -#else -mpfr_zeta (result, op, rnd_mode) - mpfr_ptr result; - mpfr_srcptr op; - mp_rnd_t rnd_mode; -#endif { mpfr_t s,s2,x,y,u,b,v,nn,z,z2; int i, n, succes; + int cmp1; - /* to do: check whether op is NaN or infinity, - and clear NaN/Inf flags of result */ + if (MPFR_IS_NAN(op) || MPFR_SIGN(op) < 0) + { + MPFR_SET_NAN(result); + MPFR_RET_NAN; + } + + if (MPFR_IS_INF(op)) /* +infinity */ + return mpfr_set_ui(result, 1, rnd_mode); + + cmp1 = mpfr_cmp_ui(op, 1); + if (cmp1 < 0) + { + MPFR_SET_NAN(result); + MPFR_RET_NAN; + } + if (cmp1 == 0) + { + MPFR_CLEAR_NAN(result); + MPFR_SET_INF(result); + MPFR_SET_POS(result); + return 0; + } + + /* 1 < op < +infinity */ /* first version */ if (mpfr_get_d1 (op) != 2.0 || rnd_mode != GMP_RNDN |