# Why does octave give different results for 9 ^ 1/2 and 9 ^ 0.5?

Lately I've been trying to brush up on the math I should have learned in high school. (I didn't pay much attention.) Regarding this, college entrance exams and octave make a great pair.

This morning I got to fractional powers. And octave had something surprising in store:

octave:41> (9 ^ 1/2)
ans =  4.5000
octave:42> (9 ^ .5)
ans =  3
octave:43> (9 ^ 0.5)
ans =  3

Maybe I dozed off when we covered this in high school, but no... According to this website,

By the way, some decimal powers can be written as fractional exponents, too. If you are given something like "35.5", recall that 5.5 = 11/2, so:

3 ^ 5.5 = 3 ^ 11/2

So evidently there's some reason why octave evaluates these two expressions differently...

Why does octave evaluate fractional powers differently? Is this a non-feature, or is there a good reason why it should?

-
PEMDAS (purplemath.com/modules/orderops.htm) is taught in many schools, and it's what I learned, so it's a bit frustrating that octave does not follow it. Although, I guess in a sense it does follow PEMDAS, it just requires us to ignore the years we have already spent learning to treat fractions as entities in their own right.. hmm... If I were the world's benevolent dictator, there are only two things I would change, and the way mathematics is taught in schools would be one of them. – ixtmixilix Apr 16 '12 at 19:48