summaryrefslogtreecommitdiff
path: root/agm.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-02-21 15:43:40 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-02-21 15:43:40 +0000
commit4008525b6b69fa2bc06b8464cd463706674cd79c (patch)
tree266a0b64c23e0cec109303565130e41db4ec2cc5 /agm.c
parent44caabddf63d4f5f0c24b7de66580f802a6aea9c (diff)
downloadmpfr-4008525b6b69fa2bc06b8464cd463706674cd79c.tar.gz
_mpfr_ceil_log2, _mpfr_floor_log2, _mpfr_ceil_exp2 in separate files.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1701 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'agm.c')
-rw-r--r--agm.c47
1 files changed, 0 insertions, 47 deletions
diff --git a/agm.c b/agm.c
index 29c3a4a31..12638c500 100644
--- a/agm.c
+++ b/agm.c
@@ -19,57 +19,11 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-#include <stdio.h>
-#include <stdlib.h>
#include "gmp.h"
#include "gmp-impl.h"
#include "mpfr.h"
#include "mpfr-impl.h"
-/* returns ceil(log(d)/log(2)) */
-long
-_mpfr_ceil_log2 (double d)
-{
- long exp;
- union ieee_double_extract x;
-
- x.d = d;
- exp = x.s.exp - 1023;
- x.s.exp = 1023; /* value for 1 <= d < 2 */
- if (x.d != 1.0) exp++;
- return exp;
-}
-
-/* returns floor(log(d)/log(2)) */
-long
-_mpfr_floor_log2 (double d)
-{
- union ieee_double_extract x;
-
- x.d = d;
- return (long) x.s.exp - 1023;
-}
-
-/* returns y >= 2^d */
-double
-_mpfr_ceil_exp2 (double d)
-{
- long exp;
- union ieee_double_extract x;
-
- exp = (long) d;
- if (d != (double) exp) exp++;
- /* now exp = ceil(d) */
- x.d = 1.0;
- if (exp < -1022) exp = -1022;
- else if (exp > 1024) {
- fprintf (stderr, "Overflow in _mpfr_ceil_exp2\n");
- exit (1);
- }
- x.s.exp = 1023 + exp;
- return x.d;
-}
-
void
mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode)
{
@@ -221,4 +175,3 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode)
return ;
}
-