See Also: Type Conversion Functions, Integer, Number, Round, String
The Real function returns a value of type Real from a source of another data type.
(Real( {expression} ))
Real returns floating point (real) values from sources of other types.
Procedure Test
Number nSide
Real rArea
Move 6.567 To nSide
Move (Real(nSide ^ 2)) To rArea
End_Procedure
In this example, the value of number variable nSide is squared and moved to the real variable rArea in floating-point precision.
Real does not change the type of any value. It only affects the precision to which an expression is evaluated.
When used inside an expression, real affects the precision of the overall expression, unless a function converting to a lower order of precision contains the real expression.
Number nSum nPopulation
Real rMean
Move (Real(nSum / nPopulation)) To rMean
This example would output the quotient of the nSum divided by nPopulation to the real variable rMean in full floating point precision.