octave-maintainers
[Top][All Lists]
Advanced

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

Re: uint64 documentation


From: Jaroslav Hajek
Subject: Re: uint64 documentation
Date: Sun, 19 Dec 2010 16:24:02 +0100

On Fri, Dec 17, 2010 at 7:13 AM, John W. Eaton <address@hidden> wrote:
> On 16-Dec-2010, Rik wrote:
>
> | Jaroslav,
> |
> | I'm updating the documentation for the 3.4 release.  This section from
> | 4.4.1 on Integer Arithmetic seems to be out-of-date and does not reflect
> | the addition of the int64 and uint64 types.  Is that right?
> |
> | "The arithmetic operations on integers are performed by casting the integer
> | values to double precision values, performing the operation, and then
> | re-casting the values back to the original integer type. As the double
> | precision type of Octave is only capable of representing integers with up
> | to 53 bits of precision, it is not possible to perform arithmetic
> | with 64 bit integer types."
>
> Yes, this is not correct for the current sources.
>
> In the original implementation of arithmetic for integers, we used
> doubles and cast the result back to the int type, along with forcing
> the result to be within the range of the original type.  That was an
> easy way to provide the saturation semantics necessary for
> compatibility with Matlab.
>
> Later, Jaroslav implemented integer arithmetic that did not rely on
> conversion to and from double.  He also implemented arithmetic
> operations for 64-bit integers.
>

Note that conversion to double is still used for some operations, e.g.
mixed integer-double. If the target platform supports long double (128
or 80 bits), that is used for 64-bit integer multiplication, because
it's normally faster than doing the operation in C++. Matlab is still
faster though with most operations; I suppose they use SSE from
assembler.



reply via email to

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