[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug with math.log
- From: KHMan <keinhong@...>
- Date: Tue, 04 Mar 2014 20:31:02 +0800
On 3/4/2014 7:43 PM, Dio Darkclainer wrote:
Hello all!
Code:
for i=1,20 do
if math.floor(math.log(2^i,2)) ~= i then
print(i)
end
end
will be output
3
6
12
13
if use math.log(2^i)/math.log(2) intstead all work correctly
lua 5.2.3
Depends on your OS and compiler.
There was a thread here a while ago, where pow() in a particular
implementation did not handle exact cases. Probably this is also
something along those lines...
--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia