NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
▲A faster algorithm for extracting hexadecimal digits of π (stylewarning.com)
nickcw 2 hours ago [-]
The main boxed formula is equivalent to this Machin style formula for pi

pi = 4 arctan 4/7 + 4 arctan 1/8 + 2 arctan 8/31 + 2 arctan 1/32

Because each of the denominators in the arctans is a power or 2 or 1 different from a power of 2, we can make a BBP formula from it to calculate any hex digit of pi without calculating the previous ones.

I wrote a reasonably accessible account of how this works in https://scholarlycommons.pacific.edu/euleriana/vol3/iss1/3/ (which is referenced in the article!)

The boxed formula is exciting because it has been rearranged so that it has a single common denominator, so only needs 1 division per term.

It is the divisions which are slow so reducing the number of them speeds up the calculation. That plus another trick makes the calculation run 40% faster than the best known BBP formula.

> There’s a choice hiding in the last step of Bellard’s terse derivation.

That made me laugh. It took me several days to figure out Bellard's terse derivation :-)

seblon 3 hours ago [-]
Maybe πFS has now a future? ;-)

https://news.ycombinator.com/item?id=48480978

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 12:21:59 GMT+0000 (Coordinated Universal Time) with Vercel.