[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CalDat



"Ben Tupper" <pemaquidriver@tidewater.net> wrote in message
3B017E66.BD5C9F6D@tidewater.net">news:3B017E66.BD5C9F6D@tidewater.net...
> As single precision:
>
> IDL> CALDAT, 2529161.36, Month, Day, Year, Hour,
> Minute, Second
> IDL> PRINT, Month, Day, Year, Hour, Minute, Second
>            7           4        2212          18
> 0      0.00000000
>
> As double precision:
>
> IDL> CALDAT, 2529161.36d, Month, Day, Year, Hour,
> Minute, Second
> IDL> PRINT, Month, Day, Year, Hour, Minute, Second
>            7           4        2212          20
> 38       23.999989

I get the same results on my machine (which is not surprising as it's the
same IDL version). But what about this:

CALDAT, double(2529161.36), Month, Day, Year, Hour, Minute, second
print, Month, Day, Year, Hour, Minute, second
;           7           4        2212          18           0
0.00000000

i.e. CALDAT gives the same result for double(2529161.36) as it does for
2529161.36.

If you look inside CALDAT you will see that there is no difference in the
way it handles floats and doubles, and also that its constants are doubles
and longs. So for most purposes a float argument is promoted to double in
the calculation.

I suggest that there is nothing wrong with CALDAT, but that floats have
inadequate precision to represent Julian dates. The following shows that
they are only accurate to ~0.3 days.

ma = machar()  &  print, 2529161.36*ma.eps
;     0.301500


---
Mark Hadfield
m.hadfield@niwa.cri.nz  http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research


-- 
Posted from clam.niwa.cri.nz [202.36.29.1] 
via Mailgate.ORG Server - http://www.Mailgate.ORG