RoundedToNearest

Typeoperator
DictionaryLCB
LibraryLiveCode Builder
Syntax
the rounded of <Target>
Associationscom.livecode.mathfoundation
Summary

Rounds Target to the nearest integer.

Parameters
NameTypeDescription
Target

An expression that evaluates to a number.

Example
variable tNum as Number
variable tRounded as Number
put -5.5 into tNum
put the rounded of tNum into tRounded -- tRounded contains -6
Values
NameTypeDescription
return

The rounded value of Target

Description

Return the greatest integer less than or equal to Target, or the least integer greater than or equal to Target depending on which is closest. If Target is exactly halfway between two integers, returns the one with greatest absolute value, i.e. away from 0.

Tagsmath