public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/49024] New: REAL*16 ERFC_SCALED inaccuracy
@ 2011-05-17 14:28 thenlich at users dot sourceforge.net
  2011-05-23 11:01 ` [Bug libfortran/49024] " fxcoudert at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: thenlich at users dot sourceforge.net @ 2011-05-17 14:28 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: REAL*16 ERFC_SCALED inaccuracy
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: thenlich@users.sourceforge.net


The libfortran implementation of the ERFC_SCALED intrinsic function is not
accurate enough to be useful for REAL*16 arithmetics.

program test_erfc_scaled
    real(16), parameter :: p16 = 1.0_16
    real(16) :: v16 = p16

    print *, erfc_scaled(v16)
    print *, erfc_scaled(p16)
    print *, erfc(v16) * exp(v16 * v16)
end program test_erfc_scaled

==>
  0.427583576155807003967191251980322016      
  0.427583576155807004410750344490515188      
  0.427583576155807004410750344490515140      

This should be easy to fix by adding an erfc_scaled() function to libquadmath.

In fact, the error function code in libquadmath is based on the same code as
http://www.netlib.org/cephes/128bdoc.html and the latter already contains a
separate function for a scaled error function. In libquadmath it has been
merged into one (or maybe the other was split later).


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/49024] REAL*16 ERFC_SCALED inaccuracy
  2011-05-17 14:28 [Bug libfortran/49024] New: REAL*16 ERFC_SCALED inaccuracy thenlich at users dot sourceforge.net
@ 2011-05-23 11:01 ` fxcoudert at gcc dot gnu.org
  2011-05-23 20:54 ` fxcoudert at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2011-05-23 11:01 UTC (permalink / raw)
  To: gcc-bugs

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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.05.23 10:34:35
                 CC|                            |fxcoudert at gcc dot
                   |                            |gnu.org
         AssignedTo|unassigned at gcc dot       |fxcoudert at gcc dot
                   |gnu.org                     |gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> 2011-05-23 10:34:35 UTC ---
I'll take that one, thanks for the report.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/49024] REAL*16 ERFC_SCALED inaccuracy
  2011-05-17 14:28 [Bug libfortran/49024] New: REAL*16 ERFC_SCALED inaccuracy thenlich at users dot sourceforge.net
  2011-05-23 11:01 ` [Bug libfortran/49024] " fxcoudert at gcc dot gnu.org
@ 2011-05-23 20:54 ` fxcoudert at gcc dot gnu.org
  2011-05-23 21:45 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2011-05-23 20:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> 2011-05-23 19:53:31 UTC ---
The 128-bit code for scaled erfc in Cephes is terrible. For ERFC_SCALED(1), it
gives:
  0.427592...
instead of:
  0.427583...

I don't see any easy way about this, someone will have to play minimax :)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/49024] REAL*16 ERFC_SCALED inaccuracy
  2011-05-17 14:28 [Bug libfortran/49024] New: REAL*16 ERFC_SCALED inaccuracy thenlich at users dot sourceforge.net
  2011-05-23 11:01 ` [Bug libfortran/49024] " fxcoudert at gcc dot gnu.org
  2011-05-23 20:54 ` fxcoudert at gcc dot gnu.org
@ 2011-05-23 21:45 ` burnus at gcc dot gnu.org
  2011-05-23 22:12 ` fxcoudert at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-05-23 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-05-23 21:20:46 UTC ---
(In reply to comment #2)
> The 128-bit code for scaled erfc in Cephes is terrible. [...]

For 128 bits: do you plan to handle it in libgfortran or directly in
libquadmath? I think one can export another function directly in libquadmath,
which should be easier to handle - and yield faster code.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/49024] REAL*16 ERFC_SCALED inaccuracy
  2011-05-17 14:28 [Bug libfortran/49024] New: REAL*16 ERFC_SCALED inaccuracy thenlich at users dot sourceforge.net
                   ` (2 preceding siblings ...)
  2011-05-23 21:45 ` burnus at gcc dot gnu.org
@ 2011-05-23 22:12 ` fxcoudert at gcc dot gnu.org
  2013-11-20 22:19 ` fxcoudert at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2011-05-23 22:12 UTC (permalink / raw)
  To: gcc-bugs

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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|fxcoudert at gcc dot        |unassigned at gcc dot
                   |gnu.org                     |gnu.org

--- Comment #4 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> 2011-05-23 21:48:42 UTC ---
(In reply to comment #3)
> For 128 bits: do you plan to handle it in libgfortran or directly in
> libquadmath? I think one can export another function directly in libquadmath,
> which should be easier to handle - and yield faster code.

I've thought about it a bit, both are fine with me. But… I don't have time to
play with Mathematica right now to find the good approximations in each
possible range, so I'll unassign myself.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/49024] REAL*16 ERFC_SCALED inaccuracy
  2011-05-17 14:28 [Bug libfortran/49024] New: REAL*16 ERFC_SCALED inaccuracy thenlich at users dot sourceforge.net
                   ` (3 preceding siblings ...)
  2011-05-23 22:12 ` fxcoudert at gcc dot gnu.org
@ 2013-11-20 22:19 ` fxcoudert at gcc dot gnu.org
  2013-11-21  8:46 ` fxcoudert at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2013-11-20 22:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Author: fxcoudert
Date: Wed Nov 20 22:18:55 2013
New Revision: 205151

URL: http://gcc.gnu.org/viewcvs?rev=205151&root=gcc&view=rev
Log:
    PR libfortran/49024

    * intrinsics/erfc_scaled.c (erfc_scaled_r16): New function.
    * intrinsics/erfc_scaled_inc.c: Do not provide quadruple
    precision variant.

    * gfortran.dg/erf_3.F90: New file.

Added:
    trunk/gcc/testsuite/gfortran.dg/erf_3.F90
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/intrinsics/erfc_scaled.c
    trunk/libgfortran/intrinsics/erfc_scaled_inc.c


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/49024] REAL*16 ERFC_SCALED inaccuracy
  2011-05-17 14:28 [Bug libfortran/49024] New: REAL*16 ERFC_SCALED inaccuracy thenlich at users dot sourceforge.net
                   ` (4 preceding siblings ...)
  2013-11-20 22:19 ` fxcoudert at gcc dot gnu.org
@ 2013-11-21  8:46 ` fxcoudert at gcc dot gnu.org
  2013-11-21  8:46 ` fxcoudert at gcc dot gnu.org
  2013-11-21  9:21 ` schwab@linux-m68k.org
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2013-11-21  8:46 UTC (permalink / raw)
  To: gcc-bugs

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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

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

