bugGNU Octave - Bugs: bug #46015, Octave has rounding error that...

 
 

bug #46015: Octave has rounding error that Matlab does not

Submitted by:  None
Submitted on:  Mon 21 Sep 2015 09:29:54 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: InvalidAssigned to: None
Originator Name: Bradlee SpeiceOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.8.1
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 24 Sep 2015 02:37:21 PM UTC, comment #4:

That makes sense. I didn't change how Matlab was displaying anything, so that's where the confusion came from. I'll keep the format in mind for the future, thank you for your help on this.

Anonymous
Tue 22 Sep 2015 12:03:54 PM UTC, comment #3:

Matlab says:

>> 100 * .998 * 1.009 * .998


ans =

100.4968

>> format long
>> ans


ans =

1.004968036000000e+02

So, no problem.

Michael Godfrey <godfrey>
Project Member
Tue 22 Sep 2015 12:50:50 AM UTC, comment #2:

Yeah I'm going to agree with oheim, it's a default output format issue, not a problem with any calcuation. The actual stored value is correct, just not shown to the precision you expect by default, but should be matching Matlab.

Mike Miller <mtmiller>
Project Administrator
Mon 21 Sep 2015 09:33:24 PM UTC, comment #1:

Maybe this is just an output format issue. I can see the following in Octave:

Did you use format short in Matlab?

Oliver Heimlich <oheim>
Mon 21 Sep 2015 09:29:54 PM UTC, original submission:

So I have a pretty straightforward issue. The following equation produces different results between Octave and Matlab:

100 * .998 * 1.009 * .998

Octave produces a result of 100.50
Matlab produces a (correct) result of 100.4968.

I'm guessing the rounding error appears in between multiplications, but it seems strange that Octave would have this issue, no other calculator I tried had the same problem.

Do I need to set the session precision higher or similar? I find that this behavior as a default is an issue.

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 godfrey (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by oheim (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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 22 Sep 2015 12:50:50 AM UTCmtmillerStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1