Why calculate a constant?
Accuracy, portability, compatibility?
For the most accuracy, declare PI like this...
Dim PI As Variant
PI = CDec("3.1415926535897932384626433833")
Then, if PI is not placed inside a
VB math function call, your calculations
should maintain an accuracy of 28 significant figures (
VB math function
calls can only return a Double at most, so if you placed PI inside the math
function call, like Sin(PI/6) for example, then the Sin function will return
a Double; but if you did PI*Sin(0.123) for example, then the calculation
would return a number with 28 significant digits
(0.3854422854886583808804090009 to be exact). So, from your original
question, this...
C = 2 * PI * R
would assign to C a value accurate to 28 significant digits.
--
Rick (MVP - Excel)
"Prof Wonmug" wrote in message
...
On Tue, 28 Apr 2009 07:12:12 -0700, Jim Thomlinson
wrote:
I like that one... I would never have thought to use the ArcTangent but it
makes sense. I guess that is why they pay you the big money. That being
said
I would be inclined to just use the constant and avoid the overhead of a
function.
You mean the 10 ns overhead (or whatever it is)?
If the function call is in a tight loop that is called billions of
times and if the function call (to define the constant) cannot be
moved outside the loop, then maybe.
Why calculate a constant?
Accuracy, portability, compatibility?