Sender: tim AT riker DOT skynet DOT be Message-ID: <3B2E1AA0.7F32571A@falconsoft.be> Date: Mon, 18 Jun 2001 17:13:36 +0200 From: Tim Van Holder Organization: Anubex N.V. X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.4-win4lin i686) X-Accept-Language: en, nl-BE, nl MIME-Version: 1.0 To: Patrick Mitran CC: djgpp AT delorie DOT com Subject: Re: M_PI and -ansi References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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. This can easily be fixed by defining my own > constant as > > const real pi = 3.14159265358979323846; > > However, I believe this is bad style. What would be a good way of getting > a numerically accurate value of PI that is ANSI compliant? There isn't - the reason M_PI isn't defined if you use -ansi is that M_PI isn't in the ANSI spec. It might be in the C99 standard, but DJGPP and gcc aren't c99-compliant (yet). A good way around this is not to use -ansi. If you use -pedantic, it will not restrict available defines/functions/variables to those provided by the ANSI spec, but it will generate warnings if you use things ANSI won't allow (and -pedantic-errors will generate errors). Unless you're restricted to using only things the ANSI spec provides, using -ansi is not required. -- Tim Van Holder - Anubex N.V. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= This message was posted using plain text. I do not endorse any products or services that may be hyperlinked to this message.