This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/24518] New: Intrinsic MOD incorrect for large arg1/arg2 and slow.
- From: "paul dot richard dot thomas at cea dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Oct 2005 13:21:47 -0000
- Subject: [Bug fortran/24518] New: Intrinsic MOD incorrect for large arg1/arg2 and slow.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This:
real*8 :: x = 10.0e9
do i = 10, 22
x = 10d0 * x
print '(a,i2,a,g14.8)', "mod (10**",i,", 1.7_8) = ",mod (x, 1.7_8)
end do
end
does this with cvs gfortran
mod (10**10, 1.7_8) = 1.3000026
mod (10**11, 1.7_8) = 1.1000261
mod (10**12, 1.7_8) = 0.80026150
mod (10**13, 1.7_8) = 1.2026138
mod (10**14, 1.7_8) = 0.12609863
mod (10**15, 1.7_8) = 1.2607422
mod (10**16, 1.7_8) = 5.8125000
mod (10**17, 1.7_8) = -50.687500
mod (10**18, 1.7_8) = 364.00000
mod (10**19, 1.7_8) = -.70000000E+20
mod (10**20, 1.7_8) = -.70000000E+21
mod (10**21, 1.7_8) = -.70000000E+22
mod (10**22, 1.7_8) = -.70000000E+23
and this with a leading commercial brand:
mod (10**10, 1.7_8) = 1.3000026
mod (10**11, 1.7_8) = 1.1000261
mod (10**12, 1.7_8) = 0.80026123
mod (10**13, 1.7_8) = 1.2026123
mod (10**14, 1.7_8) = 0.12612289
mod (10**15, 1.7_8) = 1.2612289
mod (10**16, 1.7_8) = 0.71228947
mod (10**17, 1.7_8) = 0.32289470
mod (10**18, 1.7_8) = 1.5289470
mod (10**19, 1.7_8) = 1.6894697
mod (10**20, 1.7_8) = 1.5946971
mod (10**21, 1.7_8) = 0.64697063
mod (10**22, 1.7_8) = 0.86970625
gfortran loses it at around 10**16 and starts producing values larger than the
second argument. Whilst, to some degree, one deserves to be hit on the nose for
trying to calculate mod for these values, a slightly less deviant behaviour
might be better.
As noted in the list http://gcc.gnu.org/ml/fortran/2005-10/msg00482.html, this
leading brand is about twice as fast in calulating mod, as gfortran, in spite
of its apparently using 64 bit arithmetic.
--
Summary: Intrinsic MOD incorrect for large arg1/arg2 and slow.
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: paul dot richard dot thomas at cea dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24518