[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.0 (work1) now available
- From: Leo Razoumov <slonik.az@...>
- Date: Sat, 9 Jan 2010 07:58:33 -0500
On 2010-01-09, Rene Rebe <email@example.com> wrote:
> Actually your bitop lib has very strange rounding characteristics due to the exotic number conversion:
> > return bit.bor(1000.5, 0)
> > return bit.bor(1000.6, 0)
Decimal number 1000.6 does not have a finite binary representation
and, thus, cannot usefully participate in bitwise operations. As a
rule of thumb do bitwise ops only on integers. Mike Pall has an
explicit paragraph on this rule in BitOP documentation.
"Bitwise operations cannot sensibly be applied to FP numbers (or their
underlying bit patterns). They must be converted to integers before
operating on them and then back to FP numbers."