bugGNU Octave - Bugs: bug #40470, display routine for variables...

 
 

bug #40470: display routine for variables doesn't detect need for scientific format

Submitted by:  None
Submitted on:  Mon 04 Nov 2013 03:04:56 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
Status: FixedAssigned to: None
Originator Name: Alan GenzOriginator Email: -unavailable-
Open/Closed: ClosedRelease: dev
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Thu 07 Nov 2013 06:44:27 PM UTC, comment #7:

Verified the fix. Closing report.

Rik <rik5>
Project Administrator
Thu 07 Nov 2013 06:45:39 AM UTC, comment #6:

I checked in the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/5ac0545fb4c0

John W. Eaton <jwe>
Project Administrator
Thu 07 Nov 2013 03:15:30 AM UTC, comment #5:

So the problem seems to be a regression in the print routine, rather than a problem with normcdf. I'm re-titling the bug to reflect that. Simple test code to replicate this is:

Running the same code under 3.6.4 produces:

Rik <rik5>
Project Administrator
Thu 07 Nov 2013 01:50:35 AM UTC, comment #4:

I don't think there's an underflow problem, I think it's simply that values are being displayed with a fixed format when combined in a matrix with other values.

Mike Miller <mtmiller>
Project Administrator
Thu 07 Nov 2013 01:47:09 AM UTC, comment #3:

Here's some more results, what I get with

3.6.4:

dev:

Mike Miller <mtmiller>
Project Administrator
Wed 06 Nov 2013 08:59:01 AM UTC, comment #2:

I cannot reproduce the problem with 3.6.2, nor with http://octave-online.net/ (which is 3.7.2+).

Marco

Marco Caliari <caliari>
Project Member
Mon 04 Nov 2013 08:13:52 PM UTC, comment #1:

Still present on the development branch. Probably can't squeeze this in before the 3.8 release, but possibly in the first bug fix release.

Rik <rik5>
Project Administrator
Mon 04 Nov 2013 03:04:56 PM UTC, original submission:

octave:21> for t=-[7:10],disp([t exp(-t^2/2) normcdf(t)]),end
-7.0000e+00 2.2897e-11 1.2798e-12
-8.0000e+00 1.2664e-14 6.1062e-16
-9.00000 0.00000 0.00000
-10.00000 0.00000 0.00000
octave:22> for t=-[7:10],disp([t exp(-t^2/2)]),end
-7.0000e+00 2.2897e-11
-8.0000e+00 1.2664e-14
-9.0000e+00 2.5768e-18
-1.0000e+01 1.9287e-22
octave:23> for t=-[7:10],disp([t normcdf(t)]),end
-7.0000e+00 1.2798e-12
-8.0000e+00 6.1062e-16
-9 0
-10 0

The above results are inconsistent; normcdf should not
underflow to 0 until t is near -37.
But why is exp also affected?
This bug has been reported previously (see #29543).
The simple fix is to use normcdf(t) = erfc-t/sqrt(2))/2:
octave:27> for t=-[7:10],disp([t exp(-t^2/2) ...
erfc(-t/sqrt(2))/2]),end
-7.0000e+00 2.2897e-11 1.2798e-12
-8.0000e+00 1.2664e-14 6.2210e-16
-9.0000e+00 2.5768e-18 1.1286e-19
-1.0000e+01 1.9287e-22 7.6199e-24

Here are some Matlab results for comparison

>> for t=-[7:10],disp([t exp(-t^2/2) ...

normcdf(t)]),end
-7 2.2897e-11 1.2798e-12
-8 1.2664e-14 6.221e-16
-9 2.5768e-18 1.1286e-19
-10 1.9287e-22 7.6199e-24

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by caliari (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 07 Nov 2013 06:44:27 PM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Thu 07 Nov 2013 03:15:30 AM UTCrik5SummaryWrong output from normcdf (with exp?) for negatives =>display routine for variables doesn't detect need for scientific format
    Thu 07 Nov 2013 01:47:09 AM UTCmtmillerItem GroupInaccurate Result=>Regression
      Release3.2.4=>dev
    Mon 04 Nov 2013 08:13:52 PM UTCrik5StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1