Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Some motivation:

I have a (simplified) function $f(x) = \frac{k}x$, where $k$ is some real constant and $x$ is a real number. The result of the function, however, is always truncated to an integer for application purposes. Since I also use the inverse of this function and the inverse is a floating-point result, I want to know the maximum error caused by the conversion. This means I am looking for the largest value of ($x_2$-$x_1$) that will satisfy $f(x_1) - f(x_2) < 1$.

So the starting equation is this:


which I can rewrite as

$$k\cdot\left(\frac{x_2-x_1}{x_1\cdot x_2}\right)<1$$

and now I (sort of conveniently) have

$$(x_2-x_1)<\frac{x_1\cdot x_2}k$$

My problem: I don't know what $x_1$ and $x_2$ are, nor do I care. I just know they are fairly close to each other, e.g., $x_2 - x_1 \ll 1$

Can someone point me in the right direction to my desired solution? Or perhaps my approach is totally wrong?

share|improve this question
Note that $k\cdot\frac{x_2-x_1}{x_1\cdot x_2}<1$ implies $x_2-x_1<\frac{x_1\cdot x_2}{k}$ only if $\frac{k}{x_1\cdot x_2}> 0$. –  Dennis Gulko May 5 '11 at 14:26
About your question: by denoting $x_2-x_1=a$, you get $x_2=a+x_1$ and then you have $a<\frac{x_1(a+x_1)}{k}$, which leads to the quadratic $x_1^2+ax_1-ka>0$. Finding the roots you get that this inequality holds iff $x_1>\frac{-a+\sqrt{a^2+4ka}}{2}$ or $x_1<\frac{-a-\sqrt{a^2+4ka}}{2}$, where $a$ is the only value you care about. –  Dennis Gulko May 5 '11 at 14:30

Your Answer


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

Browse other questions tagged or ask your own question.