|
.Nw number width |
Top Previous Next |
|
This attribute controls the width of numerical items in the put output. It is addressed using the syntax
Localfileidentifier.nw=number;
or in the example putex6.gms
my1.nw=12; Example: Using the example putex6.gms
scalar number regnumber /1.2356/ smallnumber /0.00000001/ largenumber /1000000000/; put 'start number here $':0 number '$ end here'/; put 'start small number here $':0 smallnumber '$ end here'/; put 'start large number here $':0 largenumber '$ end here'/;
where the items in orange are the numerical data and the blue items are statements causing those to be output into the put file. In turn when we run this with the default for .nw of 12 we get
start number here $ 1.24$ end here start small number here $ 0.00$ end here start large number here $1.0000000E+9$ end here
showing that by default 12 characters are always printed, that the number is padded to the left, and reported in exponential format if too large.
If we reset nw to 0 we get
start number here $1.24$ end here start small number here $0.00$ end here start large number here $1000000000.00$ end here
showing the exact width is used with the specified decimals as discussed above.
If we reset nw to 4 we get
start number here $1.24$ end here start small number here $0.00$ end here start large number here $****$ end here
showing that when a number is still too large, asterisks replace the value in the output file. |