prev up next   top/contents search

comp.lang.c FAQ list · Question 14.8

Q: The predefined constant M_PI seems to be missing from my machine's copy of <math.h>.

A: That constant (which is apparently supposed to be the value of pi, accurate to the machine's precision), is not standard; in fact a standard-conforming copy of <math.h> should not #define a symbol M_PI. [footnote] If you need pi, you'll have to define it yourself, or compute it with 4*atan(1.0) or acos(-1.0). (You could use a construction like

	#ifndef M_PI
	#define M_PI 3.1415926535897932385
to provide your own #definition only if some system header file has not.)

References: PCS Sec. 13 p. 237

prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North