Commit Graph

11 Commits

Author SHA1 Message Date
Don Cross
7e196a3c17 Fixed Windows batch files ignoring negative integer failure codes.
In many of my Windows batch files, I used the following
construct to detect failures:

    do_something
    if errorlevel 1 (
        echo.An error occurred in do_something
        exit /b 1
    )

I discovered that it is possible for a Windows program
to exit with a negative integer error code.
This causes the above construct to miss the failure
and the batch file blithely continues.

So I have replaced that construct with

    do_something || (
        echo.An error occurred in do_something
        exit /b 1
    )

This way, if the command exits with any nonzero error,
we correctly detect it as a failure.
2023-02-26 10:26:42 -05:00
Don Cross
7445219794 Corrected diff of nutation angles on Windows. 2022-12-04 14:52:52 -05:00
Don Cross
a24da098de diffcalc: run all tests before pass/fail.
Instead of stopping at the first failure, diffcalc
scripts (Linux and Windows) will now continue to run
all tests before reporting pass/fail. This allows
fixing multiple issues all in one GitHub Actions pass.

Also fixed the immediate issue where I needed to
increase tolerances slightly, as a follow-up fix
for nutation formula changes.
2022-12-04 12:05:26 -05:00
Don Cross
740a65d29b Windows: fixes for testing nutation changes. 2022-12-04 11:13:24 -05:00
Don Cross
c9054e25e3 Diffcalc C/Kotlin: relaxed tolerances.
The GitHub Actions test comparing C and Kotlin
output failed for the Mac OS platform.
The test failed locally on my Windows 10 system
for the same reason.
Relaxed the constraints on both so they will pass again.
2022-03-31 15:45:15 -04:00
Don Cross
41be8a2b6b Kotlin: Fixed bug calculating horizontal coordinates.
The `horizon` function was taking the sine and cosine
of the right ascension, but treating it as degrees.
This was wrong because right ascension is in sidereal hours.
Fix: multiply hours by 15 to get degrees.

Keeping the unit test that confirmed this bug.

Added comparison of C and Kotlin output to `diffcalc`
and `diffcalc.bat`. This test now passes on Linux.
This is a big milestone!
2022-03-31 14:49:35 -04:00
Don Cross
44adf1e652 Relaxed diff threshold so it passes on my Windows laptop.
The recent changes in C# vector to spherical conversions
caused a miniscule change in the comparison between
C and C# calculations. The same thing happened in Linux.
I am relaxing the threshold slightly so the tests pass
again on my Windows 10 laptop. It's curious that they
didn't fail in the GitHub Actions Windows image.
2022-03-26 21:04:31 -04:00
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