delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/21/05:59:41

Message-Id: <199904211034.OAA23161@ape.school.ioffe.rssi.ru>
From: Vladimir Mosgalin <mosgalin AT school DOT ioffe DOT rssi DOT ru>
Subject: Re: how to write exponents?
In-Reply-To: <ZFdT2.478$h35.4939@newsfeed.slurp.net> from Todd Steury at "Apr 20, 1999 10:53:47 pm"
To: djgpp AT delorie DOT com
Date: Wed, 21 Apr 1999 13:33:40 +0400 (MSD)
X-Mailer: ELM [version 2.4ME+ PL48 (25)]
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> 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;
> 
> 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
> 
> 

You can use pow(a, b).


- Raw text -


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