comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: JULDAY 5.4 not same as 5.3?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: JULDAY 5.4 not same as 5.3? [message #24074 is a reply to message #23978] Fri, 02 March 2001 10:39 Go to previous message
Don Woodraska is currently offline  Don Woodraska
Messages: 5
Registered: March 2001
Junior Member
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:
jul = TEMPORARY(JUL) + ( (TEMPORARY(d_Hour)-12)/24d + $
TEMPORARY(d_Minute)/1440d + TEMPORARY(d_Second)/86400d + eps )

FIX:
***
Here's a fix:
jul = TEMPORARY(JUL) + ( (TEMPORARY(double(d_Hour))-12)/24d + $
TEMPORARY(d_Minute)/1440d + TEMPORARY(d_Second)/86400d + eps )


WHY IT WORKS:
***
When you take the difference of 2 different data types (dhour and long 12) the

result is automatically promoted to the data type with the most precision (at
least on our unix implementation).

Although an unsigned long has no more bits/higher precision than a long, it is

first in the expression evaluation. The result of 0ul-12l is an unsigned long
(4294967284 if you want to put a value to it). If you reverse the order like
this,
-12l+0ul, you get a long.

When a ulong64 is passed as the hour argument we get the expression
ulong64(0)-12l, which gives 18446744073709551604.

Cheers,
Don
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Clsuter analysis wiht IDL
Next Topic: Re: Communication between different widget bases

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 10:25:00 PDT 2025

Total time taken to generate the page: 3.06122 seconds