Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
How does this poor man's log10 calculator trick work? (reddit.com)
23 points by vdfs on April 11, 2020 | hide | past | favorite | 3 comments


log (x) is approximated by √x iterated n times x^(0.5^n), multiplied by a constant equal to (2^n + [fudge factor for √'s finite precision])

The best answer is a link to https://m.imgur.com/s9eBx5Z which solves the problem in math notation.

There's another comment that describes that in words, and a bunch of reddit chitchat.



The same trick (approximating with a first order Taylor series), is also the basis of quake's famous fast inverse square root [1]. I love these methods because they always involve a "magic constant".

[1] https://en.m.wikipedia.org/wiki/Fast_inverse_square_root




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: