which file define the PI value

This is a discussion on which file define the PI value within the C Programming forums, part of the General Programming Boards category; hi , all i need use PI in program, but i can't get PI value,,,which file define it , thanks......

  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, 06:33 AM
  2. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 04:44 PM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 09:39 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 10:54 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21