-
-
Notifications
You must be signed in to change notification settings - Fork 22
Computing e
Oscar Veliz edited this page Jul 4, 2023
·
1 revision
The video covering the e-spigot algorithm can be found at https://youtu.be/M_fTdDx8IlY although it mostly focuses on exp(x)
and the math the computer uses to compute the exponential. Example code is given in e-spigot.py, written in Python and can be run locally using the command python e-spigot.py
.
To change the number of digits alter the n
variable at the beginning. Note: For safety, the authors recommend adding 6 to that number.
Reference links:
- math.h https://github.com/openbsd/src/blob/master/include/math.h
-
exp(x)
source code https://netlib.org/fdlibm/e_exp.c -
pow(x,y)
source code https://netlib.org/fdlibm/e_pow.c - "Algorithms for Digital Computers" by Hastings et. al. https://press.princeton.edu/books/paperback/9780691626949/approximations-for-digital-computers
- "The Mathematical-Function Computation Handbook" by Beebe https://link.springer.com/book/10.1007/978-3-319-64110-2
- "A Spigot Algorithm for the Digits of π" by Rabinowitz & Wagon https://www.tandfonline.com/doi/abs/10.1080/00029890.1995.11990560?journalCode=uamm20