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

Re: JULDAY 5.4 not same as 5.3?



"Don Woodraska" <don.woodraska@lasp.colorado.edu> wrote in message
3A9FE8D9.8E9BE7DA@lasp.colorado.edu">news:3A9FE8D9.8E9BE7DA@lasp.colorado.edu...
> I've pinpointed the problem.
>
> SUMMARY:
> ***
> The bug appears only with unsigned-long and unsigned-64-bit-long hour
argument
> to JULDAY.
>
> The bug appears on lines 178-179 of JULDAY.PRO. Here it is:
> ...

Well done, Dan. To correct my earlier post, this DOES also occur on windows.
In the list of data values in your original post, i.e...

>>> UMM             LONG      =            2
>>> UDD             LONG      =           16
>>> UYEAR           LONG      =         2001
>>> UHR             ULONG     =            0
>>> UMIN            ULONG     =            0
>>> USEC            ULONG     =            0

...I missed the fact that the hour minute & second values are ULONG and not
LONG. (Though I did wonder why you put a "U" prefix on the variable names!)

I wonder how many other routines can be broken if you pass unsigned-integer
values to them. And how paranoid does a person writing a routine have to be?

Final comment: Isn't JULDAY's argument order ghastly? Month, day, year,
hour, minute, second? I mean, really!

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