HomeAbout Us A-Z IndexSearch * Contact Us Register LoginPress Shop

The Open Brand -- Problem Reporting and Interpretations System


Problem Report 1614 Details

Help Show help | Quick Search | Submit a Test Suite Support Request | Click here to view your privileges

This page provides all information on Problem Report 1614.


Report 1614 Actions


    Problem Report Number 1614
    Submitter's Classification Specification problem
    State Resolved
    Resolution Permanent Interpretation (PIN)
    Problem Resolution ID PIN.X.0171
    Raised 1996-10-29 08:00
    Updated 2003-03-13 08:00
    Published 1996-11-12 08:00
    Product Standard Internationalised System Calls and Libraries Extended (UNIX 95)
    Certification Program The Open Brand certification program
    Test Suite VSU version 4.1.0
    Test Identification CAPI.os/maths/ilogb 2 3
    Specification System Interfaces and Libraries Issue 4 Version 2
    Location in Spec See Problem Text
    Problem Summary PIN4U.00037 This IR recommends that the specification be changed.
    Problem Text
    We are requesting the following interpretation based on what we believe is an
    error in the specification.

    Historical ilogb() behavior is for ilogb(0) = -MAXINT and ilogb(NaN) = MAXINT.
    In our implementation, MAXINT is the same as INT_MAX. The behavior as specified
    by X/Open and as implemented in our system (which is based on historic implementa-
    tion) follows:

    X/Open: ilogb(0) = INT_MIN, ilogb(NaN) = INT_MIN, ilogb(+/-Inf) = INT_MAX
    Ours: ilogb(0) = -INT_MAX, ilogb(NaN) = INT_MAX, ilogb(+/-Inf) = INT_MAX

    The basis of this waiver request is as follows:

    1) When there is no definitive value as to what ilogb(NaN) should return, it is
    orders of magnitude more natural to lump together NaN and +/-Inf than to lump
    together 0 with NaN. For one, the IEEE 754 representation of both NaN and
    +/-Inf have the exact same maximal biased exponent.

    In our implementation, if you get INT_MAX, you know finite(x) is false or 0;
    if you get -INT_MAX, you know iszero(x) is true or 1.

    In X/Open's specification, if you get INT_MIN, x could be zero, yet it could
    also be NaN. This is not very useful.

    2) Since it is natural to define ilogb(+/-Inf) as INT_MAX, ilogb(NaN) should also
    return INT_MAX because as stated above, +/-Inf and NaN both have the same maximal
    biased exponent in IEEE 754 representation.

    3) -INT_MAX is a much more portable value than INT_MIN. On machines with 1's
    complement integer arithmetic, INT_MIN = -INT_MAX; the value of INT_MIN on
    machines with 2's complement integer arithmetic cannot even be represented on
    machines with 1's complement integer arithmetic.

    -INT_MAX is identical under both types of integer arithmetic as long as the
    number of bits is the same. This is a much more desirable trait than INT_MIN.

    4) Without providing any benefit of technical superiority, the X/Open specification
    breaks historic implementations.
    Test Output
    TEST CASE: ilogb

    TEST PURPOSE #2
    A call to int ilogb(double x) when x is 0 shall return
    INT_MIN.
    TEST: ilogb(0) returns INT_MIN
    ERROR: ilogb(0) returned incorrect value
    Expected INT_MIN
    Received -2147483647
    2 FAIL

    TEST PURPOSE #3
    If the implementation supports NaN
    A call to int ilogb(double x) when x is NaN shall
    return INT_MIN.
    PREP: Check for NaN support
    TEST: ilogb(NaN) returns INT_MIN
    ERROR: ilogb(NaN) returned incorrect value
    Expected INT_MIN
    Received 2.14748e+09
    3 FAIL

    Review Information

    Review Type TSMA Review
    Start Date null
    Completed null
    Status Complete
    Review Recommendation No Resolution Given
    Review Response
    We recommend this request be refused.

    While the submitter's argument may have merit, this is not a grey
    area in the spec. The specification is clear and the test
    is consistent with the spec wording.

    The role of IRs are to interpret, but not to modify the specification.
    The base resolution process is provided for that purpose.

    Review Type Expert Group Review
    Start Date null
    Completed null
    Status Complete
    Review Resolution No Resolution Given
    Review Conclusion
    This is indeed a grey area. The return value is in conflict with the
    description, and also inconsistent with the definition of logb.
    A PIN should be granted.
    A future revision of the specification will correct the return
    values as follows:

    if X == 0 return -INT_MAX
    if X == NaN or +/-infinity, return INT_MAX


    Review Type SA Review
    Start Date null
    Completed null
    Status Complete
    Review Resolution Permanent Interpretation (PIN)
    Review Conclusion
    A Permanent Interpretation is granted.

    Problem Reporting System Options:

     

    Back   


Contact the Certification Authority