diff options
author | Steven G. Kargl <kargls@comcast.net> | 2005-04-14 16:29:31 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2005-04-14 16:29:31 +0000 |
commit | 2d0aa65f1e2fc95e857bc1ad1e11beee44219ba8 (patch) | |
tree | 91ef8649fbc7ae8aff33dfc61c5c29331b64cf22 /gcc/fortran/arith.c | |
parent | 6cecb0aa9673e3dcbb45de4d8050674f405dc958 (diff) | |
download | gcc-2d0aa65f1e2fc95e857bc1ad1e11beee44219ba8.zip gcc-2d0aa65f1e2fc95e857bc1ad1e11beee44219ba8.tar.gz gcc-2d0aa65f1e2fc95e857bc1ad1e11beee44219ba8.tar.bz2 |
gfortran.h (gfc_real_info): Add subnormal struct member.
* gfortran.h (gfc_real_info): Add subnormal struct member.
* arith.c (gfc_arith_init_1): Set it.
(gfc_check_real_range): Use it.
* simplify.c (gfc_simplify_nearest): Fix nearest(0.,1.).
From-SVN: r98141
Diffstat (limited to 'gcc/fortran/arith.c')
-rw-r--r-- | gcc/fortran/arith.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c index 50e2d06..ef19217 100644 --- a/gcc/fortran/arith.c +++ b/gcc/fortran/arith.c @@ -259,6 +259,14 @@ gfc_arith_init_1 (void) mpfr_init (real_info->tiny); mpfr_set (real_info->tiny, b, GFC_RND_MODE); + /* subnormal (x) = b**(emin - digit + 1) */ + mpfr_set_ui (b, real_info->radix, GFC_RND_MODE); + mpfr_pow_si (b, b, real_info->min_exponent - real_info->digits + 1, + GFC_RND_MODE); + + mpfr_init (real_info->subnormal); + mpfr_set (real_info->subnormal, b, GFC_RND_MODE); + /* epsilon(x) = b**(1-p) */ mpfr_set_ui (b, real_info->radix, GFC_RND_MODE); mpfr_pow_si (b, b, 1 - real_info->digits, GFC_RND_MODE); @@ -374,7 +382,7 @@ gfc_check_real_range (mpfr_t p, int kind) retval = ARITH_OK; else if (mpfr_cmp (q, gfc_real_kinds[i].huge) > 0) retval = ARITH_OVERFLOW; - else if (mpfr_cmp (q, gfc_real_kinds[i].tiny) < 0) + else if (mpfr_cmp (q, gfc_real_kinds[i].subnormal) < 0) retval = ARITH_UNDERFLOW; else retval = ARITH_OK; |