[fortran] patch for PR 12839 - incorrect IO of inf
Bud Davis
bdavis9659@comcast.net
Sun Apr 4 19:26:00 GMT 2004
On Wed, 2004-03-24 at 07:38, Paul Brook wrote:
>
> I think it's probably worth asking on comp.lang.fortran about this.
>
> Paul
below is the posting to clf:
Some question arose while implemnting this F2003 change to "Fw.d"
output in gfortran. The issues are small, but some help from the
experts on clf would be appreciated.
>From page 228 of the (draft) standard:
"For an internal value that is an IEEE infinity, the output field
consists of blanks, if necessary, followed
by a minus sign for negative infinity or an optional plus sign
otherwise, followed by the letters 'Inf ' or
'Infinity', right justified within the field. If w is less than 3, the
field is filled with asterisks; otherwise,
if w is less than 8, 'Inf ' is produced."
Is the following output:
FMT neg inf pos inf nan
F1.0 * * *
F2.0 ** ** **
F3.0 *** *** NaN
F4.0 -Inf +Inf NaN
F5.0 -Inf +Inf NaN
F6.0 -Inf +Inf NaN
F7.0 -Inf +Inf NaN
F8.0 -Inf +Inf NaN
F9.0-Infinity+Infinity NaN
from the following code:
real nan,neg_inf,pos_inf,zero
zero = 0.0
pos_inf = 1.0/zero
neg_inf = -1.0/zero
nan = zero/zero
print*,'FMT ','neg inf ',' pos inf ',' nan'
print '(A,8X,F1.0,8X,F1.0,8X,F1.0)','F1.0',neg_inf,pos_inf,nan
print '(A,7X,F2.0,7X,F2.0,7X,F2.0)','F2.0',neg_inf,pos_inf,nan
print '(A,6X,F3.0,6X,F3.0,6X,F3.0)','F3.0',neg_inf,pos_inf,nan
print '(A,5X,F4.0,5X,F4.0,5X,F4.0)','F4.0',neg_inf,pos_inf,nan
print '(A,4X,F5.0,4X,F5.0,4X,F5.0)','F5.0',neg_inf,pos_inf,nan
print '(A,3X,F6.0,3X,F6.0,3X,F6.0)','F6.0',neg_inf,pos_inf,nan
print '(A,2X,F7.0,2X,F7.0,2X,F7.0)','F7.0',neg_inf,pos_inf,nan
print '(A,1X,F8.0,1X,F8.0,1X,F8.0)','F8.0',neg_inf,pos_inf,nan
print '(A,F9.0,F9.0,F9.0)','F9.0',neg_inf,pos_inf,nan
end
standard conforming ?
Specific questions are:
pos inf, F3.x, should it be "***" or "Inf" ?
pos inf, F8.x, should it be " +Inf" or "Infinity" ?
Reply to the newsgroup or direct, please. I will gladly read them
all.
thanks,
bud davis
bdavis9659@comcast.net
More information about the Fortran
mailing list