Skip to content

Commit

Permalink
Test for NaN results in WWATest, and fix failed tests by initializing…
Browse files Browse the repository at this point in the history
… wwaASTROM arrays (#7)

Co-authored-by: Kevin Ivarsen <[email protected]>
  • Loading branch information
kivarsen and Kevin Ivarsen authored Aug 14, 2020
1 parent f971fc2 commit ecccfb5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions WorldWideAstronomy/WWA/Astronomy/Astrometry/atic13.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public static void wwaAtic13(double ri, double di, double date1, double date2, r
{
/* Star-independent astrometry parameters */
wwaASTROM astrom = new wwaASTROM();
astrom.eb = new double[3];
astrom.eh = new double[3];
astrom.bpn = new double[3, 3];

/* Star-independent astrometry parameters. */
wwaApci13(date1, date2, ref astrom, ref eo);
Expand Down
4 changes: 4 additions & 0 deletions WorldWideAstronomy/WWA/Astronomy/Astrometry/atoc13.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public static int wwaAtoc13(ref char type, double ob1, double ob2, double utc1,
{
int j;
wwaASTROM astrom = new wwaASTROM();
astrom.eb = new double[3];
astrom.eh = new double[3];
astrom.bpn = new double[3, 3];

double eo = 0, ri = 0, di = 0;

/* Star-independent astrometry parameters. */
Expand Down
9 changes: 7 additions & 2 deletions WorldWideAstronomy/WWATest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static void vvd(double val, double valok, double dval, string func, string test,

a = val - valok;
//if (Math.Abs(a) > dval)
if (a != 0.0 && Math.Abs(a) > Math.Abs(dval))
if (double.IsNaN(a) || (a != 0.0 && Math.Abs(a) > Math.Abs(dval)))
{
f = Math.Abs(valok / a);
status = 1;
Expand Down Expand Up @@ -1592,7 +1592,9 @@ static void t_aticq(ref int status)
{
double date1, date2, eo = 0, ri, di, rc = 0, dc = 0;
WWA.wwaASTROM astrom = new WWA.wwaASTROM();

astrom.eb = new double[3];
astrom.eh = new double[3];
astrom.bpn = new double[3, 3];

date1 = 2456165.5;
date2 = 0.401182685;
Expand Down Expand Up @@ -1628,6 +1630,9 @@ static void t_aticqn(ref int status)
double date1, date2, eo = 0, ri, di, rc = 0, dc = 0;
WWA.wwaLDBODY[] b = new WWA.wwaLDBODY[3];
WWA.wwaASTROM astrom = new WWA.wwaASTROM();
astrom.eb = new double[3];
astrom.eh = new double[3];
astrom.bpn = new double[3, 3];

date1 = 2456165.5;
date2 = 0.401182685;
Expand Down

0 comments on commit ecccfb5

Please sign in to comment.