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

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

[Octave-bug-tracker] [bug #45945] Missing Matlab's special support for i


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for integer literals
Date: Fri, 15 Apr 2016 15:04:11 +0000
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:46.0) Gecko/20100101 Firefox/46.0

Follow-up Comment #7, bug #45945 (project octave):

The attached patch adds support for uint64 integers to the lexer. It should
handle hexadecimal and binary input correctly without truncating to 32bit max.
It does not change anything on the precission issues with high numbers.

Without patch:

>> format hex
>> uint64 (0xffffffffffffffff)
ans =  0 0 0 0ffffffff


With this patch:

>> format hex
>> uint64 (0xffffffffffffffff)
ans = ffffffffffffffff


However, the following still is the case:

>> uint64 (0xfffffffffffffffe)
ans = ffffffffffffffff


The value is still cast to double.

>> class (0xffffffffffffffff)
ans = double


And that should not change (or probably lots of things could break).
Maybe changing "unsigned long" to "uintmax_t" for the hex parser would have
done the same job (I did not try).
However, now it would be possible to additionally store the integer value in
the octave_value<double> class that could lateron be accessed (exclusively) by
builtin integer functions. Thus, we could achieve the same results as Matlab
without changing anything on the frontend.
The lexer should be prepared for reading and processing (high) integers with
this patch.

How would octal numbers be entered? I did not find a special case for them.

(file #36941)
    _______________________________________________________

Additional Item Attachment:

File name: lexer_uint.patch               Size:6 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?45945>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/




reply via email to

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