This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: ieee on Windows problem
- From: FX <fxcoudert at gmail dot com>
- To: Brad Finney <Brad dot Finney at humboldt dot edu>
- Cc: Fortran List <fortran at gcc dot gnu dot org>
- Date: Mon, 30 Jun 2014 21:31:41 +0200
- Subject: Re: ieee on Windows problem
- Authentication-results: sourceware.org; auth=none
- References: <53B054A4 dot 7010605 at humboldt dot edu> <349E5602-B3F8-4F3D-806A-F63715AD0219 at gmail dot com> <AC408B86-F682-4E16-B997-F0492FB40F1D at gmail dot com> <53B0F7B8 dot 1050704 at humboldt dot edu> <957A92AC-CF82-4086-93AF-A98A993EF2AD at gmail dot com> <53B1B5D3 dot 9090209 at humboldt dot edu>
> OK, all of the test programs EXCEPT ieee_2.f90 execute successfully.
Nice!
> ieee_2.f90 crashes on the following line
> if (ieee_class(ieee_logb(-sx1)) /= ieee_positive_inf) call abort
Can you tell me what the following program outputs? (compiled with no optimization and the IEEE flags)
use, intrinsic :: ieee_arithmetic
real :: sx1
sx1 = ieee_value(sx1, ieee_positive_inf)
print *, sx1, -sx1
print *, ieee_logb(sx1), ieee_logb(-sx1)
print *, exponent(sx1), exponent(-sx1)
end
For me, on x86_64-apple-darwin, it shows:
Infinity -Infinity
Infinity Infinity
0 0
which is, by my reading, correct for IEEE_LOGB, but incorrect for the pre-existing EXPONENT intrinsic ("If X is an IEEE infinity or NaN, the result has the value HUGE(0)”).
FX