round . math . sncode
latest
Standart rounding of a number.
ROUND
NAME
round - Standart rounding of a number.
SYNOPSIS
round(argument)
DESCRIPTION
This mathematical function returns the nearest integer of the argument. It does not take the sign into account.
PARAMETERS
- number
- Specify the number (float) used as argument for the round function.
RETURN
- The nearest integer of the argument.
EXAMPLES
Note: In the followings examples, the _ between the { should be removed to make it work.
One can use this function with integers: test(q(res={_{round(-5);}}.),q(res=-5.)); With floats (negative or positive): test(q(res={_{round(-4.5);}}.),q(res=-5.)); test(q(res={_{round(4.5);}}.),q(res=5.)); With another variable: test(q(res={_{ %include "/includes/extenso.sn"; a=2.6; round(a); }}.), q(res=3.)); With a trigonometric function: test(q(res={_{ %include "/includes/extenso.sn"; a=cos(PI); round(a); }}.), q(res=-1.)); With an array: test(q(res={_{round(4.3,-4.3,1.5);}}.),q(res=\[4,-4,2\].));
AUTHOR
Written by Caroline Laplante, <claplante@sednove.com>