## Round down to the next integer

Problems with syntax of GAMS
yanzhiping
User
Posts: 85
Joined: 1 year ago

### Round down to the next integer

I want to do some simple calculation like

0/6=0,1/6 = 0, 2/6=0, 3/6=0, 4/6=0, 5/6=0,
6/6=1,7/6=1,8/6=1,9/6=1, 10/6=1, 11/6=1,
12/6=2,...

In MATLAB there is a floor function which can do this.
floor(3.5) = 3.

Does anyone how to do that in GAMS?

Manassaldi
User
Posts: 56
Joined: 1 year ago
Location: Rosario - Argentina

### Re: Round down to the next integer

Hi,
you can use the same command, this function is valid only for DNLP models

floor(x) returns the greatest integer number less than or equal to x

best regards

yanzhiping
User
Posts: 85
Joined: 1 year ago

### Re: Round down to the next integer

Thanks. How about round up to the nearest integer.
For example, 1/6=1, 7/6=2...
I am not going to do that on variables, so it will still be linear.

Manassaldi
User
Posts: 56
Joined: 1 year ago
Location: Rosario - Argentina

### Re: Round down to the next integer

ceil(x) returns the smallest integer number greater than or equal to x.
Bye