NOTE: This type is introduced in CPN Tools 3.5.5.
Real numbers are distinguished from integers by the decimal point. The period separates the integer part from the fractional part. One or more digits must follow after the decimal point. The real color set is large.
IMPORTANT: Reals are NOT equality types in Standard ML. In the CPN ML variant used in CPN Tools this has been modified, meaning you should be able to use reals as any other type, but beware that equality is still dodgy because of rounding errors. We recommend against relying on exact comparisons, and instead use only inequalities using reals (expressions like
x < 1.1). While reals work with the state space tool, we recommend against using reals with state space analysis.
For now, reals are considered experimental due to the very fundamental changes needed to make them work; we welcome any error reports regarding reals, but do not otherwise provide any support for this type before the release of 4.0.
colset name = real [with real-exp1..real-exp2];
usual ordering of numbers
Optional with Clause
Restricts the real color set to an interval determined by the two expressions
real-exp2. It must be the case that
color R = real;
color SomeReal = real with 1.0..3.5;
var someReal : SomeReal;
The CPN variable
someReal may have a range of real values from 1.0 to 3.5. For example, 1.0 and 3.234 are legal values, but 1 and 4.2 are not.
~r: negation of the integer value
r1 + r2: addition
r1 - ri2: subtraction
r1 * ri2: multiplication
r1 / r2: division
Real.==(r1,r2): returns true if and only if neither
r2is NaN, and
abs r: absolute value of
floor r: return largest integer not larger than
ceil r: return smallest integer not less than
trunc r: round
round r: return integer nearest to
real i: convert integer
ito real value
Real.min(r1,r2): minimum of
Real.max(r1,r2): maximum of
Math.sqrtr: square root of
Math.lnr: natural logarithm
Math.arctan r: arc tangent
The trigonometric functions all work in units of radians.
See also color set functions.