public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/24518] Intrinsic MOD incorrect for large arg1/arg2 and slow. Date: Tue, 20 Jun 2006 12:44:00 -0000 [thread overview] Message-ID: <20060620122257.15601.qmail@sourceware.org> (raw) In-Reply-To: <bug-24518-9236@http.gcc.gnu.org/bugzilla/> ------- Comment #2 from fxcoudert at gcc dot gnu dot org 2006-06-20 12:22 ------- Why exactly aren't we using BUILT_IN_FMOD{F,,L}? $ cat a.f90 real*8 :: x = 10.0e9 do i = 10, 22 x = 10d0 * x print '(a,i2,a,g14.8," = ",g14.8)', "mod (10**",i,", 1.7_8) = ", & fmod (x, 1.7_8), mod (x, 1.7_8); end do end $ cat a.c #include <math.h> double fmod_ (double *x, double *y) { return fmod(*x,*y); } $ gfortran a.f90 a.c && ./a.out mod (10**10, 1.7_8) = 1.3000026 = 1.3000026 mod (10**11, 1.7_8) = 1.1000261 = 1.1000261 mod (10**12, 1.7_8) = 0.80026120 = 0.80026150 mod (10**13, 1.7_8) = 1.2026123 = 1.2026138 mod (10**14, 1.7_8) = 0.12612289 = 0.12609863 mod (10**15, 1.7_8) = 1.2612289 = 1.2607422 mod (10**16, 1.7_8) = 0.71228945 = 5.8125000 mod (10**17, 1.7_8) = 0.32289469 = -50.687500 mod (10**18, 1.7_8) = 1.5289470 = 364.00000 mod (10**19, 1.7_8) = 1.6894697 = -.70000000E+20 mod (10**20, 1.7_8) = 1.5946971 = -.70000000E+21 mod (10**21, 1.7_8) = 0.64697063 = -.70000000E+22 mod (10**22, 1.7_8) = 0.86970627 = -.70000000E+23 It's actually slower: 55% slower at -O0 and 230% slower at -O2, on a loop with real(kind=8) variables modulo. But then, we're already testing whether the division can be represented by an integer, we could call fmod only in the case where it's not possible. Opinions? -- fxcoudert at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fxcoudert at gcc dot gnu dot | |org Last reconfirmed|2006-01-24 04:26:11 |2006-06-20 12:22:57 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24518
next prev parent reply other threads:[~2006-06-20 12:23 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-10-25 13:21 [Bug fortran/24518] New: " paul dot richard dot thomas at cea dot fr 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 [this message] 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 [not found] <bug-24518-4@http.gcc.gnu.org/bugzilla/> 2012-05-05 8:02 ` jb at gcc dot gnu.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=20060620122257.15601.qmail@sourceware.org \ --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: linkBe 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).