Re: Julian time problem [message #51446] |
Sun, 26 November 2006 16:18 |
badjelly.witch
Messages: 27 Registered: May 2006
|
Junior Member |
|
|
Jonathan Dursi wrote:
> In particular, the difference between the two quantities (~4.65e-10) is
> a couple parts in 1e16 of the value (~2.45e6), and you simply can't do
> better than that in the usual IEEE double precision math.
Another issue here, apart from the general imprecision of floating
point math, is that TIMEGEN adds a small offset. From the
documentation:
"A small offset is added to each Julian date to eliminate roundoff
errors when calculating the day fraction from the hour, minute, second.
This offset is given by the larger of EPS and EPS*Julian, where Julian
is the integer portion of the Julian date and EPS is the
double-precision floating-point precision parameter from MACHAR. For
typical Julian dates the offset is approximately 6x10-10 (which
corresponds to 5x10-5 seconds). This offset ensures that when the
Julian date is converted back to the hour, minute, and second, the
hour, minute, and second will have the same integer values."
|
|
|
Re: Julian time problem [message #51489 is a reply to message #51446] |
Fri, 24 November 2006 05:30  |
Jonathan Dursi
Messages: 9 Registered: November 2006
|
Junior Member |
|
|
Paolo Grigis wrote:
> They *are* the same:
In particular, the difference between the two quantities (~4.65e-10) is
a couple parts in 1e16 of the value (~2.45e6), and you simply can't do
better than that in the usual IEEE double precision math.
If your methods depend sensitively on floating point values giving you
results more precise than a few parts in 10^{16}, then I fear your life
will be full of sadness, or at least computationally expensive
arbitrary precision mathematics libraries.
- Jonathan
--
Jonathan Dursi
ljdursi@cita.utoronto.ca
http://www.cita.utoronto.ca/~ljdursi/
|
|
|
Re: Julian time problem [message #51490 is a reply to message #51489] |
Fri, 24 November 2006 05:21  |
Paolo Grigis
Messages: 171 Registered: December 2003
|
Senior Member |
|
|
They *are* the same:
http://www.dfanning.com/math_tips/sky_is_falling.html
You might want, instead of checking for equality,
to do something like
ind=where(abs(time1-time2) LT 1d-9)
Think that one part in 10^(10) of a day is just a few microseconds!
Ciao,
Paolo
corinnefrey@gmail.com wrote:
> Hi,
>
> I have following probem:
>
> First I define two times in the Julian system:
>
> jul_time1=JULDAY(11,5,2006,10,10)
> jul_time2=JULDAY(11,5,2006,10,20)
>
> Then I make a time array which starts at the first time given above
>
> time_array= TIMEGEN(30,units="minutes", START=jul_time1)
>
> The second time is only 10 minutes after the first time, so I should be
> able to find it in the generated time array.
>
> When I print, I get following thing:
>
> IDL> print,time_array(10),format='(d20.5)'
> 2454044.93056
> IDL> print,jul_time2,format='(d20.5)'
> 2454044.93056
>
> That seems to be ok! But if I make the difference then I don't get
> zero:
>
> IDL> print,time_array(10)-jul_time2
> 4.6566129e-010
>
> What happend here? The jul_time2 and the time_array are both in DOUBLE
> format.
>
> IDL> help,jul_time2
> JUL_TIME2 DOUBLE = 2454044.9
> IDL> help,time_array
> TIME_ARRAY DOUBLE = Array[30]
>
> I need to have both numbers the same, so that I can search in the time
> string for a desired time or date.
>
> Thanks for your help,
> corinne
>
|
|
|