bug-gnulib
[Top][All Lists]
Advanced

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

Re: floor, ceil, trunc, round, minus zero, and alpha


From: Eric Blake
Subject: Re: floor, ceil, trunc, round, minus zero, and alpha
Date: Mon, 20 Dec 2010 08:52:08 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

On 12/20/2010 08:44 AM, Bruno Haible wrote:
> Regarding DEC Alpha platforms, I don't think they are 100% IEEE 754 + 854
> compliant, because the hardware designers took some shortcuts regarding
> the exception handling, in order to implement the floating-point operations
> in a single CPU cycle.

Another case of this is the intel compiler on Linux, if you don't use
the -mieee-fp option (see my recent patches in November) - the truth is
that full IEEE compliance is expensive, and lots of people take
shortcuts unless you insist on compliance, so gnulib should tolerate
shortcuts where it is easy enough to do and where the system wasn't
trying to claim full compliance.

> 
>>>   - make little sense for 'ceil' from a mathematical point of view:
>>>     ceil is a monotonically increasing function but POSIX wants
>>>     ceil(-0.5) = 0.0 and ceil(-0.0) = -0.0,
>>
>> I'll raise that point with the Austin group.
> 
> Given that the annex section F.9.6.1 in ISO C99 already specifies this
> behaviour, I don't think the Austin group will deviate from that.

You're right; in fact, Geoff Clare gave his reasoning for keeping the
current behavior:

https://www.opengroup.org/sophocles/show_mail.tpl?CALLER=index.tpl&source=L&listname=austin-group-l&id=15141

> The behaviour sort of makes sense to me.  It matches the equivalent
> arithmetic operation.
> 
> I.e. to obtain the integer value not less than -0.5 you add 0.5 to it,
> and -0.5 + 0.5 is +0.0.  Obtaining the integer value not less than -0.0
> is a no-op, so you get back exactly what you put in.
> 
> The behaviour *is* monotonically increasing (because -0.0 is equal
> in value to +0.0).

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]