delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/21/03:55:51

From: Martin Ambuhl <mambuhl AT earthlink DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: how to write exponents?
Date: Wed, 21 Apr 1999 04:11:53 -0400
References: <ZFdT2.478$h35 DOT 4939 AT newsfeed DOT slurp DOT net>
X-Posted-Path-Was: not-for-mail
X-Accept-Language: en
X-ELN-Date: 21 Apr 1999 08:10:54 GMT
X-ELN-Insert-Date: Wed Apr 21 01:15:14 1999
Organization: Nocturnal Aviation
Lines: 36
Mime-Version: 1.0
NNTP-Posting-Host: 1cust211.tnt12.nyc3.da.uu.net
Message-ID: <371D8849.D113802A@earthlink.net>
X-Mailer: Mozilla 4.51 [en] (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Todd Steury wrote:
> 
> Hey all,
> 
> I'm using C++ and the djgpp compiler to write mathematical models.  For
> exponents, I've written my equations as "a^b" to signify 'take a to the b
> power'.  However, the compiler complains "invalid operands 'float' and
> 'double' to binary 'operator ^'".  What is the proper mathematical operator
> for exponent?  If '^' is the proper operator, then what am I missing?  A
> sample line of code might be:
> 
> numberFemales = survival^0.226175;

#include <math.h>
  /* .... */
  numberFemales = pow(survival, 0.226175);

'^' is the XOR operator.

Do yourself a favor and get a simple C or C++ book instead of just expecting the
compiler to eat whatever language you are used to writing.

> 
> where all variables are initialized as float, double, or long double.
> Please send responses to e-mail:
> 
> steu4718 AT uidaho DOT edu
> 
> Thanks
> 
> Todd Steury


-- 
Martin Ambuhl (mambuhl AT earthlink DOT net)
Note: mambuhl AT tiac DOT net will soon be inactive

- Raw text -


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