Log

From Organic Design wiki
Revision as of 23:29, 21 November 2019 by Nad (talk | contribs) (same example of using logs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Cone.png This article or section is a stub. Stubs are articles that have not yet received substantial attention from the authors. They are short or insufficient pieces of information and require additions to further increase the article's usefulness. The project values stubs as useful first steps toward complete articles.

What the hell are logs even used for anyway? many people ask, well here's something I need to know a lot which uses them, what if you have number like 32 and you want to know what you would raise 2 to the power of to get it? Here's how you would find out in the JS console:

Math.log( 32 ) / Math.log( 2 )
// Result: 5


A real-world example of this might be to find out how many bits of entropy a large base 10 number is for example if we had a twelve word crypto seed, each word from the list of 2048 possible words giving 2048^12 possible sequences, what is that in base two?

Math.log( 2048 ** 12 ) / Math.log( 2 )
// Result: 132


If you wanted to know the opposite, what number raised to the power of 5 yields 32?

Math.exp( Math.log( 32 ) / 5 )
// Result: 2