Skip to content

Commit 58a05ab

Browse files
committed
Output of elements could fail for unreasonably large semimajor axes (basically, near-infinite ones occurring due to roundoff when e=1 is forced)
1 parent 65a6993 commit 58a05ab

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

elem_out.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -2588,6 +2588,7 @@ int write_out_elements_to_file( const double *orbit,
25882588
{
25892589
char time_buff[40];
25902590
bool nongrav_sigmas_found = false;
2591+
double output_a;
25912592

25922593
snprintf_err( tbuff, 80, "# $Name=%s", object_name);
25932594
text_search_and_replace( tbuff + 4, " ", "%20");
@@ -2605,8 +2606,11 @@ int write_out_elements_to_file( const double *orbit,
26052606
snprintf_err( tbuff, 80, "# $ecc=%.7f $Eqnx=2000.", helio_elem.ecc);
26062607
fprintf( ofile, "%s\n", tbuff);
26072608

2609+
output_a = helio_elem.major_axis;
2610+
if( fabs( output_a) > 1000000.)
2611+
output_a = 1000000.; /* near-parabolic case */
26082612
snprintf_err( tbuff, 80, "# $a=%.7f $Peri=%.5f $Node=%.5f",
2609-
helio_elem.major_axis,
2613+
output_a,
26102614
centralize_ang( helio_elem.arg_per) * 180. / PI,
26112615
centralize_ang( helio_elem.asc_node) * 180. / PI);
26122616
snprintf_append( tbuff, tbuff_size, " $Incl=%.5f",

0 commit comments

Comments
 (0)