ceiling(@number) [ISO]

This arithmetic predicate calculates the smallest integer not smaller than it's argument, i.e. it rounds up if the argument is a positive number. If the argument is a negative number then it rounds down (towards zero). This predicate attempts to convert the result value to an integer.

Example
X is ceiling( 2.6 ). The result is X = 3.
X is ceiling( 2.1 ). The result is X = 3.
X is ceiling( -2.1). The result is X = -2.

 

Exceptions  
overflow of result an evaluation_error(float_overflow) exception is thrown

see also: is/2 arithmetic in Prolog

 

info@trinc-prolog.com