Initializing help system before first use

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.