[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua minus null (-0)
 
- From: Dirk Laurie <dpl@...>
 
- Date: Sun, 5 Jun 2011 23:43:10 +0200
 
On Sun, Jun 05, 2011 at 10:44:24PM +0200, Henk Boom wrote:
> 
> If I understand the Sebastian properly, he is not complaining that lua
> doesn't differentiate between them, but that these two numbers which
> are not normally differentiated do not print the same:
> 
> On Sun, Jun 05, 2011 at 12:47:39PM +0200, Sebastian wrote:
> > The problem of the output from -0 is that -0 does'nt look good.
> > The user (for example a wow addon user) can be disoriented,
> > when he read the addon output: "(-20) * 0 = -0.
> 
That, too, is not a bug, it's a feature.  Reuben's point applies:
Lua relies on the host C compiler and its libraries.  Since C converts 
a negative zero to the string -0, so does Lua.
It is a good thing, not a bad thing.  The Wikipedia article I cited 
in my previous post gives several examples why one would wish to have 
information on the sign of a zero.
The claim that -0*0 should be 0, not -0 is wrong too.  Quoting the 
article:  "Multiplication and division follow their usual rules for 
combining signs."
D.