MATLAB: Sprintf(‘%d’,x) prints out exponential notation instead of decimal notation

MATLABsprintf decimal notation conversion

I am using version '8.3.0.532 (R2014a)'. The sprintf command seems to print out exponential notation when decimal notation is requested (second and third example):
sprintf('%d',1.05*100)
sprintf('%d',1.10*100)
sprintf('%.0d',1.10*100)
ans = 105
ans = 1.100000e+02
ans = 1e+02
Is there any reason why the last two calls are not printing '110'?

Best Answer

What you see is a consequence of how floating point arithmetic works.
See:
1.05*100 evaluates to a whole number (flint). The other two don't.
Related Question