Math potency in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
asai
Forum Commoner
Posts: 43
Joined: Tue May 04, 2010 6:24 am
Location: Norway

Math potency in PHP

Post by asai »

Hi
I am trying to insert this code in a PHP file:

Code: Select all

$answer = (5.545*($a^0.3732)/($e^0.20442));
But the answer gets wrong.
Is the sign for potency correct or is it another way to do this?
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: Math potency in PHP

Post by klevis miho »

I don't know what potency means, but I know that the sign "^" is the square of (2^3 = 2x2x2)
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Math potency in PHP

Post by Weirdan »

^ operator is used for exclusive OR (bitwise operator). To raise a number to a power you need to use pow() function.
Post Reply