Title: fast difficulty calculation from bits Post by: mizerydearia on August 20, 2011, 12:28:28 PM Hey genjix (https://bitcointalk.org/index.php?action=profile;u=1931) here, I'm posting as mizerydearia (https://bitcointalk.org/index.php?action=profile;u=338) since I'm not logged in ... blaa blaa
Here;s a fast way to calculate difficulty. It uses a modified taylor series (http://en.wikipedia.org/wiki/Taylor_series) for the logarithm (you can see tutorials on flipcode (http://flipcode.com/) and wikipedia) and relies on logs to transform the difficulty calculation: Code: #include <iostream> Unfortunately I don't have much use for it in libbitcoin (https://gitorious.org/libbitcoin). Maybe some miner will find it useful. To see the math to go from the normal difficulty calculations (which require large big ints bigger than the space in any normal integer) to the calculation above, here's some python: Code: import decimal, math Cya update: Links added by miz Title: Re: fast difficulty calculation from bits Post by: graingert on August 20, 2011, 08:11:00 PM so it's fast, and it uses a
modified taylor series ?Sounds like.... Taylor Swift... Title: Re: fast difficulty calculation from bits Post by: etotheipi on August 21, 2011, 07:42:33 PM Why not just use the conversion that's in the C++ code? So far, it's the only piece of the reference client that I've been able to understand enough to implement:
Code: def difficultyBits_to_float(b): Actually, what I really need is the conversion back to bit-representation. For whatever reason, I never found it, and never bothered to try to figure it out. |