diff options
author | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-05-13 15:03:49 +0000 |
---|---|---|
committer | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-05-13 15:03:49 +0000 |
commit | 1aed03a1b932843a6719a34516946897e5f64290 (patch) | |
tree | 1ff96e2a60ae4d76ef955e2891c7dbbd1403ae41 /cmp_d.c | |
parent | 96dbd496bbd94032e76d23e37103a1dd3a654a79 (diff) | |
download | mpfr-1aed03a1b932843a6719a34516946897e5f64290.tar.gz |
Added cmp_d.c, tcmp_d.c.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2292 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'cmp_d.c')
-rw-r--r-- | cmp_d.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/cmp_d.c b/cmp_d.c new file mode 100644 index 000000000..ce8c4ab06 --- /dev/null +++ b/cmp_d.c @@ -0,0 +1,44 @@ +/* mpfr_cmp_ui_2exp -- compare a floating-point number with an unsigned +machine integer multiplied by a power of 2 + +Copyright 1999, 2001, 2002 Free Software Foundation, Inc. + +This file is part of the MPFR Library. + +The MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your +option) any later version. + +The MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +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 "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" + +int +mpfr_cmp_d (mpfr_srcptr b, double d) +{ + mpfr_t tmp; + int z; + + MPFR_ASSERTN(!MPFR_IS_NAN(b)); + + mpfr_init2(tmp, 53); + mpfr_set_d(tmp, d, GMP_RNDN); + + z = mpfr_cmp(b, tmp); + mpfr_clear(tmp); + + return z; +} |