octave error

Les hlhowell at pacbell.net
Wed Apr 25 16:23:21 UTC 2007


On Wed, 2007-04-25 at 09:10 -0300, Martin Marques wrote:
> Please, tell me I haven't lost it yet.
> 
> octave:14> -5^4
> ans = -625
> 
> Since when does an even power of a negative number give a negative result?
> 
> $ rpm -q octave
> octave-2.9.9-1.fc6
In many math programs a -# means to multiply the digits by (-1).  Since
exponentiation is a higher math precidence (unary operator vs binary
operator), exponentiation occurs first, then the multiply.  Try (-5)^4.

Regards,
Les H




More information about the fedora-list mailing list