Commit 46ca2c72 authored by Christopher Subich's avatar Christopher Subich
Browse files

Update maximum-precision float format to .17g

See http://stackoverflow.com/questions/16839658 -- although
in most cases 16 decimal digits suffices for a double
precision value, in a handful of instances 17 are necessary.
At the command line, see the difference between:

$ printf %.17g 1.0000000000000001

and

$ printf %.16g 1.0000000000000001

Since SPINS does not provide bit-for-bit compatibility when
restarting (because of the startup timestepping approach),
this change is unlikely to make any significant difference
to existing or future cases.
parent 0208ed34
......@@ -344,7 +344,7 @@ void BaseCase::check_and_dump(double clock_time, double real_start_time,
FILE * dump_file;
dump_file = fopen("dump_time.txt","w");
assert(dump_file);
fprintf(dump_file,"The dump time was:\n%.16g\n", sim_time);
fprintf(dump_file,"The dump time was:\n%.17g\n", sim_time);
fprintf(dump_file,"The dump index was:\n%d\n", plot_number);
fclose(dump_file);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment