about summary refs log tree commit diff
path: root/math/basic-test.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-01-15 23:43:04 +0000
committerJakub Jelinek <jakub@redhat.com>2007-01-15 23:43:04 +0000
commitd68f5d2cff7cd9fb5f1f5dfa4c24d245766bab49 (patch)
treec0cea5b208d8ff8f46eb3b6008959b268012bf51 /math/basic-test.c
parent2a1dea970d565187255f6acffcb9963d6cefc674 (diff)
downloadglibc-d68f5d2cff7cd9fb5f1f5dfa4c24d245766bab49.tar.gz
glibc-d68f5d2cff7cd9fb5f1f5dfa4c24d245766bab49.tar.xz
glibc-d68f5d2cff7cd9fb5f1f5dfa4c24d245766bab49.zip
[BZ #2749]
* soft-fp/op-common.h (FP_TRUNC): When truncating a NaN, clear 
workbits in semi-raw fraction.
	* math/test-misc.c: Add new tests.

	* math/basic-test.c: Include test-skeleton.c.
	(TEST_TRUNC): Define.
	(truncdfsf_test, trunctfsf_test, trunctfdf_test): New.
	(main): Rename to ...
	(do_test): ...this.  Run new tests.
	(TEST_FUNCTION): Define.

	[BZ #2749]
	* soft-fp/op-4.h (__FP_FRAC_SUB_3, __FP_FRAC_SUB_4): Correct borrow
	handling for high words.
	* soft-fp/op-common.h (_FP_OVERFLOW_SEMIRAW): Always set inexact
	and overflow for infinity.
2007-01-15  Jakub Jelinek  <jakub@redhat.com>

	* soft-fp/op-common.h (FP_TRUNC): When truncating a NaN, clear
	workbits in semi-raw fraction.

	* math/test-misc.c: Add new tests.

2007-01-14  Steven Munroe  <sjmunroe@us.ibm.com>

	* math/basic-test.c: Include test-skeleton.c.
	(TEST_TRUNC): Define.
	(truncdfsf_test, trunctfsf_test, trunctfdf_test): New.
	(main): Rename to ...
	(do_test): ...this.  Run new tests.
	(TEST_FUNCTION): Define.

2006-10-05  Steven Munroe  <sjmunroe@us.ibm.com>
	    Joe Kerian  <jkerian@us.us.ibm.com>

	[BZ #2749]
	* soft-fp/op-4.h (__FP_FRAC_SUB_3, __FP_FRAC_SUB_4): Correct borrow
	handling for high words.
	* soft-fp/op-common.h (_FP_OVERFLOW_SEMIRAW): Always set inexact
	and overflow for infinity.
Diffstat (limited to 'math/basic-test.c')
-rw-r--r--math/basic-test.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/math/basic-test.c b/math/basic-test.c
index e42c014572..e48a3ae4e0 100644
--- a/math/basic-test.c
+++ b/math/basic-test.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999.
 
@@ -44,7 +44,7 @@ NAME (void)								      \
 									      \
   zero_var = 0.0;							      \
   one_var = 1.0;							      \
-  NaN_var = zero_var/zero_var;						      \
+  NaN_var = zero_var / zero_var;					      \
   Inf_var = one_var / zero_var;						      \
 									      \
   (void) &zero_var;							      \
@@ -103,21 +103,51 @@ NAME (void)								      \
   check (#FLOAT " isinf (-HUGE_VALx) == -1", isinf (x1) == -1);		      \
 }
 
+#define TEST_TRUNC(NAME, FLOAT, DOUBLE) \
+void									      \
+NAME (void)								      \
+{									      \
+  volatile DOUBLE Inf_var, NaN_var, zero_var, one_var;			      \
+  FLOAT x1, x2;								      \
+									      \
+  zero_var = 0.0;							      \
+  one_var = 1.0;							      \
+  NaN_var = zero_var / zero_var;					      \
+  Inf_var = one_var / zero_var;						      \
+									      \
+  (void) &NaN_var;							      \
+  (void) &Inf_var;							      \
+									      \
+  x1 = (FLOAT) NaN_var;							      \
+  check (" "#FLOAT" x = ("#FLOAT") ("#DOUBLE") NaN", isnan (x1) != 0);	      \
+  x2 = (FLOAT) Inf_var;							      \
+  check (" "#FLOAT" x = ("#FLOAT") ("#DOUBLE") Inf", isinf (x2) != 0);	      \
+}
+
 TEST_FUNC (float_test, float, nanf, FLT_EPSILON, HUGE_VALF)
 TEST_FUNC (double_test, double, nan, DBL_EPSILON, HUGE_VAL)
+TEST_TRUNC (truncdfsf_test, float, double)
 #ifndef NO_LONG_DOUBLE
 TEST_FUNC (ldouble_test, long double, nanl, LDBL_EPSILON, HUGE_VALL)
+TEST_TRUNC (trunctfsf_test, float, long double)
+TEST_TRUNC (trunctfdf_test, double, long double)
 #endif
 
 int
-main (void)
+do_test (void)
 {
   float_test ();
   double_test ();
+  truncdfsf_test();
 
 #ifndef NO_LONG_DOUBLE
   ldouble_test ();
+  trunctfsf_test();
+  trunctfdf_test();
 #endif
 
   return errors != 0;
 }
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"