float
OPL keyword for floats.
Purpose
OPL keyword
for the basic data type float. Also a reserved
word in IBM ILOG Script.
| context |
|---|
| Model files (.mod) |
Syntax
LiteralType: "int"
| "float"
| "boolean"
| "int+"
| "float+"
| "string"
| "range"
| "range" "float"
| "constraint"
Description
OPL
provides a subset of real numbers as the basic data type float. The implementation of floats in OPL obeys
the IEEE 754 standard for floating-point arithmetic and the data type
float in OPL uses double-precision floating-point numbers. OPL also
has a predefined float constant, infinity,
to represent the IEEE infinity symbol. Declarations of floats are
essentially similar to declarations of integers.
Example
The declaration:
float f = 3.2;
declares a float f whose
value is 3.2. The value of the float can be specified by an arbitrary
expression.
The keyword float can
also be used as the type of decision variables, as in
dvar float Cut[Patterns] in 0..1000000;