bugGNU Octave - Bugs: bug #51580, isa: compatibility with isfloat,...

 
 

bug #51580: isa: compatibility with isfloat, isinteger and isnumeric

Submitted by:  Ernst Reissner <ernstreissner>
Submitted on:  Wed 26 Jul 2017 09:08:05 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: NoneAssigned to: None
Originator Name: Open/Closed: Open
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.

 

Thu 27 Jul 2017 08:01:59 AM UTC, comment #2:

Well, if you have a look at help isa,

then it turns out that for isa(x,"float"),
float is not really a class,
it is interpreted as 'floating point value'
comprising classes double and single.

So further classes may represent floats.

For classes double and single, the function isfloat(x)
returns true indicating that these are floats.
If I write my own class, then I would also define isfloat(x)
returning true.

Then isa(x,"float") can determine whether it is a float
just asking isfloat(x).

Ernst Reissner <ernstreissner>
Thu 27 Jul 2017 07:48:38 AM UTC, comment #1:

I think that could be problematic in some cases. If isa (x, "float") returns true I expect that x actually is a standard Octave float. How would you in such a situation check if x is a standard float or a float of some other class?

Joel Dahne <urathai>
Wed 26 Jul 2017 09:08:05 AM UTC, original submission:

I write an arithmetic with oo-means,
so overwriting isfloat, isinteger and isnumeric
for my own arithmetic classes.

In addition, i have to overwrite isa
for second argument 'float', 'integer' and 'numeric'.

I suggest to modify builtin function isa
so that for these second arguments
methods isfloat, isinteger and isnumeric are invoked.

This improves consistency and spares me overwriting function isa.

Ernst Reissner <ernstreissner>

 

(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 urathai (Posted a comment)
  • -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):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 26 Jul 2017 09:08:05 AM UTCernstreissnerCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1