Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
What properties do you want this remainder to have? Do you want it to be an integer? Because it seems to me like you're looking at standard integer division. – Patrick Da Silva Jun 14 '13 at 12:32
Do you mean something like – Amzoti Jun 14 '13 at 12:33
x and y are both integers. The output of f(x,y) is also an integer. Yes I need something like a floor function but I want it from first principles if possible – Manatok Jun 14 '13 at 12:37
up vote 1 down vote accepted

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?"

share|cite|improve this answer
I want to define floor from first principles if possible. So knowing what x and y are, using basic arithmetic determine what the remainder is. – Manatok Jun 14 '13 at 13:12

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

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.