aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-cppbuiltin.c
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@apple.com>2005-01-07 00:19:23 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2005-01-07 00:19:23 +0000
commit59d7d7678602bb8dcbeff337a44efc76a3451f01 (patch)
tree0320e08704708cbe4172df7b2f48317ed8252f47 /gcc/c-cppbuiltin.c
parent44d0e0415d3bad044a3850f97dac948963505ebe (diff)
downloadgcc-59d7d7678602bb8dcbeff337a44efc76a3451f01.zip
gcc-59d7d7678602bb8dcbeff337a44efc76a3451f01.tar.gz
gcc-59d7d7678602bb8dcbeff337a44efc76a3451f01.tar.bz2
c-cppbuiltin.c (builtin_define_float_constants): Set __*_EPSILON__ for IBM long double format correctly.
* c-cppbuiltin.c (builtin_define_float_constants): Set __*_EPSILON__ for IBM long double format correctly. From-SVN: r93021
Diffstat (limited to 'gcc/c-cppbuiltin.c')
-rw-r--r--gcc/c-cppbuiltin.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c
index cedf9e7..2c9039e 100644
--- a/gcc/c-cppbuiltin.c
+++ b/gcc/c-cppbuiltin.c
@@ -219,7 +219,12 @@ builtin_define_float_constants (const char *name_prefix, const char *fp_suffix,
/* 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