Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 18 Sep 2014 19:55:47 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] Make musl math depend less on libgcc builtins

* Sergey Dmitrouk <sdmitrouk@...esssoftek.com> [2014-09-18 17:28:40 +0300]:
> On Thu, Sep 11, 2014 at 07:11:23AM -0700, Szabolcs Nagy wrote:
> > on a correct implementation ==, != are quiet, but <,>,<=,>=
> > raise invalid if any of the operands are nan
> 
> I wanted to get some details on this, but failed to find relevant
> sections of C99/IEEE754 standards.  I see C99 referring to IEEE754, is
> it in "5.11 Details of comparison predicates" section of IEEE754?
> Could you please point me to section(s) I'm apparently missing?

yes ieee754-2008 5.11

i think it is clear: there are tables showing all the predicates
and to which "traditional names and symbols" they should map.

table 5.1 shows ==, != as quiet comparisions, table 5.2 shows
<,> operations as signaling and the text mentions that the quiet
operations in table 5.3 are for applications which want to
explicitly handle quiet nans that way

the text in iso C F.3 is not very detailed about the mapping but
gives hints:

 The relational and equality operators provide IEC 60559 comparisons.
 IEC 60559 identifies a need for additional comparison predicates to
 facilitate writing code that accounts for NaNs. The comparison macros
 (isgreater, isgreaterequal, isless, islessequal, islessgreater, and
 isunordered) in <math.h> supplement the language operators to address
 this need. The islessgreater and isunordered macros provide respectively
 a quiet version of the <> predicate and the unordered predicate
 recommended in the Appendix to IEC 60559.

the <,> predicates need a quiet version because the default is not quiet,
but == and != dont since they are already quiet

the precise mapping will be spelled out in more detail in TS 18661,
 http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1778.pdf
see "table - 1 operation binding"
(the latest version seems to be password protected, sigh..)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.