LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Cube Root of a Negative Number fails in VBA?

From the VBA help file for the ^ operator:
--- begin quote ---
result = number^exponent

....

Remarks

A number can be negative only if exponent is an integer value...
--- end quote ---

My guess is that, like so many other functions, this was implemented
using the first method some programmer found in an introductory
textbook on the subject.

x^n = exp(n*ln(x))

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...

I'm stumped. I have a simple calculation in a Macro which results in a
-ve number.

Gr = ((1 - 2 / a) / (1 + x * sqr(2 / (a - 4)))) ^(1 / 3)

I did a watch on a and x, they are 191 and -21.

The error is " Run-time error '5' Invalid procedure call or argument "

Oddly, if I perform the SAME calc in the Worksheet it works FINE. It
just fails in VBA?

Any ..um ... hints?

k.


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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cube root? Scott Excel Worksheet Functions 6 November 30th 05 10:34 PM
how to calculate a cube root kiran Rajguru New Users to Excel 2 November 16th 05 10:50 AM
cube root derskell Excel Worksheet Functions 5 August 5th 05 04:03 PM
Cube Root bigfoot Excel Discussion (Misc queries) 1 December 27th 04 08:09 AM
Cube Root Harold Hagar Excel Discussion (Misc queries) 1 December 27th 04 07:17 AM


All times are GMT +1. The time now is 08:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"