[Cfp-interest] Signaling NaNs and Fortran
Fred J. Tydeman
tydeman at tybor.com
Wed Mar 16 02:50:21 PDT 2011
Fortran, for some time, has had "support" for signaling NaNs.
The following program is supposed to create single and double
kinds of signaling and quiet NaNs; and then print them.
For those people who have access to Fortran compilers, would
you please run this and report back the results.
This is to help determine how C should print signaling NaNs.
program ieee_test_nan
use, intrinsic :: ieee_arithmetic
implicit none
real(4) :: ss, sq
real(8) :: ds, dq
ss = ieee_value(ss,ieee_signaling_nan)
sq = ieee_value(sq,ieee_quiet_nan)
ds = ieee_value(ds,ieee_signaling_nan)
dq = ieee_value(dq,ieee_quiet_nan)
write (*,*) "snan, 32-bit prints as: ", ss
write (*,*) "qnan, 32-bit prints as: ", sq
write (*,*) "snan, 64-bit prints as: ", ds
write (*,*) "qnan, 64-bit prints as: ", dq
end
---
Fred J. Tydeman Tydeman Consulting
tydeman at tybor.com Testing, numerics, programming
+1 (775) 358-9748 Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.
More information about the Cfp-interest
mailing list