Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Full credit of the code goes to @tikhonovits.
I’m opening the PR for review. @tikhonovits’ fix (#26) is overall a marked improvement in precision without affecting any existing tests. However, there are still some discrepancies between @tikhonovits’ expected values, and satellite-js’s calculations when projecting far-future.
Using the new data, you can see the improvement in
dsinit()
for yourself with the following TLE:Before (1/9 passing tests):
0
position.x
26932.01821553239
26932.01821553
50000
position.x
-13790.23079846215
-41642.9836254
1000000
position.x
-41207.47684407635
-41679.89221227
1500000
position.x
-28986.83394359393
89.92166006
2000000
position.x
11054.486932923917
40249.05825173
2500000
position.x
40593.56553348237
41670.98646874
3000000
position.x
30549.12556750274
24943.38429627
3500000
position.x
-9055.922500393144
-25743.03216099
4000000
position.x
-39881.614167309
-19165.8518479
After (6/9 passing tests):
0
position.x
26932.01821553239
26932.01821553
50000
position.x
-41642.98362540031
-41642.9836254
1000000
position.x
-41679.89221227977
-41679.89221227
1500000
position.x
89.92166019427647
89.92166006
2000000
position.x
40249.05825168919
40249.05825173
2500000
position.x
41670.986468733674
41670.98646874
3000000
position.x
-24943.38429627769
24943.38429627
3500000
position.x
-25743.032160969677
-25743.03216099
4000000
position.x
-19165.851847781665
-19165.8518479
As you can see, it went from wildly off, to being pretty close even when it’s wrong.
@ezze I’m a bit out of my depth here; is the
1e-7
tolerance too tight, or is that standard? Is this a floating point bug, or should we be looking for other discrepancies between satellite-js and the C++ version?