I’m trying to figure out what’s going with this floating point operations (in MatLab).
Here round is the rounding MatLab function.
If I do
round(105.1+4.1+0.3) I obtain 109, because essentially
105.1+4.1+0.3 is not equal to
109.5 in machine precision.
But, if I use single precision arithmetic by doing
round(single(105.1) + single(4.1)+single(0.3)) I obtain
Why using single precision I have the right rounding, while in the other case not?
Go to Source