View Full Version : [Delphi7] RoundTo question
Atak_Snajpera
7th October 2011, 18:03
RoundTo(10.45,-1) = 10.4 instead of 10.5
According to my basic mathematical knowledge
0 - 4 must be rounded down
5 - 9 must be rounded up.
LoRd_MuldeR
7th October 2011, 22:03
The rounding uses Bankers rules, where an exact half value causes a rounding to an 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
See also:
http://www.delphibasics.co.uk/RTL.asp?Name=Round&ExpandCode1=Yes
Atak_Snajpera
8th October 2011, 09:00
thanks
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.