Re: Draft C bindings for IEEE 754-2008 part 4 now available

2014-02-04 Thread Joseph S. Myers
Revised versions of parts 3 and 4 are now available:

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1789.pdf
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1790.pdf

(note that these are not yet expected to address all comments on the 
previous versions; see also N1791 and N1792, with minutes of the last 
floating-point group meeting and agenda for the next).  Again, any 
comments are best sent direct to WG14.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: Draft C bindings for IEEE 754-2008 part 4 now available

2014-01-08 Thread Vincent Lefevre
On 2014-01-08 13:31:40 +, Joseph S. Myers wrote:
> I advise making such suggestions direct to WG14.  (I don't know if such 
> names should be reserved for correctly rounded complex arithmetic as well 
> - where ordinary complex multiplication and division are not expected to 
> be correctly rounded at present.)
> 
> (I'm currently chasing up possible issues with mail from some people not 
> getting through to the WG14 list - the only floating-point TS comments 
> I've seen there so far are mine and Paul Eggert's, so if anyone else 
> reading this discussion has sent comments on the drafts, please let me 
> know.)

OK, I've just sent comments to the reflector.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Re: Draft C bindings for IEEE 754-2008 part 4 now available

2014-01-08 Thread Joseph S. Myers
On Wed, 8 Jan 2014, Vincent Lefevre wrote:

> On 2014-01-07 16:45:49 +, Joseph S. Myers wrote:
> > Sure, such a correctly rounded function is useful just like correctly 
> > rounded versions of other functions.  The proposed C bindings reserve cr* 
> > names *only* for the specific functions listed in 9.2 where IEEE 754 
> > recommends correctly rounded functions, not for other existing ISO C 
> > functions (e.g. erf, tgamma) or functions added by the C bindings by 
> > analogy with other IEEE 754 functions (e.g. tanpi), but I think correctly 
> > rounded versions of other functions (with the same naming convention) 
> > could reasonably be added to glibc if anyone wishes to implement them.
> 
> New CR functions may be added in future revisions of IEEE 754, so
> that I think that cr* names should be reserved for all functions.

I advise making such suggestions direct to WG14.  (I don't know if such 
names should be reserved for correctly rounded complex arithmetic as well 
- where ordinary complex multiplication and division are not expected to 
be correctly rounded at present.)

(I'm currently chasing up possible issues with mail from some people not 
getting through to the WG14 list - the only floating-point TS comments 
I've seen there so far are mine and Paul Eggert's, so if anyone else 
reading this discussion has sent comments on the drafts, please let me 
know.)

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: Draft C bindings for IEEE 754-2008 part 4 now available

2014-01-08 Thread Vincent Lefevre
On 2014-01-07 16:45:49 +, Joseph S. Myers wrote:
> Sure, such a correctly rounded function is useful just like correctly 
> rounded versions of other functions.  The proposed C bindings reserve cr* 
> names *only* for the specific functions listed in 9.2 where IEEE 754 
> recommends correctly rounded functions, not for other existing ISO C 
> functions (e.g. erf, tgamma) or functions added by the C bindings by 
> analogy with other IEEE 754 functions (e.g. tanpi), but I think correctly 
> rounded versions of other functions (with the same naming convention) 
> could reasonably be added to glibc if anyone wishes to implement them.

New CR functions may be added in future revisions of IEEE 754, so
that I think that cr* names should be reserved for all functions.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Re: Draft C bindings for IEEE 754-2008 part 4 now available

2014-01-07 Thread Joseph S. Myers
On Tue, 7 Jan 2014, Vincent Lefevre wrote:

> On 2014-01-07 14:48:01 +, Joseph S. Myers wrote:
> > (Except that the IEEE 754 reduction operations - subclause 9.4 - return 
> > "an implementation-defined approximation".  But 9.2 is "Recommended 
> > correctly rounded functions", e.g. exp and sin, for which the strictly 
> > corresponding C functions are crexp and crsin.)
> 
> Some of the reduction operations may be standardized with the
> correct rounding requirement in the future IEEE 1788 standard
> on interval arithmetic (even though I think that such operations
> do not belong to IEEE 1788), if it passes. In any case, they
> should also have their own correctly rounded version.

