octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #56062] Strange result solving a simple proble


From: Rik
Subject: [Octave-bug-tracker] [bug #56062] Strange result solving a simple problem
Date: Tue, 2 Apr 2019 16:41:17 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Update of bug #56062 (project octave):

                Category:         Octave Function => Interpreter            

    _______________________________________________________

Follow-up Comment #2:

This is just math, nothing particularly strange.

If you raise a negative number to the 1/3rd power you are going to get a
complex result.  Break it up in to individual calculations


octave:4> sqrt (21)
ans =  4.5826
octave:5> 3 * ans
ans =  13.748
octave:6> 8 - ans
ans = -5.7477
octave:7> ans^(1/3)
ans =  0.89564 + 1.55130i


On the other hand, in the second example there is a call to abs(), or absolute
value, which removes the minus sign.


octave:11> abs(8-3*sqrt(21))
ans =  5.7477
octave:12> ans^(1/3)
ans =  1.7913




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?56062>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]