First I seperate integer part and floating part of a floating value with 4 digits (e.g. 5.678) Next I multiply the floating part by 1000 to get an integer and then put this integer into floor function.
x = 5.678
int_part = floor (x) % result is 5
float_part = x - int_part % result is 0.678
float_part = float_part * 1000 % result is 678
floor (float_part) % returns 677 instead of 678
What's going on here? How can I tell Matlab/Octave to return the right value?
Thx in advance