Rounding

trunc function

Removes the fractional part of the argument.

trunc(z)

Description

The trunc function returns the integer part of z. The function removes the decimal part of z, i.e. rounds against zero. z may be any numeric expression that evaluates to a real number or a complex number. If z is a complex number, the function returns trunc(re(z))+trunc(im(z))i.

 Wikipedia MathWorld

fract function

Returns the fractional part of the argument.

fract(z)

Description

The fract function returns the fractional part of z. The function removes the integer part of z, i.e. fract(z) = z - trunc(z). z may be any numeric expression that evaluates to a real number or a complex number. If z is a complex number, the function returns fract(re(z))+fract(im(z))i.

 Wikipedia MathWorld

ceil function

Rounds the argument up.

ceil(z)

Description

The ceil function finds the smallest integer not less than z. z may be any numeric expression that evaluates to a real number or a complex number. If z is a complex number, the function returns ceil(re(z))+ceil(im(z))i.

 Wikipedia MathWorld

floor function

Rounds the argument down.

floor(z)

Description

The floor function, which is also called the greatest integer function, gives the largest integer not greater than z. z may be any numeric expression that evaluates to a real number or a complex number. If z is a complex number, the function returns floor(re(z))+floor(im(z))i.

 Wikipedia MathWorld

round function

Rounds a number to the specified number of decimals.

round(z,n)

Description

The round function rounds z to the number of decimals given by n. z may be any numeric expression that evaluates to a real number or a complex number. If z is a complex number, the function returns round(re(z),n)+round(im(z),n)i. n may be any numeric expression that evaluates to an integer. If n<0, z is rounded to n places to the left of the decimal point.

Examples

 round(412.4572,3) = 412.457 round(412.4572,2) = 412.46 round(412.4572,1) = 412.5 round(412.4572,0) = 412 round(412.4572,-2) = 400