help-octave
[Top][All Lists]
Advanced

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

How to enter large integers (uint64) without truncation


From: Kire Pudsje
Subject: How to enter large integers (uint64) without truncation
Date: Tue, 29 Nov 2016 19:16:21 +0100

How to enter large uint64 number in matlab?

>>x = uint64(2626262626262626262)
x = 2626262626262626304

In hex the numbers are respectively
24 72 5B F1 AD 44 AF D6
24 72 5B F1 AD 44 B0 00

So the number of significant bits is truncated. Looks like the number first is interpreted as being a double, and then converted to uint64.

As a workaround I enter the number in two parts, which works.
x = uint64(262626262626262)*10000+6262
x = 2626262626262626262

Any better way to enter a large constant?


reply via email to

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