summaryrefslogtreecommitdiff
path: root/tests/tadd_ui.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2002-03-26 18:39:57 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2002-03-26 18:39:57 +0000
commitb6ca46407474e07a435ec12b45dc77e067ff6779 (patch)
treec646f424e87e47b64f46d65670ec564f9c206cdf /tests/tadd_ui.c
parent966581fea9ed11672ce12db8436d8bd72fa47e95 (diff)
downloadmpfr-b6ca46407474e07a435ec12b45dc77e067ff6779.tar.gz
- use mpfr_test_init to initialize harware floats
- use #ifdef HAVE_INFS when using DBL_NAN, ... - fixed some problems with wrongly converted f-p values (esp. under IRIX) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1783 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tadd_ui.c')
-rw-r--r--tests/tadd_ui.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/tadd_ui.c b/tests/tadd_ui.c
index d86afc021..05bc796f3 100644
--- a/tests/tadd_ui.c
+++ b/tests/tadd_ui.c
@@ -25,6 +25,7 @@ MA 02111-1307, USA. */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
+#include <time.h>
#include "gmp.h"
#include "mpfr.h"
#include "mpfr-impl.h"
@@ -46,7 +47,7 @@ check3 (double x, unsigned long y, unsigned int rnd_mode, double z1)
mpfr_init2(zz, 53);
mpfr_set_d(xx, x, rnd_mode);
mpfr_add_ui(zz, xx, y, rnd_mode);
-#ifdef TEST
+#ifdef HAVE_FENV
mpfr_set_machine_rnd_mode(rnd_mode);
#endif
if (z1==0.0) z1 = x+y;
@@ -76,15 +77,10 @@ special (void)
int
main (int argc, char *argv[])
{
-#ifdef TEST
+#ifdef HAVE_FENV
double x; unsigned long y, N; int i,rnd_mode,rnd;
-#ifdef __mips
- /* to get denormalized numbers on IRIX64 */
- union fpc_csr exp;
- exp.fc_word = get_fpc_csr();
- exp.fc_struct.flush = 0;
- set_fpc_csr(exp.fc_word);
-#endif
+
+ mpfr_test_init ();
SEED_RAND (time(NULL));
N = (argc<2) ? 1000000 : atoi(argv[1]);
@@ -107,9 +103,11 @@ main (int argc, char *argv[])
check3 (-6.72658901114033715233e-165, 2000878121, GMP_RNDZ,
2.0008781209999997615e9);
check3 (-2.0769715792901673e-5, 880524, GMP_RNDN, 8.8052399997923023e5);
+#ifdef HAVE_INFS
check3 (DBL_POS_INF, 2394875, GMP_RNDN, DBL_POS_INF);
check3 (DBL_NEG_INF, 2394875, GMP_RNDN, DBL_NEG_INF);
check3 (DBL_NAN, 2394875, GMP_RNDN, DBL_NAN);
+#endif
return 0;
}