Some people will incorrectly tell you that this is not possible, but in reality there is a simple and efficient solution:
>> N = 130404809.288;
>> mod(round(10000*N),10)
ans = 0
>> N = 130404809.2882;
>> mod(round(10000*N),10)
ans = 2
>> N = 136147309.434;
>> mod(round(10000*N),10)
ans = 0
This relies on your statement that the values have "with either three or four digits to the right of the decimal point", i.e. that the fifth digit is zero (the sixth and any further digits, including any floating point error, are totally irrelevant). This means that after multiplying by 10000 (NOT by 1000 as you tried) a simple round will remove all floating point error from the number:
xyz.abcd0err
xyzabcd.0err
xyzabcd
d
You were almost there, just off by a factor of ten.
Best Answer