bugGNU Octave - Bugs: bug #50919, Beta function throws FORTRAN...

 
 

bug #50919: Beta function throws FORTRAN errors (Windows only)

Submitter:  None
Submitted:  Tue 02 May 2017 09:23:28 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  R Taylor Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.2.1
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 04 May 2017 01:06:14 AM UTC, comment #10: 

Took a long while to build a version through MXE, but I can also confirm that the fix works.  Closing report.

Rik <rik5>
Group administrator
Wed 03 May 2017 09:46:55 PM UTC, comment #9: 

I see the following result with the patch on a Windows system running in a virtualbox VM:


>> beta (-4.6, 0.6)
ans =  -8.5177e-016


John W. Eaton <jwe>
Group administrator
Wed 03 May 2017 04:49:44 PM UTC, comment #8: 

I forced an mxe-octave build on the buildbot.

John W. Eaton <jwe>
Group administrator
Wed 03 May 2017 04:38:44 PM UTC, comment #7: 

I verified that it didn't change the behavior on Linux.  However, I can build the MXE version right now to test on Windows.

Rik <rik5>
Group administrator
Wed 03 May 2017 02:00:26 PM UTC, comment #6: 

I don't think it's fp87 vs sse that's causing the trouble here.  The beta function ultimately calls the rc_gamma function in liboctave/numeric/lo-specfun.cc.  That function uses lgamma_r if it is available, otherwise it uses the SLATEC function DLGAMS (or ALGAMS).  I can reproduce the problem on my Debian system if I force Octave to use the SLATEC function.

On Windows systems, lgamma is available, but lgamma_r is not, so it uses the SLATEC function.  I pushed the following changeset so that Octave will use lgamma if it is available, and only if both lgamma_r and lgamma are unavailable, will it fall back to using the SLATEC function.  I'll test with an mxe-octave build when buildbot does its next build.

http://hg.savannah.gnu.org/hgweb/octave/rev/5296657cde44

Maybe it would be good to have a proper replacement for lgamma_r.  If so, I think the right place for it is gnulib, not Octave itself.

John W. Eaton <jwe>
Group administrator
Wed 03 May 2017 01:15:42 AM UTC, comment #5: 

It could be an sse vs fp87 thing. I think we discovered some time ago that even 64-bit Win binary uses fp87 for some reason.

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Tue 02 May 2017 09:57:43 PM UTC, comment #4: 

Works for me on Linux as well.  But when I run Octave in a Windows XP virtual machine I do get the reported error.

This must be something about the different Fortran environment on Windows.

Rik <rik5>
Group administrator
Tue 02 May 2017 09:38:18 PM UTC, comment #3: 

No error with Octave 4.2.1 on Mac (Homebrew): beta(-4.6, 0.6) gives -8.8814e-16

Nir Krakauer <nir_krakauer>
Tue 02 May 2017 09:35:04 PM UTC, comment #2: 

Correction: beta(-4.6, 0.6) = 0.

Anonymous
Tue 02 May 2017 09:33:50 PM UTC, comment #1: 

Additional information:
beta(-5.6, 0.6) = 0 is ok
beta(-6.6, 0.6) = -0 is ok
The correct answer for beta(-4.5, 0.6) should be 0.

Anonymous
Tue 02 May 2017 09:23:28 PM UTC, original submission:  

beta(-4.5, 0.6) is ok
beta(-4.6, 0.6) throws a FORTRAN error
beta(-4.7, 0.6) is ok

 ***MESSAGE FROM ROUTINE DGAMMA IN LIBRARY SLATEC.
 ***POTENTIALLY RECOVERABLE ERROR, PROG ABORTED, TRACEBACK REQUESTED

  •  ANSWER LT HALF PRECISION BECAUSE X TOO NEAR NEGATIVE INTEGER
  •  ERROR NUMBER = 1

 *
 ***END OF MESSAGE

 ***JOB ABORT DUE TO UNRECOVERED ERROR.

  1.          ERROR MESSAGE SUMMARY

 LIBRARY    SUBROUTINE MESSAGE START             NERR     LEVEL     COUNT
 SLATEC     DGAMMA     ANSWER LT HALF PRECI         1         1         1

error: lgamma: exception encountered in Fortran subroutine dlgams_
error: called from
    beta at line 60 column 10

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 jwe (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by nir_krakauer (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-05-04 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2017-05-03 jwe StatusConfirmed Ready For Test
    2017-05-02 rik5 StatusNone Confirmed
        SummaryBeta function throws FORTRAN errors Beta function throws FORTRAN errors (Windows only)

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code