lua-users home
lua-l archive

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

Dirk Laurie wrote:
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."


This is just flat wrong. Zero does not have a sign in any mathematics of which I am aware. Whoever wrote the wiki entry is full of hops. Computers may allow a sign to be placed on zero, but that does not give it any mathematical meaning. The wiki entry also says that division by zero is only undefined when zero is divided by zero, and that is also false. Division by zero is always undefined and does not equal infinity. As the divisor approaches zero, the result approaches infinity, but the function is discontinuous. Some idiot has been playing with the wiki entries. Last time I checked, sign or no sign, computers give a machine check when division by zero is attempted.

Everett L.(Rett) Williams II