bugGNU Octave - Bugs: bug #36364, DERF.F: Inaccurate results for...

 
 

bug #36364: DERF.F: Inaccurate results for very small values of x

Submitter:  None
Submitted:  Tue 01 May 2012 11:32:30 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Fixed Assigned to:  None
Originator Name:  jofriet Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.1
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 14 Jun 2012 03:37:53 PM UTC, comment #5: 

SLATEC is a great resource, but completely unsupported.  Special functions, like erf(), are available from the Netlib repository either in netlib.org/slatec/fnlib or in netlib.org/fn.  I found the following comment at www.netlib.org/slatec.


lib        fnlib
for        the FNLIB subset of SLATEC
# removed from slatec/src to make the main source more accessible
# see also /netlib/fn, which is another version;  we don't really
# know which one is more recent or bug-free.  If you figure it out
# please send email to ehg@research.bell-labs.com.


Clearly there is a lot of confusion.

To resolve this I am just going to patch Octave's Fortran source to be correct and not attempt to resolve the upstream repository issues.  The fix was done in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/d213da1a16a6).

Rik <rik5>
Group administrator
Wed 13 Jun 2012 07:42:11 PM UTC, comment #4: 

I have confirmed this issue.  The Fortran code from SLATEC is in error.  The reason it has rarely been a problem is that Octave usually links in the erf() function from the C math library.  It is only when that version is unavailable that we switch over to the Fortran version that Octave ships in libcruft.  This does occasionally happen as has been reported on the MinGW platform in reference to a different bug.  I will take this up on the Octave mailing list soon for the best way to implement a fix.

Rik <rik5>
Group administrator
Fri 18 May 2012 05:15:15 PM UTC, comment #3: 

The issue seems problematic in the same way that updating the ARPACK library to tackle a problem revealed in svds was problematic.  According to Wikipedia (http://en.wikipedia.org/wiki/SLATEC), SLATEC was published in 1993 and is probably orphaned in that there isn't a bug tracker or anyone maintaining it.  We could update the Fortran code in our repository, but maybe it is better to reach out to the rest of the numerical analysis community and see if there isn't a maintained SLATEC available or maybe we want to set up such a beast as was done for ng-arpack.

Rik <rik5>
Group administrator
Wed 09 May 2012 04:01:32 AM UTC, comment #2: 

(reposting the suggested fix, formatted for the bug tracker)


In the file DERF.F, part of libcruft, the line:


IF (Y.LE.SQEPS) DERF = 2.0D0*X*X/SQRTPI


should be:


IF (Y.LE.SQEPS) DERF = 2.0D0*X/SQRTPI


Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Wed 09 May 2012 03:56:56 AM UTC, comment #1: 

The bug tracker software uses a markup language such that asterisks, used in multiplication, convert the text to bold.  The code samples you entered seem to have been mangled.  Can you re-post the line to be changed but quote it with '+verbatim+' and '-verbatim-'?  If you could give the line number in the code that would help too since these numbers don't change much for the Fortran sections.


Rik <rik5>
Group administrator
Tue 01 May 2012 11:32:30 PM UTC, original submission:  

In the file DERF.F, part of libcruft, the line:

IF (Y.LE.SQEPS) DERF = 2.0D0*X*X/SQRTPI

should be:

IF (Y.LE.SQEPS) DERF = 2.0D0*X/SQRTPI

Note that this should be immediately obvious from the definition of the error function (http://en.wikipedia.org/wiki/Error_function) and from the wrong sign for small negative values of x. The bug is present in the SLATEC version of FNLIB, but not in FN: see http://www.netlib.org/slatec/fnlib/derf.f and http://www.netlib.org/fn/derf.f.

The function erf in octave itself seems to function fine though.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by melrobin
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-06-14 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2012-06-13 rik5 StatusNone Confirmed
    2012-05-02 melrobin Carbon-Copy- Added melrobin

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code