Document: WG14 N1428
Submitter: Fred J. Tydeman (USA)
Submission Date: 2009-12-01
Subject: ilogb
Background: As a function that maps reals to reals, sqrt(-1.0) has no usefully definable result, and the operand is invalid, so is a domain error. In like vain, as a function that maps reals to integers, ilogb(0.0) has no usefully definable result, so it should be a domain error. In addition, IEEE-754-2008 requires ilogb(NaN or infinity or 0) to raise invalid.
Add to F.9.3.5 the ilogb functions a new bullet:
Proposal 1:
-- ilobg(x), for x being a NaN, infinity, or zero, is a domain error and raises the "invalid" floating-point exception.
Proposal 2:
-- ilobg(x) raises the "invalid" floating-point exception for x being a NaN, infinity, or zero.
Proposal 3:
For either case, add to that same paragraph: The return value is specified in 7.12.6.5.
Add to Raionale:
logb() was specified (in an appendix) in IEEE-754-1985. ilobg(x) was added to IEEE-754-2008, and both were moved to the main body and made into required functions. Since integer types do not have representations of NaN or infinity, ilogb(x) for x being a NaN, infinity, or zero, are required to raise invalid (as if those were a domain error).