[Bug fortran/49010] Result of MOD and MODULO intrinsic has wrong sign

jb at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat May 5 08:17:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49010

Janne Blomqvist <jb at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED

--- Comment #13 from Janne Blomqvist <jb at gcc dot gnu.org> 2012-05-05 08:11:35 UTC ---
Closing as fixed. The new behavior should now be identical for constant and
non-constant arguments (assuming that at runtime the target inline expands fmod
(at least x86(-64) does this) or the library fmod conforms to C99 Annex F).

Wrt. the sign of the result, we now provide the following behavior (again,
assuming that also the runtime behavior of fmod conforms to C99 Annex F) which
also applies when the result is (signed) zero:

MOD(A, P): The result has the sign of A and a magnitude less than
that of P.  

MODULO(A, P): The result has the sign of P and a magnitude less than
that of P.

Note that this is not the same as calculating the result according to the
formula in the standard using the IEEE 754 rules for signed zero arithmetic,
but rather makes sure that the sign behavior is consistent for zero and
non-zero results.



More information about the Gcc-bugs mailing list