Mod is behaving funny [duplicate]

I have a silly question.

k = 0.15;
kf = 0.03;
Mod[k, kf]


is giving me 0 as it should but when I change kf to 0.05 like

k = 0.15;
kf = 0.05;
Mod[k, kf]


it is giving me 0.05 when it should also be zero.

In short: while does Mathematica think that Mod[0.15, 0.05] = 0.05?

• Machine numbers in a computer are not the same as decimal numbers for pen and paper. Here you need exact numbers, so use k=15/100, kf=3/100, 5/100. The answer to your question is: numerical noise. – Fred Simons Oct 19 '16 at 11:53
• Also related. – corey979 Oct 19 '16 at 11:58
• Thank you Fred, that helps though it is still unclear why it does it correctly in one case and incorrectly in another – Sayak Oct 19 '16 at 15:25