bc.trunc

Truncate a number

Prototype

n = bc.trunc (a [, n ] )

Description

Truncates a (gets rid of decimal places). If n is not specified, a is truncated to a whole number. Otherwise n is the number of decimal places wanted.

For example:

bc.digits (10)
print (bc.trunc (1234.567, 1))  -->  1234.5

Lua functions

Topics