lua-users home
lua-l archive

Re: Why is there no 'math.round'?

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


"troels knak-nielsen" <troelskn@gmail.com> writes:
> On Wed, Apr 23, 2008 at 2:36 PM, Bogdan Marinescu
> <bogdan.marinescu@gmail.com> 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.
-- 
David Kastrup

AltStyle によって変換されたページ (->オリジナル) /