Commit Graph

4 Commits

Author SHA1 Message Date
Don Cross
0b96e2a2d7 Fixed Windows build: diffcalc C vs C#.
A slight difference (7.9e-17) in calculation now exists between
the C and C# horizontal angle calculations on Windows.
This is not surprising because the atan2() function is
known to return slightly different values on other
compilers/platforms. Adjusted the tolerance for this tiny
amount of roundoff discrepancy.
2021-11-13 09:13:41 -05:00
Don Cross
932573ac2d More fixes needed for diffing calculations among languages.
It turns out different Node.js versions do math differently,
which caused a Travis CI build failure.

Scale topocentric distance the same way I scale heliocentric distance.
Adjusted diffcalc bash script and diffcalc.bat Windows batch file accordingly.

The differ now prints the final "score" so I'm less likely to make
a mistake spotting the correct maximum difference.

Removed unused variable in ctest.c DiffLine(): maxdiff.
2021-04-20 18:51:36 -04:00
Don Cross
1e2c24208c Fixed #103 - Scale body vector differences by orbital radius.
When comparing calculations of body vectors, scale
the size of the difference by the minimum orbital
radius (or typical radius in the case of the Solar
System Barycenter).

This concludes my investigations of discrepancies between
the various language calculations. I have done as much
as I can without implementing my own trig functions,
which is not worth the effort (or the loss of efficiency
in JavaScript).

Scaling the errors relative the measurement units reveals
that the discrepancies are reasonable for the 16-digit
precision one expects from 64-bit floating point numbers.
The worst case is C vs JavaScript, with a scaled error
of about 7.2e-15. I can live with that.
2021-04-20 17:23:29 -04:00
Don Cross
ce0290b7f6 diffcalc: Divide angular errors by their range of values.
A given amount of error in an angle measured in
sidereal hours is 15 times more important than the
same numeric error in an angle measured in degrees.
Scale angular errors by the range of values they
could take on. Longitude-like angles in degrees
have a range of 360, while latitude-like angles
range over 180 degrees (-90 to +90).

Split out separate Windows batch file diffcalc.bat,
just like I already split out bash script diffcalc.
2021-04-20 16:25:02 -04:00