still problem with JD algorithm

Affiliation
American Association of Variable Star Observers (AAVSO)
Mon, 10/16/2017 - 16:30

Hi,

Thought I'd cracked this, but obviously not!

While reporting my obs 2 nights ago using the charting/reporting tool I have written, the JD was 1 day too late, and I have also had a reply to the same effect by my one and only user so far. Here is what I am using (VB6) which comes from this forum ex Meeus, with small changes - I don't need negative dates for obvious reasons! Below gives just the julian day - the decimal of the time is added to the result.

Public Function julian(Y As Integer, m As Integer, d As Integer) As Long
Dim a As Integer, b As Integer
a = Int(Y / 100)
b = 2 - a + Int(a / 4)
If m > 2 Then
'do nothing
Else
Y = Y - 1
m = m + 12
End If
julian = Int(365.25 * (Y + 4716)) + Int(30.6001 * (m + 1)) + d + b - 1524.5
End Function

Affiliation
Astronomical Society of South Australia (ASSAU)
Comparison

Happy to compare notes with my implementation. Looks very much the same as:

https://sourceforge.net/p/vstar/code/HEAD/tree/trunk/src/org/aavso/tools/vstar/util/date/MeeusDateUtil.java

https://sourceforge.net/p/vstar/code/HEAD/tree/trunk/test/org/aavso/tools/vstar/util/date/DateUtilTestBase.java

If you want to compare results of specific date tests, let me know.

David

Affiliation
American Association of Variable Star Observers (AAVSO)
Thanks David, looks as though

Thanks David, looks as though you include the day (decimal and all) as one of the parameters, whereas I add it on after the 'integer' JD (without decimal) has been returned. Could be that's what is giving me the wrong result, so I shall give that a try. Many thanks.

Affiliation
Astronomical Society of South Australia (ASSAU)
Day

Hi Michael

Yep, that makes sense. When I looked quickly at your code above I didn't notice the integer type for day in your function's parameter list. As you say, mine isĀ of a real type:

public double calendarToJD(int year, int month, double day)

...

David

Affiliation
American Association of Variable Star Observers (AAVSO)
Hi David,

Hi David,

Yes, that did it! Just ran the new code and everything correct to 4 dp. Cheers!