Real

Parent Previous Next

Real.

The Real type represents an 8 byte double precision floating point value.


Type Specification.

Details of the type and the supported operators:


Category

Description

Default

Standard Type

Value range approx.:  -1.79E+308 to +1.79E+308.

0.0


Category

Operators

Primary

x.y   foo(x)

Unary

+   -

Multiplicative

*   /

mod  div

Additive

+   -

Relational

<   >    <=   >=

Equality

==   <>


Assignment

:=    +=    -=    *=    /=


Expressions containing a mix of integers and reals can seamlessly be handled for most situations by evaluating integers as reals where appropriate.


However, a few situations need special attention:


Example:


 Real r := 1.0E+3, q := 300, res;

 res := r div q; //Now res == 3.0;

 res := r mod q; //Now res == 1.0E+2;


 res := 2 + 3/4;   //Error at runtime: Value is not an integer

 res := 2 + 3/4.0; //This will work!



The Real type supports approximately 15 digits of precision. It allows the smallest positive normal value to be approx. 2.23E-308 (and subnormal approx. 4.95E-324). When working with floating point variables in SCRAMBLECODE (and other languages as well) please be aware:


Standard Functions.

This chapter contains descriptions on the next pages of all the standard functions recognized by the compiler as member-functions of the Real type.