After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 687269 - odd roots of negative numbers
odd roots of negative numbers
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Analytics
git master
Other Linux
: Normal normal
: ---
Assigned To: Morten Welinder
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2012-10-31 14:28 UTC by Andreas J. Guelzow
Modified: 2012-11-02 19:08 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andreas J. Guelzow 2012-10-31 14:28:40 UTC
In A1 add an odd integer > 1
In A2 add =(-8)^(1/A1)

Gnumeric shows an error in A2 (which makes sense to me)

The problem is interoperability with Excel. According to http://plugfest.opendocsociety.org/doku.php?id=scenarios:20121018:nroot_on_negative_radicand
Excel2013 does not yield an error but recognizes that the formula essentially takes an odd root of a negative number.
Comment 1 Morten Welinder 2012-10-31 14:53:58 UTC
That's sick.

1/odd is not finitely representable in base 2 unless odd==1.  In fact,
it will be represented as some p/q with even q.

Now one could go looking for p'/q' approximating 1/odd, but with odd q'.
There will be many such, but some will have even p' and some will have
odd q'.  So the sign of the result would be ill defined.
Comment 2 Morten Welinder 2012-10-31 14:57:03 UTC
But maybe we need a three-argument power function to do x^(p/q).
Comment 3 Andreas J. Guelzow 2012-10-31 15:00:11 UTC
As I said, it makes sense to me that Gnumeric shows an error. 

I think Excel's behaviour may only make sense if at parsing time this structure ()^(1/n) is translated into an nth root function, i.e. 1/n is never evaluated.
Comment 4 Andreas J. Guelzow 2012-10-31 15:01:24 UTC
Yes a three-argument power function to do x^(p/q) would work for me.
Comment 5 Morten Welinder 2012-11-02 17:52:54 UTC
=POWER(-8,1,3) now produces -2.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 6 Andreas J. Guelzow 2012-11-02 18:36:54 UTC
I am not quite sure how this fixes the interoperability problem (I see it only as a first step.)

If we have an excel file that uses 
In A1 3
In A2 =(-8)^(1/A1)

then we don't invoke POWER so still get a #NUM...

We still have to adjust the parsing on open of such a file (and possibly when entering such an expression)
Comment 7 Morten Welinder 2012-11-02 19:08:31 UTC
It doesn't solve that.  It only provides a fairly simple way to calculate
odd roots.

I am not sure we want to interoperate with that.  (And with the new POWER
in its current form we cannot -- the third argument must be an integer.)