Professional Documents
Culture Documents
Gams Precision of Data Within Gams (GAMS Support Wiki)
Gams Precision of Data Within Gams (GAMS Support Wiki)
There is also limit to the precision of these doubles - the relative error between any real number in the normalized range and the
nearest representable double is at most 2.2204e-016. In practice this means values will have at most 15 or 16 decimal digits of
accuracy. GAMS will never print more than 15 decimals. When GAMS reads numbers it will guarantee 15 digits of precision and
will give an error message ($103) when getting a number with more than 16 digits, since there will be a loss of precision in storing
the result and the extra digits are essentially meaningless:
The option $offdigit can be used to read in data which has more than 16 digits
The display statement only prints up to 8 decimals (3 by default) to the listing file. Use the option decimals = n to
change it the n decimals.
To get maximal precision on a put statement one should force 'scientific' format with plenty of room as shown below
GDX in and out does not drop any precision, it takes the floating point number bit by bit.
$eolcom #
set digits / 14 * 18 /;
parameter v(digits) /
14 1.2345678901234
15 1.23456789012345
16 1.234567890123456
$offdigit
17 1.2345678901234569
18 1.23456789012345678
/;
display 'default number of decimal digits', v; # by default GAMS only displays 3 digits
option decimals=8; # we can't get more
display 'maximal number of decimal digits for display', v;
https://support.gams.com/gams:precision_of_data_within_gams 1/1