View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
jksmurf[_2_] jksmurf[_2_] is offline
external usenet poster
 
Posts: 1
Default Cube Root of a Negative Number fails in VBA?


Thanks to all who have repled, much food for thought!

NickHK Wrote:

Excel and VBA have different operator
precedence, wrt Negation and Exponentiation

Ta! You could be right.

Patrick Wrote:

the root of a negative number takes us into the realms of imaginary
numbers..


Sure it does ... but if the Worksheet can do it, why can't VBA? It
works if I kludge the sign ... as per my point 2 in the edietd post??

Philip Wrote:

Application.Worksheetfunction. ....
BTW - which functions did you use in the worksheet?

That's the thing, AFAIK there is no built in function like SQRT
function for X^(1/3) ?

kounoike Wrote:
check the results of two formulas in Worksheet
=(-2)^(1/3)
and
=(2)^(1/3)
i think this is why your formula works in Worksheet but not in VBA.


The results I get are
-1.25992105
and
1.25992105

Cheers kuonoike. This is what I get, and expect.

Thanks again to all.
k.


--
jksmurf
------------------------------------------------------------------------
jksmurf's Profile: http://www.excelforum.com/member.php...o&userid=29564
View this thread: http://www.excelforum.com/showthread...hreadid=492644