Skip to content

Commit 3c5d96e

Browse files
committed
Losslessly write double precision parameters.
Increase precision of double precision output to 17 significant figures (format %.17g) so lossless by default. https://tracker.physiomeproject.org/show_bug.cgi?id=3837
1 parent 4ad6f8a commit 3c5d96e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

io/src/OutputStream.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ FmlIoErrorNumber FileOutputStream::writeDouble( double value )
174174
return FML_IOERR_RESOURCE_CLOSED;
175175
}
176176

177-
int err = fprintf( file, "%.8g ", value );
177+
int err = fprintf( file, "%.17g ", value );
178178

179179
if( err < 0 )
180180
{
@@ -268,8 +268,9 @@ FmlIoErrorNumber StringOutputStream::writeDouble( double value )
268268
{
269269
return FML_IOERR_RESOURCE_CLOSED;
270270
}
271-
272-
buffer << value << " ";
271+
char tmpValueString[50];
272+
sprintf(tmpValueString, "%.17g ", value);
273+
buffer << tmpValueString;
273274

274275
return FML_IOERR_NO_ERROR;
275276
}

0 commit comments

Comments
 (0)