lua-users home
lua-l archive

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


Dirk Laurie <dpl@sun.ac.za> writes:

> On Mon, Jun 06, 2011 at 01:47:09AM +0200, Martin Guy wrote:
>> It's bizarre to expose such an esoteric implementation detail so
>> baldly. Only an IEEE validation suite specialist would be worried
>> about seeing the "-"; for normal people, the "-" contains no
>> information and is just surprising/worrying.
>
> It's not whether you are a specialist or normal: it's whether the
> minus sign is relevant to your application or not.  For example,
> you may be planning to calculate 1/x some time later.  Knowing whether
> you're going to get -Inf or +Inf may well be useful even for normal
> people.  
>
> Lua is about keeping types and keywords few and far between, and 
> semantic rules short and simple.  They don't come any shorter and
> simpler than "as in C".

Of course they can come shorter and simpler: "as is".  As far as
semantic rules to rely on go, it means quite the same.

> Unfortunately, the implications of that rule may often be accessible
> to experts only.

You have to read the underlying code _and_ the C language standard _and_
the C implementation details to figure out the actual behavior for your
implementation.

dak@lola:~/tex/knopf/out$ lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> return math.max(0,-0)
0
> return math.min(0,-0)
0
> return math.max(-0,0)
-0
> return math.min(-0,0)
-0
> return math.abs(0)
0
> return math.abs(-0)
0
>

Please tell me how the C standard would prepare you for guessing the
outcome of the above without actually reading the underlying code.

-- 
David Kastrup