'1032400774240044774' has nineteen digits, which is greater thanflintmax: there is no way that this value can be represented using adoubleand maintain precision down to the ones. This is simply impossible using standard floating point numbers:
If you want to get the full precision then you will need to store it as aninteger type, e.g. by converting to uint64 usingsscanf:
>> n = sscanf('1032400774240044774','%lu')
n =
1032400774240044774
>> sprintf('%u',n)
ans =
1032400774240044774
Note that you cannot use%f for thesprint format because then it will be internally converted to floating point.
Integer types also have a maximum limit:
>> intmax('uint64')
ans =
18446744073709551615
If you want to store larger numbers than that, then you could use the symbolic toolbox, or store them as strings, or use one of the large integer classes available on FEX, e.g.:
Best Answer