Real number format
Whenever output is printed (including matrix export to a file) Mosel uses the standard representation of floating point numbers of the operating system (C format %g). This format may apply rounding when printing large numbers or numbers with many decimals. It may therefore sometimes be preferable to change the output format to a fixed format to see the exact results of an optimization run or to produce a matrix output file with greater accuracy. Consider the following example (model numformat.mos):
model "Formatting numbers" parameters a = 12345000.0 b = 12345048.9 c = 12.000045 d = 12.0 end-parameters writeln(a, " ", b, " ", c, " ", d) setparam("REALFMT", "%1.6f") writeln(a, " ", b, " ", c, " ", d) end-model
This model produces the following output.
1.2345e+07 1.2345e+07 12 12 12345000.000000 12345048.900000 12.000045 12.000000
That is, with the default printing format it is not possible to distinguish between a and b or to see that c is not an integer. After setting a fixed format with 6 decimals all these numbers are output with their exact values.
© 2001-2020 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.