Document: WG14 N1630


Math library recommendations


Submitter: Fred J. Tydeman (USA)
Submission Date: 2012-9-1
Subject:Math library recommendations

Most C implementations run on hardware that uses IEEE-754 floating-point. However, only a few implementations claim conformance to Annex F. Therefore, there are many implementations that have no guidance as to what should happen with the math functions for things other than normalized floating-point numbers. This document has suggestions, done as recommended practice, for what should and should not happen for quiet NaNs, infinities, subnormal numbers, negative zero and a few specific error cases.

Also, there are a few places where the main body of the standard gives the implementor choices (not related to IEEE-754) and this document picks the recommended choice.

In addition, there are a few places where Annex F gives the implementor choices and this document picks the recommended choice.

This is not a repeat of Annex F, as annex F talks about floating-point exceptions (and not domain, range, or pole errors).

If and when support for signaling NaNs is added to C, this can be updated.

Add after 7.12.1 paragraph 2 (domain errors):

Recommended practice

The implementation-defined value should be a quiet NaN.

Add after 7.12.1 paragraph 3 (pole errors):

Recommended practice

The implementation-defined value should be an infinity with the correct sign.

Add Recommended Practice for each specific function in 7.12.* as follows: