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 = 12.345.000
  b = 12.345.048,9
  c = 12
  d = 12
 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,234e+07  1,234e+07  12  12
12.345.000  12.345.048,9  12  12

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.