Sure, such a correctly rounded function is useful just like correctly 
rounded versions of other functions.  The proposed C bindings reserve cr* 
names *only* for the specific functions listed in 9.2 where IEEE 754 
recommends correctly rounded functions, not for other existing ISO C 
functions (e.g. erf, tgamma) or functions added by the C bindings by 
analogy with other IEEE 754 functions (e.g. tanpi), but I think correctly 
rounded versions of other functions (with the same naming convention) 
could reasonably be added to glibc if anyone wishes to implement them.

(I'd like to see GCC and glibc get full support for C99/C11 Annexes F and 
G and the TS parts 1 and 4 at least, but given the amount of work involved 
have no current plans to work on this.)

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: Draft C bindings for IEEE 754-2008 part 4 now available

2014-01-07 Thread Vincent Lefevre
On 2014-01-07 16:18:48 +, Joseph S. Myers wrote:
> On Tue, 7 Jan 2014, Vincent Lefevre wrote:
> 
> > For some of them, this is proved. Here's a summary of the current
> > status:
> > 
> >   http://tamadiwiki.ens-lyon.fr/tamadiwiki/images/c/c1/Lefevre2013.pdf
> 
> Thanks for the details.  What's the current state of the art on the 
> asymptotic cost of the exhaustive searches?

The theoretical bound is O(N^(2/3+epsilon)), where N is the number
of inputs. In practice, for binary128 (N ~ 2^128), this is already
unfeasible.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Re: Draft C bindings for IEEE 754-2008 part 4 now available

2014-01-07 Thread Vincent Lefevre
On 2014-01-07 14:48:01 +, Joseph S. Myers wrote:
> (Except that the IEEE 754 reduction operations - subclause 9.4 - return 
> "an implementation-defined approximation".  But 9.2 is "Recommended 
> correctly rounded functions", e.g. exp and sin, for which the strictly 
> corresponding C functions are crexp and crsin.)

Some of the reduction operations may be standardized with the
correct rounding requirement in the future IEEE 1788 standard
on interval arithmetic (even though I think that such operations
do not belong to IEEE 1788), if it passes. In any case, they
should also have their own correctly rounded version.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Re: Draft C bindings for IEEE 754-2008 part 4 now available

2014-01-07 Thread Joseph S. Myers
On Tue, 7 Jan 2014, Vincent Lefevre wrote:

> For some of them, this is proved. Here's a summary of the current
> status:
> 
>   http://tamadiwiki.ens-lyon.fr/tamadiwiki/images/c/c1/Lefevre2013.pdf

Thanks for the details.  What's the current state of the art on the 
asymptotic cost of the exhaustive searches?

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: Draft C bindings for IEEE 754-2008 part 4 now available

2014-01-07 Thread Vincent Lefevre
On 2014-01-07 14:36:58 +, Joseph S. Myers wrote:
> (As far as I know, the state of the art on exhaustive searches for
> worst cases for correct rounding - as needed to implement correctly
> rounded transcendental functions with bounded resource use - does
> not make such searches feasible for IEEE binary128, which is a clear
> reason not to require such functions to be provided.)

Well, an implementation can still provide very accurate versions
(say, with a guaranteed 512 bits accuracy), and the functions will
be correctly rounded with a very high probability. In practice, the
proof of correct rounding can be obtained only with an exhaustive
search (well there is some hope to obtain a proof if the maximum
precision of the implementation is around several thousands bits).
The exhaustive search also allows one to optimize code even more.

