public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "paul dot richard dot thomas at cea dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/24518]  New: Intrinsic MOD incorrect for large arg1/arg2 and slow.
Date: Tue, 25 Oct 2005 13:21:00 -0000	[thread overview]
Message-ID: <bug-24518-9236@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2005-10-25 13:21 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-25 13:21 paul dot richard dot thomas at cea dot fr [this message]
2005-10-25 14:37 ` [Bug fortran/24518] " pinskia at gcc dot gnu dot org
2006-06-20 12:44 ` fxcoudert at gcc dot gnu dot org
2006-06-21  8:04 ` paul dot richard dot thomas at cea dot fr
2006-10-22 21:01 ` fxcoudert at gcc dot gnu dot org
2006-10-23  6:19 ` fxcoudert at gcc dot gnu dot org
2006-10-25  7:34 ` uros at kss-loka dot si
2006-10-25  8:19 ` fxcoudert at gcc dot gnu dot org
2006-10-25 11:49 ` uros at kss-loka dot si
2006-10-25 13:53 ` fxcoudert at gcc dot gnu dot org
2006-10-25 14:16 ` uros at kss-loka dot si
2006-10-26  4:04 ` sgk at troutmask dot apl dot washington dot edu
2006-10-26 20:09 ` pault at gcc dot gnu dot org
2006-10-26 22:22 ` uros at kss-loka dot si
2006-10-31 15:56 ` pault at gcc dot gnu dot org
2006-10-31 16:06 ` fxcoudert at gcc dot gnu dot org
2006-10-31 16:14 ` paul dot richard dot thomas at cea dot fr
2006-10-31 16:21 ` pault at gcc dot gnu dot org
2006-10-31 16:47 ` fxcoudert at gcc dot gnu dot org
2006-11-05  6:28 ` pault at gcc dot gnu dot org
2006-11-05  8:46 ` pault at gcc dot gnu dot org
2006-11-05 22:18 ` pault at gcc dot gnu dot org
2006-11-10 21:53 ` pault at gcc dot gnu dot org
2006-12-01  0:09 ` chaoyingfu at gcc dot gnu dot org
2006-12-02  8:12 ` ebotcazou at gcc dot gnu dot org
2006-12-02  8:23 ` burnus at gcc dot gnu dot org
2006-12-02  8:28 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-24518-9236@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).