Description
Truncate(x) returns either a fractional
or whole number by truncating the number at the decimal point.
Arguments
x is a Number or Currency to be
truncated.
#places is a whole number indicating
how many decimal places are to remain after the value is truncated. (This
argument is optional.)
Action
If the #places argument is specified,
the number is truncated to the decimal place indicated and the function returns
a fractional Number. If #places is negative, the number is rounded to the first
ten, hundred, and so on.
Typical uses
Use this function whenever the
characters to the right of the decimal are not needed for a report or
calculation.
Examples
Truncate(1.23456)
Returns 1.
Truncate(1.499)
Returns 1.
Truncate(1.599)
Returns 1.
Truncate(1.999)
Returns 1.
Truncate(12346.33, 1)
Returns 12346.3.
Truncate(12345.33, -2)
Returns 12300.00.
If you have 147 golf balls in stock and
want to know how many dozen are available for sale, your calculation is
147/12=12.25 12.25 (truncated) = 12 dozen available for sale. If you sell balls
only by the dozen, the .25 dozen you truncated is unimportant.
Truncate({file.BALL INVENTORY} / 12)
Returns 12 where Ball inventory = 147
(147 / 12 = 12.25, 12.25 truncated = 12).
Truncate({file.BALL INVENTORY} / 12)
Returns 12 where Ball inventory = 155
(155/12 = 12.92, 12.92 truncated = 12).
Truncate({file.BALL INVENTORY} / 12)
Returns 13 where Ball inventory = 157
(157/12 = 13.08, 13.08 truncated = 13).
Comments
This is not a rounding function;
Truncate simply deletes all characters to the right of the decimal point.
Truncate (n) and
Int (number) are synonymous except when n
(number) is negative, in which case Truncate returns the first integer greater
than or equal to n, and Int returns the first integer smaller than or equal to
n. For example,
Truncate (-10.2)
Returns -10.
Int (-10.2)
Returns -11.
Truncating is also a feature
available as a formatting option for numerical values in fields. Be aware that
using field formatting features may affect how values are used in formulas.
Truncate and
Fix are equivalent functions.