Re: bizarre number transformation [message #31473 is a reply to message #31471] |
Thu, 25 July 2002 21:41   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
James Kuyper <kuyper@gscmail.gsfc.nasa.gov> writes:
> Paul van Delst wrote:
>>
>> Michael Ganzer wrote:
>>>
>>> As plenty postings already were dealing about how to use a double precision
>>> number i wanted to ask u something different...
>>>
>>> Whatever you do with 443496.984 in multiplication or something else.....
>>> does it really matter at that number size if there is more than one digit
>>> exact after the digit separator???
>>
>> My goodness. 443496.984 is not a "big" number. What if you have to add it to 0.004657?
>
> The point is, that it's pretty rare to need that many significant
> digits. There aren't many real-world numbers that can be measured to
> within one part in a billion. Precision needs like that can come up in
> intermediate steps of a calculation, (for instance, if you need to
> calculate "sin(theta)-theta" for small values of theta), but that's
> merely an indication that the calculation is badly organised (for small
> theta, you can get more accurate results with the equivalent series
> expansion: "-(theta^3)/6+(theta^5)/120-...")
>
> However, having written a lot of such code, I've found that loss of
> precision due to roundoff can sneak up on you far too easily. It's
> almost always a lot faster (considering CPU time + developer time) to
> use double precision. I save such tricks for the somewhat rarer cases
> where double precision is inadequate.
Okay, I'll give a couple examples from my own needs:
* absolute pulsar timing at the microsecond level, measured in Julian
days, requires a fractional precision of 4d-13
* the most stringent pulsar timing (not mine) requires better than
100 cm positioning within the solar system, or 6 parts in 1d12
* one can determine pulse frequencies of 400 Hz pulsars to a
precision of 1 nHz, or 3 parts in 1d12
* the most precise Doppler tracking of spacecrafts requires 2
milliHertz precision using a carrier of 2 GHz, or 1 part in 1d12
Admittedly those are pretty specialized applications :-)
Most ordinary differential equations, especially if they are
numerically stiff, require double precision.
Also, solving a curve fitting problem with MPFIT, where the parameters
vary in magnitude by more than one part in 1d7, will fail unless
double precision is used.
So, for me at least, double precision is the de facto choice for most
applications, unless the memory usage is prohibitive.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|