octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63293] assert skips some type comparisons if


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #63293] assert skips some type comparisons if a tolerance is specified
Date: Sun, 30 Oct 2022 21:06:36 -0400 (EDT)

Follow-up Comment #5, bug #63293 (project octave):

looking at the calling forms for Matlab's and Octave's assert, I think Octave
currently is a superset of what Matlab's does.


 -- assert (COND)
 -- assert (COND, ERRMSG)
 -- assert (COND, ERRMSG, ...)
 -- assert (COND, MSG_ID, ERRMSG, ...)
 -- assert (OBSERVED, EXPECTED)
 -- assert (OBSERVED, EXPECTED, TOL)


the matlab version uses the first four calling forms.  the last two are what
we regularly use in BISTs, and are NOT supported by matlab's assert. 

the matlab & 1st set of octave forms just check for COND to return true.  so 


>> assert(true)

>> assert(false)
error: assert (false) failed
error: called from
    assert at line 107 column 11


OT: how ours differentiates the different forms is a bit odd.  

>> a = 2;  assert(a,"a string?")
error: ASSERT errors for:  assert (a,"a string?")

  Location  |  Observed  |  Expected  |  Reason
     .            2        a string?     Expected string, but observed number

>> a = true;  assert(a,"a string?")

>> a = false;  assert(a,"a string?")
error: a string?
error: called from
    assert at line 109 column 11



All that said, as Markus said this bug report is really just limited to the
Octave unique calling form. So no need to worry about mathworks. 

I realize the issue can be avoided by specifically doing an
assert(issparse(a),issparse(b)) test rather than relying on setting off
assert(a,b) if their sparseness is different. I thought it odd that we ran
those tests, though, only if no tolerance was specified. 

I didn't know if the issue had to do with the complexity of performing the
subtraction and eps comparison for the different types.  (perhaps related to
the need to do implicit expansion with eps and bug #63281)


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63293>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]