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

 
 

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

Submitter:  Ernst Reissner <ernstreissner>
Submitted:  Wed 26 Jul 2017 09:08:05 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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 Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by urathai (Posted a comment)
  • -email is unavailable- added by ernstreissner (Submitted the item)
  • -email is unavailable- added by ernstreissner
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-07-26 ernstreissner Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code