MAINSAIL Language Manual, Section 48.16

previous   next   top   contents   index   framed top   this page unframed


48.16. truncate

Figure 48–16. truncate (GENERIC)
$BUILTIN
INTEGER
PROCEDURE   truncate    (REAL v);

$BUILTIN
LONG INTEGER
PROCEDURE   truncate    (LONG REAL v);

truncate returns the (LONG) INTEGER obtained by discarding v's fraction; i.e., it rounds towards zero.

See Figure 35–16 for a table contrasting ceiling, cvi, floor, and truncate.

Example 48–17. Use of truncate
truncate(10.5)  = 10
truncate(-10.5) = -10


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 48.16