lua-users home
lua-l archive

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


Quoth Mike McGonagle <mjmogo@gmail.com>, on 2010-09-19 11:19:59 -0400:
> Hello all,
> 
> I have been doing some very simple things (mostly to get the integer
> portion of a number) using math.floor, and it seems that sometimes the
> function will return -0, when I am expecting a 0. Can someone please
> explain why this happens? Is there a logical reason for this?

Why wouldn't they?  Negative and positive zero are two floating-point
representations with the same closest real number.

Can you give a specific example?

> Thanks,
> 
> Mike

   ---> Drake Wilson