Berserk Docs
Scalar FunctionsMath Functions

round

Returns the rounded number to the specified precision. Uses round-half-away-from-zero rounding. Different from bin() in that round() rounds to a specific number of digits while bin() rounds to an integer multiple of a given bin size.

Syntax

round(number, precision)

Parameters

Prop

Type

Returns: real

Examples

Example 1

print round(2.98765, 3)
print_0 (real)
2.988

Example 2

print round(2.15, 1)
print_0 (real)
2.2

Example 3

print round(2.15)
print_0 (real)
2.0

Example 4

print round(- 50.55, - 2)
print_0 (real)
-100.0

Example 5

print round(21.5, - 1)
print_0 (real)
20.0

On this page