From b879864a1fc89f6d3f31ec487a02fac36609db7d Mon Sep 17 00:00:00 2001 From: abrudana_cp Date: Mon, 26 Dec 2016 12:37:47 +0000 Subject: [PATCH] AA --- WorldWideAstronomy/WWA/Astronomy/Calendars/jd2cal.cs | 7 +------ WorldWideAstronomy/WWA/Astronomy/Calendars/jdcalf.cs | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/WorldWideAstronomy/WWA/Astronomy/Calendars/jd2cal.cs b/WorldWideAstronomy/WWA/Astronomy/Calendars/jd2cal.cs index 48b695e..414a927 100644 --- a/WorldWideAstronomy/WWA/Astronomy/Calendars/jd2cal.cs +++ b/WorldWideAstronomy/WWA/Astronomy/Calendars/jd2cal.cs @@ -73,12 +73,7 @@ public static int wwaJd2cal(double dj1, double dj2, ref int iy, ref int im, ref f2 = d2 % 1.0; f = Math.IEEERemainder(f1 + f2, 1.0); if (f < 0.0) f += 1.0; - //d = Math.Floor(d1 - f1) + Math.Floor(d2 - f2) + Math.Floor(f1 + f2 - f); - // dnint :: http://www-01.ibm.com/support/docview.wss?uid=swg21258968 - d = Math.Round(d1 - f1, MidpointRounding.AwayFromZero) + - Math.Round(d2 - f2, MidpointRounding.AwayFromZero) + - Math.Round(f1 + f2 - f, MidpointRounding.AwayFromZero); - //jd = (long)Math.Floor(d) + 1L; + d = dnint(d1 - f1) + dnint(d2 - f2) + dnint(f1 + f2 - f); jd = (long)Math.Round(d, MidpointRounding.AwayFromZero) + 1L; /* Express day in Gregorian calendar. */ diff --git a/WorldWideAstronomy/WWA/Astronomy/Calendars/jdcalf.cs b/WorldWideAstronomy/WWA/Astronomy/Calendars/jdcalf.cs index d0d6a14..5eee474 100644 --- a/WorldWideAstronomy/WWA/Astronomy/Calendars/jdcalf.cs +++ b/WorldWideAstronomy/WWA/Astronomy/Calendars/jdcalf.cs @@ -74,8 +74,8 @@ public static int wwaJdcalf(int ndp, double dj1, double dj2, int[] iymdf) /* Separate days and fractions. */ f1 = d1 % 1.0; f2 = d2 % 1.0; - d1 = Math.Round(d1 - f1, MidpointRounding.AwayFromZero); - d2 = Math.Round(d2 - f2, MidpointRounding.AwayFromZero); + d1 = dnint(d1 - f1); + d2 = dnint(d2 - f2); /* Round the total fraction to the specified number of places. */ f = Math.Floor((f1 + f2) * denom + 0.5) / denom;