rounding error - Matlab: finding position of last nonzero digit of a number -
i have column vector pp
filled numbers, instance:
23.234000 3.1237340 4.4359000
i want find number of places right of decimal smallest nonzero digit in vector occupies, in case 6
, because of 4
in 3.123734
. want multiply every number in vector 10^6, rid of decimals in vector. want eliminate rounding errors. what's best way done?
the actual value may different being displayed matlab. instance, consider following example:
>> x = 1.4 - [0.1; 0.09999999] x = 1.3000 1.3000
matlab shows both values 1.3, in fact, none of them is:
>> x - 1.3 ans = -2.2204e-16 1.0000e-08
my suggestion therefore decide on fixed accuracy (say, 6 digits), , multiply corresponding power of 10.
Comments
Post a Comment