Submitter: Fred J. Tydeman (USA)
Submission Date: 2012-1-11
Source: WG 14
Reference Document: N1595
Version: 1.0
Date: February 2012
Subject: ilogb
inconsistent with
lrint
, lround
For the case of converting a large finite value to an integer value, lrint and lround have one set of requirements, while ilogb has another set. This is inconsistent.
Both 7.12.9.5 The lrint and llrint functions and 7.12.9.7 The lround and llround functions have:
If the rounded value is outside the range of the return type, the numeric result is unspecified and a domain error or range error may occur.
While 7.12.6.5 The ilogb functions has:
If the correct value is outside the range of the return type, the numeric result is unspecified.
I believe that the following changes to C11 should be done.
Change to: If the correct value is outside the range of the return type, the numeric result is unspecified and a domain error or range error may occur.
Committee discussion
- Some believe the rationale presented as a reason for doing this is not a valid rationale for the change.
Proposed Technical Corrigendum
In 7.12.6.5 paragraph 2, change the last sentence to:If the correct value is outside the range of the return type, the numeric result is unspecified and a domain error or range error may occur.