trunc Function

Truncates a real number by removing any decimal places.


real trunc(real _decimal)

Parameter

Description

_decimal

The number to truncate

The number equivalent to _decimal, with the decimal places removed.

Numbers are always rounded down to a complete integer.

The following example truncates 2.7147 to 2.00.

static void truncExample(Args _arg)
{
    real r;
    ;
    r = trunc(2.7147);
    print strFmt("r = %1",  r);
    pause;
}

Community Additions

ADD
Show: