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

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

[Octave-patch-tracker] [patch #9062] java conversion of numeric types


From: Ernst Reissner
Subject: [Octave-patch-tracker] [patch #9062] java conversion of numeric types
Date: Thu, 28 Jul 2016 20:42:10 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0

URL:
  <http://savannah.gnu.org/patch/?9062>

                 Summary: java conversion of numeric types
                 Project: GNU Octave
            Submitted by: ernstreissner
            Submitted on: Thu 28 Jul 2016 08:42:08 PM GMT
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Matlab converts both unsigned and signed integer types 
into according java-types. 
As java integer types are always signed, 
if the leading bit is set, conversion changes sign 
which is most likely a failure. 
Thus is is reasonable, to have some check. 

I suggest a flag java_strict_num_conversion 
like java_unsigned_autoconversion 
to decide whether Matlab conversion is applied 
or strict conversion. 

If conversely java-types are converted into octave types, 
Matlab distinguishes: 
whereas arrays as int[] are converted into int32[], 
atomic type int is converted into double scalar 'for convenience' 
(for arrays strict conversion saves memory). 

Still Matlab behavior is not in all cases reasonable: 
long has 1 sign bit and 63 mantissa bits, 
whereas double scalar has 1 sign bit 53 mantissa bits 
and 10 exponent bits thus loosing 10 digits precision 
only by sloppy java to matlab conversion. 

I would like to use the flag java_strict_num_conversion 
also to make strict conversion: 
double to double scalar, float to float scalar, 
long to int64, int to int32, short to int16 and byte to int8. 

In contrast I would like to drop java_unsigned_autoconversion 
as it seems useless to me. What about deprecation? 




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?9062>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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