bugGNU Octave - Bugs: bug #52004, assert with tolerance

 
 

bug #52004: assert with tolerance

Submitted by:  Ernst Reissner <ernstreissner>
Submitted on:  Tue 12 Sep 2017 11:35:30 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 3 - LowItem Group: Incorrect Result
Status: InvalidAssigned to: None
Originator Name: ernstreissnerOpen/Closed: Closed
Release: devOperating System: Any

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)

Wed 13 Sep 2017 08:26:55 PM UTC, comment #6:

I think, the patch provided is really a good thing. Thank you.

Ernst Reissner <ernstreissner>
Wed 13 Sep 2017 04:30:55 PM UTC, comment #5:

I moved the patch here:

https://savannah.gnu.org/patch/index.php?9453

so this report can remain "invalid" and closed.

Dan Sebald <sebald>
Wed 13 Sep 2017 12:38:15 PM UTC, comment #4:

Agree, this item is about floating-point arithmetic.

Regarding comment #1 and comment #2. Do we have a patch or bug report for this? Otherwise we can hijack this item or create a new one "assert() should report tolerance exceedance".

Kai Torben Ohlhus <siko1056>
Project Member
Wed 13 Sep 2017 11:04:13 AM UTC, comment #3:

This is not an incorrect result. It is a
reminder of how numbers are represented in digital
computers, and how they may be displayed.

Michael Godfrey <godfrey>
Project Member
Wed 13 Sep 2017 12:57:31 AM UTC, comment #2:

I suppose I should have given an example output:

Dan Sebald <sebald>
Wed 13 Sep 2017 12:56:09 AM UTC, comment #1:

Whenever it is one of these 1.23 != 1.23 types of error messages it is typically a floating point precision difference between numbers. In fact, this assert sort of illustrates how floating point arithmetic is not the same as real number arithmetic.

Even using long number format, the floating point granularity isn't acknowledged.

The width of the answer is on the order of 10^-15, but the difference is still smaller on the order of 10^-16, just out of range.

I'm attaching a patch for Rik's consideration since he and I worked on the assert routine some time back. It just adds the amount by which the tolerance is exceeded, using only a single digit precision otherwise the message wraps the line. It isn't important what all the numbers are beyond the first and the exponent.

(file #41790)

Dan Sebald <sebald>
Tue 12 Sep 2017 11:35:30 PM UTC, original submission:

assert(3, 3.1,0.1) yields

although 0.1 does not exceed 0.1.
In my opinion, an error shall be raised only if deviation exceeds tolerance. not if deviation equals tolerance.

Note that this form of assertion is typical for octave
and has no counterpart in matlab.

Ernst Reissner <ernstreissner>

 

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

Attach File(s):
   
   
Comment:
   

 

Digest:
   patch dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by siko1056 (Posted a comment)
  • -unavailable- added by godfrey (Posted a comment)
  • -unavailable- added by sebald (Updated the item)
  • -unavailable- added by ernstreissner (Submitted the item)
  • -unavailable- added by ernstreissner
  •  

    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
    Wed 13 Sep 2017 06:37:48 PM UTCmtmillerOpen/ClosedOpen=>Closed
      Dependencies-=>Depends on patch #9453
    Wed 13 Sep 2017 12:38:15 PM UTCsiko1056Priority5 - Normal=>3 - Low
      StatusNone=>Invalid
    Wed 13 Sep 2017 12:56:09 AM UTCsebaldAttached File-=>Added octave-assert_print_tolerance_overrun-djs2017sep12.patch, #41790
    Tue 12 Sep 2017 11:35:30 PM UTCernstreissnerCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1