Update
This commit is contained in:
parent
16b8c6accd
commit
85321afd67
35 changed files with 1971 additions and 1919 deletions
6
log.md
6
log.md
|
@ -183,10 +183,10 @@ double logFloatN(double base, double x)
|
|||
}
|
||||
```
|
||||
|
||||
If your inventory includes the *[pow](pow.md)* function, you can probably use it to implement floating point logarithm also through [binary search](binary_search.md) with delta.
|
||||
|
||||
As for [approximations](approximation.md): unfortunately good ones are often plagued by narrow interval of convergence. Attempts at construction of a function resembling logarithm may perhaps start with a similarly shaped function *1 - 1/x*, then continue by pimping it up and adding correcting expressions until it looks cool. This may lead for example to the following expression: { Made by me. ~drummyfish }
|
||||
|
||||
*log10(x) ~= 3.0478 + 0.00001 * x - 205.9 / (x + 100) - (1233 * x + 10) / (625 * (x + 1) * x)*
|
||||
|
||||
The advantage here is that it looks reasonable on a wide interval from 0 up to many thousands: before *x* gets to higher hundreds the error is somewhere around 3%, then around 2000 gets to some 10% and around 10000 to approx 20% where it then seems to stay for a very long time.
|
||||
It's not very precise but the advantage is that it looks reasonable on a wide interval from 0 up to many thousands: before *x* gets to higher hundreds the error is somewhere around 3%, then around 2000 gets to some 10% and around 10000 to approx 20% where it then seems to stay for a very long time.
|
||||
|
||||
If you have the *[pow](pow.md)* (or even just *exp*) function at hand (which can itself be approximated), you can probably use it to implement floating point logarithm also through [binary search](binary_search.md) with delta, Newton's method or something similar.
|
Loading…
Add table
Add a link
Reference in a new issue