Sunday, February 1, 2009

GAMS $eval trunc

The use of the trunc function in an evaluation macro:

$eval m trunc(2.5)

leads to an error in GAMS. This has been reported and fixed the same day (on a weekend day)! The next version of GAMS (23.0) that will be out very soon will contain the fix.

A simple workaround is to use the floor function. For positive x, trunc(x)=floor(x). If x is negative, trunc(x)=ceil(x).