Issue 37129 - Calc can't evaluate cube roots of a negative numbers or any other odd roots
Summary: Calc can't evaluate cube roots of a negative numbers or any other odd roots
Status: CONFIRMED
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: OOo 1.1.1RC
Hardware: PC Linux, all
: P3 Trivial with 16 votes (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
: 74782 94487 (view as issue list)
Depends on:
Blocks:
 
Reported: 2004-11-14 08:30 UTC by windryder
Modified: 2017-05-20 11:13 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description windryder 2004-11-14 08:30:53 UTC
It looks like calc is unable to evaluate odd roots (a number raised to the 
power of 1/3,1/5,1/7,...etc).  For instance if you type in as a formula 
-8^(1/3), calc returns #VALUE when the answer should be -2.  It looks like any 
negative number you raise to a fractional exponent can't be evaluated.  For 
even roots this should be expected since imaginary values would result, 
however odd roots should result in real values.
Comment 1 frank 2004-11-15 09:05:53 UTC
Hi,

it's the same problem as described in Issue 24271. Therefore I close this one as
double.

Frank

*** This issue has been marked as a duplicate of 24271 ***
Comment 2 frank 2004-11-15 09:06:09 UTC
closed double
Comment 3 frank 2004-11-15 09:31:09 UTC
Sorry,

not a double.

Frank
Comment 4 frank 2004-11-15 09:32:03 UTC
Hi Eike,

please have a look.

Frank
Comment 5 niklas.nebel 2004-11-15 10:23:06 UTC
This should be changed, but it's not inportant enough for target "2.0".
Comment 6 nathanson 2005-02-03 20:10:29 UTC
Bug repeated in OOo1.1.3/Linux and 680m74 on WinXP
Comment 7 cbx550f 2007-02-09 23:28:58 UTC
Repeated in 2.0.3 Linux
Comment 8 Regina Henschel 2007-02-22 22:29:35 UTC
Why do you want to change it? It is dangerous to calculate like (-8)^(1/3)=-2.
Look at this:
(-8)^(1/3)=(-8)^(2/6)=((-8)^2))^(1/6)=64^(1/6)=2

If you use fractions in exponents and want to keep the rules for exponents, than
you cannot allow negative base. And ^ and POWER calculate with exponents.

There are other opinions, but then you are speaking of a cube root, which would
be a new function in Calc.
Comment 9 Regina Henschel 2007-02-22 22:30:42 UTC
*** Issue 74782 has been marked as a duplicate of this issue. ***
Comment 10 Regina Henschel 2008-09-30 18:12:56 UTC
*** Issue 94487 has been marked as a duplicate of this issue. ***
Comment 11 mikekaganski 2009-04-15 04:42:30 UTC
The bug persists in OOo 3.0.1/WinXP.

It leads to incompatibility with MS Excel and thus, to difficulties in 
migration.

The general math rule says that "For odd values of n, every negative number has 
a real negative nth root" (http://en.wikipedia.org/wiki/Nth_root). And it's not 
correct to spaculate that "(-8)^(1/3)=(-8)^(2/6)=((-8)^2))^(1/6)=64^(1/6)=2". 
This speculation is a sort of sophism that masks the fact that there are more 
than one nth roots. When you make any transformations of powers you must take 
into account the possible loss of some roots or introduction of new roots. The 
correct result of "sqrt(x)" should be a multitude of two (possibly complex) 
numbers, not a single number. As we cannot return such a result in a 
spreadsheet we agree to see only positive answer, but it doesn't mean that we 
don't deserve to get correct negative real number as a cube root of a negative 
number.

To be specific: x != sqrt(x^2), because, strictly speaking, sqrt(x^2) = {x, -
x}. So (-8)^(1/3) = (-8)^(2/6) [only if you calculate 2/6 _before_ you 
calculate the exponent] != ((-8)^2))^(1/6), because here in the last case the 
base is raised to 2nd power and then the 6th root is taken, and the extra "2" 
brings new roots here (positive ones).

As it can be seen in Issue 24271 (that was erroneously treated as duplicate to 
this one), the OOo team makes it's best to maintain compatibility with its main 
competitor. This approach has very strong base and is honored sometimes even if 
there's a mistake in th MS Office to let users migrate painlessly. But in this 
case you refuse to make changes that not only consistent with MS Excel, but 
also mathematically correct!

[Workaround] for those who want to find the cube root:
SIGN(X)*ABS(X)^(1/3)
Comment 12 Marcus 2017-05-20 11:13:23 UTC
Reset assigne to the default "issues@openoffice.apache.org".