From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: M_PI and -ansi Date: 18 Jun 2001 17:21:09 GMT Organization: Aachen University of Technology (RWTH) Lines: 22 Message-ID: <9glda5$e5s$1@nets3.rz.RWTH-Aachen.DE> References: NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 992884869 14524 137.226.32.75 (18 Jun 2001 17:21:09 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 18 Jun 2001 17:21:09 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Patrick Mitran wrote: > Hi, > when I compile with the -ansi switch, it seems that I don't have a > predefined constant for PI in math.h. As the old saying goes: "Well, don't do that, then!". In this case: don't use -ansi unless you positively have to. > What would be a good way of getting a numerically accurate value of > PI that is ANSI compliant? #include const double pi = 4*atan(1.0); That's about as portable as it gets, and as numerically accurate as anything else you'll be doing in the same instance of the program, using the same C math library implementation. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.