[patch] Fix builtin-explog-1.c. (take 2)

Kazu Hirata kazu@cs.umass.edu
Mon Mar 1 06:01:00 GMT 2004


Hi,

Attached is a revised patch to fix builtin-explog-1.c.

On H8, float is the only floating point math available, and types like
long double or double are the same as float.  Consequently, the
following test fails by the smallest margin.

 if (EXP(5.0) < (BASE)*(BASE)*(BASE)*(BASE)*(BASE) - PREC \
  || EXP(5.0) > (BASE)*(BASE)*(BASE)*(BASE)*(BASE) + PREC \

The patch relaxes PREC and PRECL if the target does not actually have
double or long double.

Tested on h8300-elf.  OK to apply?

Kazu Hirata

2004-03-01  Kazu Hirata  <kazu@cs.umass.edu>

	* gcc.dg/torture/builtin-explog-1.c (PREC): Make it the same
	as PRECF if sizeof (float) > sizeof (double).
	(PRECL): Make it the same as PRECF if
	sizeof (float) > sizeof (long double).

Index: builtin-explog-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/torture/builtin-explog-1.c,v
retrieving revision 1.1
diff -u -r1.1 builtin-explog-1.c
--- builtin-explog-1.c	9 Sep 2003 22:10:32 -0000	1.1
+++ builtin-explog-1.c	29 Feb 2004 01:14:52 -0000
@@ -13,9 +13,10 @@
 #define M_EF 2.7182818284590452353602874713526624977572470936999595749669676277241F
 #define M_EL 2.7182818284590452353602874713526624977572470936999595749669676277241L
 /* Precision for comparison tests.  */
-#define PREC  0.0000001
+#define PREC  (sizeof (float) < sizeof (double) ? 0.0000001 : PRECF)
 #define PRECF 0.0001F
-#define PRECL 0.0000000000001L
+#define PRECL (sizeof (float) < sizeof (long double)	\
+	       ? 0.0000000000001L : PRECF)
 #define PROTOTYPE(FN) extern double FN(double); extern float FN##f(float); \
   extern long double FN##l(long double);
 #define PROTOTYPE2(FN) extern double FN(double, double); \



More information about the Gcc-patches mailing list