# $\log(0,05)$ is minus, but $\log(0,04999\ldots)$ is plus?

How is this calculated, and why is this?

We're calculating fixed-rate mortgage, with following formular:

$$n = 1-\frac{\log(\frac{L\cdot x}{y})}{\log(1+x)}$$

Where: $L$ is the loan size, $x$ is the interest, $y$ is the amount to pay back per month, and $n$ is the number of months it takes to pay back the loan.

• Well, it is @Rasmus : $\;\log x <0\;,\;\forall\,0<x<1\;\ldots$ Jun 18, 2013 at 9:49
• @Spang, I don't understand. How did you arrive at the conclusion that $\log(0.04999\ldots)$ is positive? Jun 18, 2013 at 10:04
• Uh. I don't remember. Excel was messing some things up, i believe. Jun 18, 2013 at 10:55
• Hmm, but there is no case if you couldn't replicate the alleged weird outcome. Jun 18, 2013 at 11:31
• Main problem is, with 0,049 - Excel gives a fine result. But 0,05 it gives #NUM. Jun 18, 2013 at 12:21

## 1 Answer

Of the many ways $\log$ can be defined, one is $\log x = \int_1^x\!\frac{1}{t}\,dt$ (I'm assuming you mean natural log, but if not, everything can be easily adapted, since $\log_n x = \log x/\log n$). Letting $x > 1$ and interpreting $\int_1^x\!\frac{1}{t}\,dt$ as the area under the graph of $1/x$ from $1$ to $x$, we see that since $1/x$ is positive for $x > 0$, the integral will also be positive for $x > 1$. However, if $x\in(0,1)$, we use the properties of the integral to see that $$\int_1^x\!\frac{1}{t}\,dt = -\int_x^1\!\frac{1}{t}\,dt.$$ The integral $\int_x^1\!\frac{1}{t}\,dt$ is greater than $0$, because again we can interpret it as the area under $1/x$ from $x$ to $1$. This implies that $\log x < 0$ whenever $x\in(0,1)$. So, $\log(.05)$ and $\log(.049999\dots)$ are less than $0$.

I also feel the need to remark that $.05$ and $.04999\dots$ are the same number, so you shouldn't be getting a positive answer for one's log and a negative answer for the other's log, you should be getting the same answer. (You probably computed $\log(.49999\ldots9)$ for finitely many $9$'s, but as I explained above, this should also be negative.) The reason that these two numbers are the same is exactly the same as the reason $.99999\ldots = 1$, and we already have plenty of threads on that, so you can check one of those out if you are in doubt of this fact.

As for how $\log$ is calculated, it's usually tough to compute $\log x$ by hand for some random $x$, but you can approximate it by integral approximation methods, or expand $\log$ in a Taylor series near $x$, and use only finitely many terms of the series to get an approximation (this is likely what your calculator does).

• "I also feel the need to remark that .05 and .04999… are the same number" (+1) Jun 18, 2013 at 8:48