On 2014-01-07 14:55:31 +, Andrew Haley wrote:
> On 01/07/2014 02:48 PM, Joseph S. Myers wrote:
> > On Tue, 7 Jan 2014, Joseph S. Myers wrote:
> > 
> >> The IEEE 754 operations are corrected rounded.  However, the C bindings 
> > 
> > (Except that the IEEE 754 reduction operations - subclause 9.4 - return 
> > "an implementation-defined approximation".  But 9.2 is "Recommended 
> > correctly rounded functions", e.g. exp and sin, for which the strictly 
> > corresponding C functions are crexp and crsin.)
> 
> Has anyone found a way to do it?  Even crlibm only provides routines
> that are probably correctly rounded.  Although I'll grant you that the
> probability of incorrect rounding is very low.

For some of them, this is proved. Here's a summary of the current
status:

  http://tamadiwiki.ens-lyon.fr/tamadiwiki/images/c/c1/Lefevre2013.pdf

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Re: Draft C bindings for IEEE 754-2008 part 4 now available

2014-01-07 Thread Andrew Haley
On 01/07/2014 02:48 PM, Joseph S. Myers wrote:
> On Tue, 7 Jan 2014, Joseph S. Myers wrote:
> 
>> The IEEE 754 operations are corrected rounded.  However, the C bindings 
> 
> (Except that the IEEE 754 reduction operations - subclause 9.4 - return 
> "an implementation-defined approximation".  But 9.2 is "Recommended 
> correctly rounded functions", e.g. exp and sin, for which the strictly 
> corresponding C functions are crexp and crsin.)

Has anyone found a way to do it?  Even crlibm only provides routines
that are probably correctly rounded.  Although I'll grant you that the
probability of incorrect rounding is very low.

Andrew.



Re: Draft C bindings for IEEE 754-2008 part 4 now available

2014-01-07 Thread Joseph S. Myers
On Tue, 7 Jan 2014, Joseph S. Myers wrote:

> The IEEE 754 operations are corrected rounded.  However, the C bindings 

(Except that the IEEE 754 reduction operations - subclause 9.4 - return 
"an implementation-defined approximation".  But 9.2 is "Recommended 
correctly rounded functions", e.g. exp and sin, for which the strictly 
corresponding C functions are crexp and crsin.)

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: Draft C bindings for IEEE 754-2008 part 4 now available

2014-01-07 Thread Joseph S. Myers
On Tue, 7 Jan 2014, Florian Weimer wrote:

> On 01/04/2014 07:21 PM, Joseph S. Myers wrote:
> 
> > FYI: a draft set of C bindings for additional floating-point functions
> > from IEEE 754-2008 are now available (draft TS 18661-4):
> 
> Is there an accurate summary of IEEE 754-2008 available online?

No.  It's available for purchase from IEEE, or through IEEE Xplore if you 
have a site subscription to that.  (ISO/IEC/IEEE 60559:2011 is just IEEE 
754-2008 with different cover pages / front matter.)

> I'm asking because IEEE 754 is widely quoted, but nobody really seems to know
> what's in it.  (It seems that some operations are allowed to be off by an ulp
> or more, for instance, which I find rather surprising.)

The IEEE 754 operations are corrected rounded.  However, the C bindings 
choose to provide most of the recommended operations from IEEE 754-2008 
subclause 9.2 only in versions with unspecified accuracy, and not in 
correctly rounded versions, with names being reserved for the correctly 
rounded versions but no requirement that those functions be provided.  (As 
far as I know, the state of the art on exhaustive searches for worst cases 
for correct rounding - as needed to implement correctly rounded 
transcendental functions with bounded resource use - does not make such 
searches feasible for IEEE binary128, which is a clear reason not to 
require such functions to be provided.)

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: Draft C bindings for IEEE 754-2008 part 4 now available

2014-01-07 Thread Florian Weimer

On 01/04/2014 07:21 PM, Joseph S. Myers wrote:


FYI: a draft set of C bindings for additional floating-point functions
from IEEE 754-2008 are now available (draft TS 18661-4):


Is there an accurate summary of IEEE 754-2008 available online?

I'm asking because IEEE 754 is widely quoted, but nobody really seems to 
know what's in it.  (It seems that some operations are allowed to be off 
by an ulp or more, for instance, which I find rather surprising.)


--
Florian Weimer / Red Hat Product Security Team