+2005-01-06 Geoffrey Keating <geoffk@apple.com>
+
+ * c-cppbuiltin.c (builtin_define_float_constants): Set __*_EPSILON__
+ for IBM long double format correctly.
+
2005-01-06 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/18792
/* The difference between 1 and the least value greater than 1 that is
representable in the given floating point type, b**(1-p). */
sprintf (name, "__%s_EPSILON__", name_prefix);
- sprintf (buf, "0x1p%d", (1 - fmt->p) * fmt->log2_b);
+ if (fmt->pnan < fmt->p)
+ /* This is an IBM extended double format, so 1.0 + any double is
+ representable precisely. */
+ sprintf (buf, "0x1p%d", (fmt->emin - fmt->p) * fmt->log2_b);
+ else
+ sprintf (buf, "0x1p%d", (1 - fmt->p) * fmt->log2_b);
builtin_define_with_hex_fp_value (name, type, decimal_dig, buf, fp_suffix);
/* For C++ std::numeric_limits<T>::denorm_min. The minimum denormalized
--- /dev/null
+/* { dg-do run { target powerpc*-*-darwin* powerpc*-*-aix* powerpc64-*-linux rs6000-*-* } } */
+/* { dg-options "-mlong-double-128" } */
+
+/* Check that LDBL_EPSILON is right for 'long double'. */
+
+#include <float.h>
+
+extern void abort (void);
+
+int main(void)
+{
+ volatile long double ee = 1.0;
+ long double eps = ee;
+ while (ee + 1.0 != 1.0)
+ {
+ eps = ee;
+ ee = eps / 2;
+ }
+ if (eps != LDBL_EPSILON)
+ abort ();
+ return 0;
+}