This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix builtin-explog-1.c.


Hi,

Attached is a 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-02-28  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); \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]