--- Comment #6 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Fixed on trunk.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/49024] REAL*16 ERFC_SCALED inaccuracy
  2011-05-17 14:28 [Bug libfortran/49024] New: REAL*16 ERFC_SCALED inaccuracy thenlich at users dot sourceforge.net
                   ` (5 preceding siblings ...)
  2013-11-21  8:46 ` fxcoudert at gcc dot gnu.org
@ 2013-11-21  8:46 ` fxcoudert at gcc dot gnu.org
  2013-11-21  9:21 ` schwab@linux-m68k.org
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2013-11-21  8:46 UTC (permalink / raw)
  To: gcc-bugs

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

Bug 49024 depends on bug 59227, which changed state.

Bug 59227 Summary: [4.9 regression] FAIL: gfortran.dg/erf_3.F90  -O0  execution test
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59227

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/49024] REAL*16 ERFC_SCALED inaccuracy
  2011-05-17 14:28 [Bug libfortran/49024] New: REAL*16 ERFC_SCALED inaccuracy thenlich at users dot sourceforge.net
                   ` (6 preceding siblings ...)
  2013-11-21  8:46 ` fxcoudert at gcc dot gnu.org
@ 2013-11-21  9:21 ` schwab@linux-m68k.org
  7 siblings, 0 replies; 9+ messages in thread
From: schwab@linux-m68k.org @ 2013-11-21  9:21 UTC (permalink / raw)
  To: gcc-bugs

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

Bug 49024 depends on bug 59227, which changed state.

Bug 59227 Summary: [4.9 regression] FAIL: gfortran.dg/erf_3.F90  -O0  execution test
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59227

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-11-21  9:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-17 14:28 [Bug libfortran/49024] New: REAL*16 ERFC_SCALED inaccuracy thenlich at users dot sourceforge.net
2011-05-23 11:01 ` [Bug libfortran/49024] " fxcoudert at gcc dot gnu.org
2011-05-23 20:54 ` fxcoudert at gcc dot gnu.org
2011-05-23 21:45 ` burnus at gcc dot gnu.org
2011-05-23 22:12 ` fxcoudert at gcc dot gnu.org
2013-11-20 22:19 ` fxcoudert at gcc dot gnu.org
2013-11-21  8:46 ` fxcoudert at gcc dot gnu.org
2013-11-21  8:46 ` fxcoudert at gcc dot gnu.org
2013-11-21  9:21 ` schwab@linux-m68k.org

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).