An unofficial, read-only Hacker News reader. Join the beta →

A faster algorithm for extracting hexadecimal digits of π (opens external site)

81 points by vinhnx 3 days ago | www.stylewarning.com | 5 comments on HN

View full thread · View on Hacker News

Comment thread (2)

  1. The formula for calculating the % improvements is wrong.

    The correct formula is 100% - t_after / t_before.

    The formula in the article seems to be t_before / t_after - 100%. This is incorrect.

    For example if t_after is very small (meaning a very efficient calculation with a lot of improvement) this formula would indicate more than 100% improvement (and this is clearly incorrect)

    Replies (1)
    1. If something is 100% faster, it's 2x as fast, or 50% less in run time. Patterson and Hennessy in Computer Architecture define "X is n% faster than Y" as the value of n satisfying

          Time_X/Time_Y = 1 + n/100,
      
      which is exactly your latter formula.