# Incorrect result for comparison (precision issues?)

Consider this session:

```
sage: if log(10) * 248510777753 < log(1024) * 82553493450:
....: print 'Less'
....: else:
....: print 'Not less'
....:
Not less
```

or more simply:

```
sage: bool(log(10)*248510777753 < log(1024)*82553493450)
False
```

But this is wrong, as we can see with higher-precision arithmetic:

```
sage: import mpmath
sage: mpmath.mp.dps = 22 # or anything greater
sage: bool(mpmath.log(10)*248510777753 < mpmath.log(1024)*82553493450)
True
```

I guess this is happening because Sage is computing to some finite precision. But when writing some bigger program, it's scary that a condition involving variables, like say,

```
if m * q < n * p:
```

can without warning give the wrong result and take the wrong path. Is there a way to prevent this from happening, i.e. to make sure that in the program, comparisons are done using as many bits of precision as are necessary to evaluate them correctly, without us having to pre-specify a precision (which may be both too large and wasteful, or too small and give incorrect results)?

Trying "arbitrary precision" doesn't help either:

or:

both return False, versus

which correctly returns True. It's beginning to look like a bug in Sage's

`log`

function?This is extremely odd:

but the correct value is (with

`mpmath.mp.dps = 25`

) positive, not negative:But the odd part is that if I try log(1024)/log(10) * 82553493450 - 248510777753 > 0 http://www.wolframalpha.com/input/?i=log%281024%29%2Flog%2810%29+*+82553493450+-+248510777753+%3E+0 (on Wolfram Alpha) it correctly says True, but shows the approximate form of the difference as exactly the same wrong value: -0.0000610352 !! How are both Sage and Wolfram Alpha getting to the same wrong answer?