(j3.2006) is MOD (INT_MIN, -1) legal?
Jim Xia
jimxia
Mon Oct 27 16:43:55 EDT 2008
This discussion originally came from C community on INT_MIN % (-1). Say
you have a minimum integer value, INT_MIN (e.g. -HUGE(1) - 1), then is it
a legal Fortran code to compute MOD(INT_MIN, -1)?
Based on the text in 13.7.80 of F03, MOD(A,P) is interpreted as A - INT (
A / P) * P. This expression applied on MOD(INT_MIN, -1) will result in a
computation of INT_MIN / (-1), which overflows. Does this confirm that
Fortran language will view this computation as invalid?
Thanks,
Jim Xia
RL Fortran Compiler Test
IBM Toronto Lab at 8200 Warden Ave, Markham, On, L6G 1C7
Phone (905) 413-3444 Tie-line 313-3444
email: jimxia at ca.ibm.com
D2/YF7/8200 /MKM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://j3-fortran.org/pipermail/j3/attachments/20081027/c4bf69f8/attachment.html
More information about the J3
mailing list