floor

OPL function to return the largest integer smaller than or equal to a value

Purpose

OPL function to return the largest integer smaller than or equal to f.

type
float

Syntax

floor(float f)

Description

Returns the largest integer smaller than or equal to a given floating-point value. You can use this function within IBM ILOG Script statements by specifying the OPL namespace:


( Opl.xxx() )

Example

float a=-2.4;
float b=3.5;

float floorofa=floor(a);
float floorofb=floor(b);

execute
{
   writeln("floor(",a,") gives ",floorofa);
   writeln("floor(",b,") gives ",floorofb); 
}

Result

floor(-2.4) gives -3
floor(3.5) gives 3