From: Martin Ambuhl Newsgroups: comp.os.msdos.djgpp Subject: Re: how to write exponents? Date: Wed, 21 Apr 1999 04:11:53 -0400 Content-Transfer-Encoding: 7bit References: X-Posted-Path-Was: not-for-mail X-Accept-Language: en Content-Type: text/plain; charset=us-ascii 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 /* .... */ 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