patchGNU Octave - Patches: patch #9062, java conversion of numeric types


patch #9062: java conversion of numeric types

Submitted by:  Ernst Reissner <ernstreissner>
Submitted on:  Thu 28 Jul 2016 08:42:08 PM UTC  
Category:  None Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Thu 28 Jul 2016 08:42:08 PM UTC, original submission:

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?

Ernst Reissner <ernstreissner>


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

Attach Files:

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 ernstreissner (Submitted the item)
  • -email is unavailable- added by ernstreissner

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follows 1 latest change.

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

    Back to the top

    Powered by Savane 3.4