octave error

Chris G cl at isbd.net
Wed Apr 25 12:16:31 UTC 2007


On Wed, Apr 25, 2007 at 09:10:57AM -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?
> 
It's precedence has fooled you.  ^ has higher procedence than - so
what you have calculated is:-

    - ( 5 ^ 4 )


To get the answer you are expecting you need to type:-

    (-5)^4

-- 
Chris Green




More information about the fedora-list mailing list