Skip to content

Commit

Permalink
cupid: Prevent logfile columns merging together
Browse files Browse the repository at this point in the history
Now explicity include a space between the columns of the CUPID
log file.  Previously certain numbers such as -0.00049505531414
could overflow into the adjacent column which would then continue
with no separation.  The problem with the formatting expression
"%-*.*g", LOGTAB, LOGTAB-5 is that the second number is the
number of significant digits, but the example number above
has 6 characters before the first significant digit, so the
restriction doesn't prevent the column overflowing.  Since the
first formatting parameter specifies the minimum width,
the column can still be too wide, causing misalignment
of the table.  Lines in the table are also one character
shorter, but another space could be added to the end of
every line if that turns out to be a problem.
  • Loading branch information
grahambell committed Dec 10, 2013
1 parent 6674ed5 commit a395d09
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions applications/cupid/cupidsub/cupidstoreclumps.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,11 @@ void cupidStoreClumps( const char *param1, const char *param2, int indf,
if( logfile ) {
nc = 0;

sprintf( buf, "%-*d", LOGTAB, nok );
sprintf( buf, "%-*d", LOGTAB-1, nok );
line = astAppendString( line, &nc, buf );

for( icol = 0; icol < ncpar; icol++ ) {
sprintf( buf, "%-*.*g", LOGTAB, LOGTAB-5, cpars[ icol ] );
sprintf( buf, " %-*.*g", LOGTAB-1, LOGTAB-5, cpars[ icol ] );
line = astAppendString( line, &nc, buf );
}
fprintf( logfile, "%s\n", line );
Expand Down

0 comments on commit a395d09

Please sign in to comment.