Here are some quick approximations for PI that I worked out:
PI = 3.141592653589793238462643383...
A) Multiply by 245, Divide by 78 = 3.1410256
- Error: 0.0005670 (0,018%) - Fast: Both mult and division are single-byte calcs.
B) Multiply by 355, Divide by 113 = 3.14159292 (Standard)
- Error: 0.000000266 (0.0000085%) - Very Accurate - Standard Approximation used by many - Although multiplication is double-byte the division is still single-byte
C) Multiply by 201, Divide by 64 = 3.140625
- Error: 0.0009677 (0.031%) - Faster: Division can be done with six right-shifts
D) Multiply by 101, Divide by 32 = 3.15625
- Error: 0.01466 (0.467%) - Faster: Division by five right-shifts
E) Multiply by 25, Divide by 8 = 3.125
- Error: 0.0166 (0.528%) - Faster: Division by three right-shifts
F) Multiply by 13, Divide by 4 = 3.25
- Error: 0.1084 (3.45%) - Fast: Division by two right-shifts
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.