Re: Calculations and exponents in languages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Algol used ^

More common, historically, is the use of ** as the exponentiation operator: Fortran, PL/I, perl, python

Curiously, many modern languages -- inexplicably -- don't have an exponentiation operator: C, Java, Javascript, PHP

John Gunther


Robin Vickery wrote:
On 28/06/06, tg-php@xxxxxxxxxxxxxxxxxxxxxx
<tg-php@xxxxxxxxxxxxxxxxxxxxxx> wrote:

Huh.. thanks for the illustration Robin. Can't say that I did much with exponents when I've played around with perl or python or C.. and never worked with Java. You've expanded my view.

Ok, now what languages DO use ^ for exponents?


The only one I can think of off the top of my head is BASIC.

Even Bash uses ^ as an xor operator:

  $ echo $(( 7 ^ 2 ))
  5
  $ echo $(( 7 ** 2 ))
  49

-robin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux