diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-13 11:30:05 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-13 11:30:05 +0000 |
commit | 2ad2125c3aebbdeb8d6c3da12c653bb02fc507bb (patch) | |
tree | a90e3d1c86efb3bdc75522da84618c1e6a9f1673 /check.c | |
parent | 69febd2bb6843718a242f0ac95468822bd47e104 (diff) | |
download | mpfr-2ad2125c3aebbdeb8d6c3da12c653bb02fc507bb.tar.gz |
Add test for mpfr_cmpabs
Add test for mpfr_fits_
Add test for internal dumping functions.
Improve coverage test for exceptions / set / check.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2701 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'check.c')
-rw-r--r-- | check.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -1,6 +1,6 @@ /* mpfr_check -- Check if a floating-point number has not been corrupted. -Copyright 2003 Free Software Foundation, Inc. +Copyright 2003, 2004 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -21,8 +21,12 @@ MA 02111-1307, USA. */ #include "mpfr-impl.h" +/* + * Check if x is a valid mpfr_t init by mpfr_init + * Returns 0 if isn't valid + */ int -mpfr_check(mpfr_srcptr x) +mpfr_check (mpfr_srcptr x) { mp_size_t s,i; mp_limb_t tmp; @@ -66,8 +70,11 @@ mpfr_check(mpfr_srcptr x) if ((MPFR_EXP(x) < __gmpfr_emin) || (MPFR_EXP(x) > __gmpfr_emax)) return 0; } - else if (!(MPFR_IS_ZERO(x) || MPFR_IS_NAN(x) || MPFR_IS_INF(x))) - return 0; + else + { + /* Singular value is zero, inf or nan */ + MPFR_ASSERTD(MPFR_IS_ZERO(x) || MPFR_IS_NAN(x) || MPFR_IS_INF(x)); + } return 1; } |