Rounding a decimal to the next lowest integer

What is the syntax used in order to round a decimal to the next lowest integer

Ex.  122.230 or 122.830   = 122

Answer:

normal_number = 122.13

 lower_number = floor(normal_number)

yields lower_number = 122

ceil() is the opposite.

There is an application of those functions worth mentioning (imho).

If X is the number to be rounded, you can round X to any increment you prefer.  An example will describe it better than words.  To round X (down) to the nearest 16th use this relation.

lower_number = floor(16*X) / 16

Replace the 16 with 10 to round to the first decimal unit, or (0.1) to round to tens of units.

Of course this function is probably more accurately called truncating.  To call this activity rounding is not the common usage of the term.  Rounding usually implies evaluating whether the number gets larger or smaller.  The following relation is one way to achieve 'rounding' (to the nearest integer).

IF (ceil(X)-X) <= (X-floor(X))

ceil(X)

ELSE

floor(X)

ENDIF

Notes:

This rounds up if X is of the form (#.5)

A negative number of the form (-#.5) is rounded 'up' towards zero.