bugGNU Octave - Bugs: bug #50278, Incorrect comparison due to...

 
 

bug #50278: Incorrect comparison due to numerical precision

Submitted by:  None
Submitted on:  Fri 10 Feb 2017 11:17:09 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: InvalidAssigned to: None
Originator Name: Originator Email: -unavailable-
Open/Closed: ClosedRelease: 4.2.0
Operating System: Microsoft Windows

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Tue 14 Feb 2017 01:33:03 PM UTC, comment #2:

This is not a bug, simply 3*0.1 is different from 0.3 in double precision.

Marco Caliari <caliari>
Project Member
Sat 11 Feb 2017 09:55:26 AM UTC, comment #1:

Is this an actual error, or simply the nature of floating point arithmetic? There may be a symbolic operation to address this, and I sort of recall some type of "nearly equal" comparison that takes into account distance between floating point numbers, but I can't recall the name if it does exist. It would be a comparison something like the following:

Dan Sebald <sebald>
Fri 10 Feb 2017 11:17:09 PM UTC, original submission:

The simple script below results in an error. When k=4, t(4) = 0.3 but is not <= 0.3 due to numerical precision.

Gives result:

Octave 4.2.0 is configured for "x86_64-w64-minw32" running on Windows 10 Home, Intel Core 17-7500U

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 mtmiller (Updated the item)
  • -unavailable- added by caliari (Posted a comment)
  • -unavailable- added by sebald (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 14 Feb 2017 06:47:49 PM UTCmtmillerOpen/ClosedOpen=>Closed
    Tue 14 Feb 2017 01:33:03 PM UTCcaliariStatusNone=>Invalid

    Back to the top


    Powered by Savane 3.1-cleanup1