bugGNU Octave - Bugs: bug #48591, function double on java objects.

 
 

bug #48591: function double on java objects.

Submitted by:  Ernst Reissner <ernstreissner>
Submitted on:  Fri 22 Jul 2016 12:06:57 AM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: ConfirmedAssigned 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.

 

Fri 19 Aug 2016 05:00:33 PM UTC, comment #5:

The patch below allows double(o) and int64(o)
for java objects o.
For the other types:
uint64 not supported because long does not support this fully.
All others may be created by casting.

(file #38284)

Ernst Reissner <ernstreissner>
Thu 11 Aug 2016 11:12:03 PM UTC, comment #4:

I must admit, i did not find out how exactly to register.
I understood that some type conversion operation
shall be registered.
If you tell me the signature and how to register,
I can fill in the implementation.

-- or did I misunderstand something??

Ernst Reissner <ernstreissner>
Thu 11 Aug 2016 03:55:14 PM UTC, comment #3:

No, the right approach would be to register the appropriate type conversion in the octave_java class. All octave_value types already have a robust type conversion system, it just needs to be implemented in each derived type as needed.

Mike Miller <mtmiller>
Project Administrator
Thu 11 Aug 2016 02:38:44 PM UTC, comment #2:

Hello Mike,
I would like to provide a patch for this.

I would write an m-file double.m
delegating to the builtin function double
except for java types.

For those I would check for java.lang.Number
and then apply Number.doubleValue().

Is this acceptable??

Ernst Reissner <ernstreissner>
Wed 10 Aug 2016 12:14:50 AM UTC, comment #1:

To make things more precise:
for java objects obj implementing java.lang.Number,
double(m) shall deliver some double.

for null values, one shall deliver []

What is not referred to is if it is no Number
but implements a method public double toDouble().
Currently, no effect but in future shall invoke this method.

This is worth another bug report.

Also this bugfix I shall defer until java sources are reformatted.

Ernst Reissner <ernstreissner>
Fri 22 Jul 2016 12:06:57 AM UTC, original submission:

shows that in Matlab function double may be applied to java objects.

For Octave:
this should not be.
In fact, double(bd) should invoke bd.doubleValue()
as it is an instance of java.lang.Number.

Ernst Reissner <ernstreissner>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #38284:  patchBug48591.patch added by ernstreissner (7KiB - text/x-patch)

 

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 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
    Fri 19 Aug 2016 05:00:33 PM UTCernstreissnerAttached File-=>Added patchBug48591.patch, #38284
    Fri 22 Jul 2016 04:17:14 PM UTCmtmillerCategoryOctave Function=>Interpreter
      Item GroupNone=>Matlab Compatibility
      StatusNone=>Confirmed
      Release4.0.3=>dev
    Fri 22 Jul 2016 12:06:57 AM UTCernstreissnerCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1