removing the remainder of a fraction

1k Views Asked by At

I would like to remove the remainder from a fraction if possible. I want a function

$$f(x,y) = x/y - remainder$$

for example

$$f(3,2) = 1$$ $$f(7,2) = 3$$ $$f(12,5) = 2$$

It seems so simple but its been bugging me for a while. Please help.

2

There are 2 best solutions below

1
On BEST ANSWER

You are looking for division with remainder We have $y=\lfloor \frac yx \rfloor x+r$, where $f(x,y)=\lfloor \frac yx \rfloor, r=y-\lfloor \frac yx \rfloor x$. What do you mean by "from first principles?"

0
On

Floor function will do what you want . Floor function of the value obtained by normal divison .