in reply to How to get better exponentiation?

So, what’s the quickest/simplest/correct way to get Perl to act like the calculator app that comes with Windows, and give -2 as the cube root of -8?

Update: The below is based upon my observations of the Windows calculator on Windows 7.
Some further reading indicates that things might be different on Windows 10.

I think that the calculator app, when calculating x ** y for x < 0 proceeds roughly as follows:
if (x < 0) { return x ** y if y is an integer; calculate n = 1 / y; return nth root of x if n is an odd integer; die "Invalid input", } else { return x ** y; }
As you can see, in addition to needing an exponentiation function, that method also requires a function that calculates the nth root.
If you use that method and make use of POSIX::cbrt(), you should see that it DWYMs for the case -8 ** (1 / 3)

It might also be that the windows calculator is performing decimal arithmetic - and that could also produce results that differ slightly from perl in some cases.
Does anyone know for sure the number base that's used by the windows calculator ?

Cheers,
Rob