(j3.2006) is MOD (INT_MIN, -1) legal?
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?
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the J3