Full Version : Approximating Euler's Constant e=2.718281828
avr >>COMPUTER MATH >>Approximating Euler's Constant e=2.718281828


RetroDan- 09-15-2006
Here are some Approximations for 'e' (Euler's Number) that I have worked-out to avoid the need for very slow floating-point math:


EULER'S CONSTANT (e) = 2.718281828
==================================


A) Multiply by 193, Divide by 71 = 2.718309859

- Error is 0.00002803 (0.0001%)
- Both Numerator and Denominator are Single-Byte values
- Can be fast and simple in ASM Language
- Both Multiplication and Division are simple 8-Bit Calculations


B) Multiply by 87, Divide by 32 = 2.71875

- Error 0.000468 (0.017%)
- Less accurate however denominator is a 'Power-of-Two'
- Faster -> Divison can be accomplished with Five Right-Shifts


C) Multiply by 43, Divide by 16 = 2.6875

- Error 0.0308 (1.132%)
- Faster: Division by Four Right-Shifts


D) Multiply by 11, Divide by 4 = 2.75

- Error 0.0317 (1.167%)
- Faster: Division by Two Right-Shifts


E) Limit to Infinity the Sum of 1/n!
- ie: 1/1 + 1/2 + 1/6 + ... 1/n! (as n->Infinity)


F) Limit to Infinity the Sum of (1 + 1/n)^n
- ie: (1 + 1/1) + (1 + 1/4) + (1 + 1/9) + ... (1 + 1/(n^n))


NOTE: If you have a constant for which you'd like an approximation, let me know.



Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.