Re: Round()
Ben Hague <[email protected]> Fri, 16 Aug 2002 14:18:58 +0000
| Newsgroups | gmane.comp.lang.delphi.kylix |
|---|---|
| Organization | Ravenfield Designs |
| Message-ID | <02081614185800.01076@linux> |
On Thursday 15 August 2002 11:42 pm, you wrote: > Quick, and probably trivial question: > > Why do both Delphi and Kylix round real numbers with a real part of .5 > down when the integer part is even, and up when it is odd? > > IE, 1.5 becomes 2, but 2.5 also becomes 2 There are various ways to do rounding, there was a /. thread about this not so long ago. http://ask.slashdot.org/article.pl?sid=02/06/25/2253259&mode=thread&tid=128 The Delphi/Kylix method avoids increasing the average value of the numbers. i.e. in your example the average stays as 2 rather than 2.5 if you always round up. > Is there some option in 8087CW that can adjust this behaviour? Don't know. Ben Hague