[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why is there no 'math.round'?
- From: David Kastrup <dak@...>
- Date: Wed, 23 Apr 2008 14:57:26 +0200
"troels knak-nielsen" <email@example.com> writes:
> On Wed, Apr 23, 2008 at 2:36 PM, Bogdan Marinescu
> <firstname.lastname@example.org> wrote:
>> "is there any particularly strong reason why lua needs one?".
>> Maybe because just about any decent math library out there has one ? Think I
>> ran in this problem myself a while ago.
> If I'm not mistaken, there are several competing ways of rounding a
> perfect half.
Sure. But the optimal round-to-even strategy is non-trivial to
implement in a system-independent manner and/or in a high level
language. But it is part of IEEE standards. So it is rather cheap to
provide low-level, usually.