FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Output formatting

Description
The printing format for real numbers may be changed individually with the function strfmt or by resetting the parameter REALFMT. The function strfmt may also be applied to strings, for instance to change the alignment of the text.

Further explanation of this example: 'Mosel User Guide', Sections 10.1 Producing formatted output and 10.3 Real number format


Source Files

Data Files





numformat.mos

(!******************************************************
   Mosel User Guide Example Problems
   ================================= 

   file numformat.mos 
   `````````````````` 
   Formatted output printing.
 
   (c) 2008 Fair Isaac Corporation
       author: S. Heipcke, 2005
*******************************************************!)

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

Back to examples browserPrevious exampleNext example