# What is the function for “round n to the nearest m”?

Where $n \in \mathbb{R}$ and $m \in \mathbb{R}$, what is the function $f(n, m)$ that can achieve rounding behavior of money where the smallest denomination is not an power of ten?

For instance, if a 5¢ coin is the smallest denomination (like in Canada):

• $f(1.02, 0.05) = 1.00$
• $f(1.03, 0.05) = 1.05$
• $f(1.29, 0.05) = 1.30$
• $f(1.30, 0.05) = 1.30$