Thread: which file define the PI value

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    2

    which file define the PI value

    hi , all
    i need use PI in program, but i can't get PI value,,,which file define it , thanks...

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    I think it's in math.h. The name is M_PI.

  3. #3
    Registered User
    Join Date
    May 2005
    Posts
    2
    thanks very much

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    62
    If there is no such constant in math.h, try this:

    Code:
    #include <math.h>
    
    double pi = atan(1.0) * 4.0;

  5. #5
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    I'm not sure if PI is standard in C inside of the math.h file, but it's certainly in there on good ol' linux gcc:
    Code:
    ./math.h:# define M_PI          3.14159265358979323846  /* pi */

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with Bitmap Display
    By The Brain in forum Windows Programming
    Replies: 7
    Last Post: 03-23-2009, 05:33 AM
  2. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM