Advertisement

How many digits of PI to use?

Started by October 19, 2000 02:52 PM
22 comments, last by Ridcully 24 years, 2 months ago
For most games, you can get away with 3.14 but I usually use 3.14159 because that''s all I can usually remember without a calculator.
How about this:

In float.h on MSVC++ 6 the #defined digits of precision are 6 for floats and 15 for doubles. Stick ~20 digits in your #define/const, let the compiler sort out how much is used.

--------------------------
I guess this is where most people put a famous quote...
"Everything is funnier with monkey''s" - Unknown
--------------------------I guess this is where most people put a famous quote..."Everything is funnier with monkey''s" - Unknown
Advertisement
long doubles are 18 digits of precision.

Null and Void
At least I don't know COBOL...
http://www.crosswinds.net/~druidgames/
Just to confuse things more, here''s an interesting technique... Init a variable pi with:

pi = atan(1) * 4;


This topic is closed to new replies.

Advertisement