MATLAB is great because I generally have portable code. This is not always the case. Today, I found that for values greater than 31-bits, things went odd. 2000000000 was 2000000000 as a string, but 3000000000 was 3.00e9, which played havoc on some post-operation parsing. This behavior was computer dependent!
The issue was this line:
r=sprintf('%i',num);
The integer changes form over 2^31 bits in length. The fix was:
r=num2str(num);
No comments:
Post a Comment