Round() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Returns a number obtained by rounding off another number. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

Round( num_expr, round_to ) 

num_expr is a numeric expression.

round_to is the number to which num_expr should be rounded off.

Return Value

Float

Description

The Round() function returns a rounded-off version of the numeric num_expr expression.

The precision of the result depends on the round_to parameter. The Round() function rounds the num_expr value to the nearest multiple of the round_to parameter. If round_to is 0.01, MapInfo Pro rounds to the nearest hundredth; if round_to is 5, MapInfo Pro rounds to the nearest multiple of 5; etc.

Example

Dim x, y As Float
x = 12345.6789

y = Round(x, 100) 
' y now has the value 12300

y = Round(x, 1) 
' y now has the value 12346

y = Round(x, 0.01) 
' y now has the value 12345.68

See Also:

Fix() function, Format$() function, Int() function