(j3.2006) is MOD (INT_MIN, -1) legal?
Mon Oct 27 17:25:00 EDT 2008
j3-bounces at j3-fortran.org wrote on 10/27/2008 04:50:33 PM:
> > 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)?
> Is INT_MIN the same as -huge( 0) ?
> Is mod() the same as % ?
> > 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 is overflow as per the standard,
> or just in some implementations?
OK, let me try to rephrase the question: in MOD(A,P) the standard says: "
Result Value. The value of the result is A?INT (A/P) * P."
The question is: does this mean that any restrictions apply to expression
"A?INT (A/P) * P" also apply to intrinsic MOD()?
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