delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/05/02:30:39

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: problem with math.h
Date: 04 Oct 2000 23:28:57 -0700
Organization: InterWorld Communications
Lines: 26
Sender: nate AT mercury DOT st DOT hmc DOT edu
Message-ID: <83u2ar6bti.fsf@mercury.st.hmc.edu>
References: <39DC061F DOT 97DFBB0D AT trollope DOT org>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 970727337 24893 134.173.57.219 (5 Oct 2000 06:28:57 GMT)
X-Complaints-To: usenet AT news DOT interworld DOT net
NNTP-Posting-Date: Thu, 5 Oct 2000 06:28:57 +0000 (UTC)
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Michael Powe <michael+netscape AT trollope DOT org> writes:

> Hi,
> 
> I have a little something peculiar here.  I #included math.h in order to
> use the PI macro.  However, compiling with 
> 
> gcc -Wall -ansi -pedantic ... -lm 
> 
> results in an error that `PI' is undeclared.  I can get rid of this
> error and get gcc to compile the program by removing -ansi -pedantic
> from the command line.
> 
> Looking in math.h, I see that the section in which PI is #defined is
> preceded by #ifndef __STRICT_ANSI__ and #ifndef _POSIX_SOURCE.  
> 
> Does ANSI C exclude a value for PI?  Is there some reason why the
> standard library should not provide one?

The standard name is M_PI.  Use that instead, and you should be fully
ANSI compliant.

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019