I created a random double precision value in Matlab by
x = rand(1,1);
then display all possible digits of x by
vpa(x,100)
and obtain:
0.2238119394911369 7971853298440692014992237091064453125
I save x to a .mat file, and import it into Mathematica, and then convert it:
y = N[FromDigits[RealDigits[x]],100]
and obtain:
0.2238119394911369 0000
Then go back to Matlab and use (copy and paste all the Mathematica digits to Matlab):
vpa(0.22381193949113690000,100)
and obtain:
0.22381193949113689 64518061375201796181499958038330078125
Why there is significant difference between the same double precision variable?
How to bridge the gap when exchanging data between Mathematica and Matlab?
x
is a simple double precision number. The reason whyvpa(x,100)
gives you that many digits is that floating point numbers are stored in binary format, not decimal. This means that even though ... – Nonet