From Clomosy Docs

Revision as of 12:42, 7 October 2024 by ClomosyManager (talk | contribs)

It is used to round decimal numbers to the nearest whole number. If the decimal part is greater than 0.5, it rounds up; if it is less than 0.5, it rounds down. If the given number is exactly halfway (0.5) between two numbers, the result is always the even number.

12.4 rounds to 12
12.5 rounds to 12 // Round down to even
12.6 rounds to 13
13.4 rounds to 13
13.5 rounds to 14 // Round up to even
13.6 rounds to 14

Example
TRObject Syntax

 var
   numberFloat : Float;
 
 {
 
   numberFloat = 15.50;  
   ShowMessage('Round('+FloatToStr(numberFloat)+') = '+FloatToStr(Round(numberFloat)));
 
 }

Base Syntax

 var
   numberFloat : Float;
 
 begin
 
   numberFloat := 15.50;  
   ShowMessage('Round('+FloatToStr(numberFloat)+') = '+FloatToStr(Round(numberFloat)));
 
 end;

Output:

See Also