IBM Support

LI78260: INCORRECT RETURN FROM FLOATING POINT LITERALS

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The test case below shows a problem with the way xlc/xlC
    compiler parses a literal floating point value, namely 5e125,
    which sscanf handles properly.
    
    ===== TESTCASE:
    $cat test.c
    
    #include <stdio.h>
    int main()
    {
        volatile double d1 = 5e125;
        volatile double d2;
        volatile unsigned char *p1 = (volatile unsigned char *)&d1;
        volatile unsigned char *p2 = (volatile unsigned char *)&d2;
        sscanf("5e125", "%lf", &d2);
    
        printf("literal 5e125: %.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x\n",
    p1[0],p1[1],p1[2],p1[3],p1[4],p1[5],p1[6],p1[7]);
        printf("sscanf  5e125: %.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x\n",
    p2[0],p2[1],p2[2],p2[3],p2[4],p2[5],p2[6],p2[7]);
        printf("literal 5e125: %a\n", d1);
        printf("sscanf  5e125: %a\n", d2);
    }
    
    ===== ACTUAL OUTPUT:
    literal 5e125: 5a07a2ecc414a040
    sscanf  5e125: 5a07a2ecc414a03f
    literal 5e125: 0x1.7a2ecc414a04p+417
    sscanf  5e125: 0x1.7a2ecc414a03fp+417
    
    ===== EXPECTED OUTPUT:
    literal 5e125: 5a07a2ecc414a03f
    sscanf  5e125: 5a07a2ecc414a03f
    literal 5e125: 0x1.7a2ecc414a03fp+417
    sscanf  5e125: 0x1.7a2ecc414a03fp+417
    
    (d1 and d2 outputs should be the same)
    

Local fix

  • Use sscanf to assign the floating literal value instead
    

Problem summary

  • PROBLEM DESCRIPTION: The parsing of specific floating point
    values suffers very small error (1 ULP).
    
    USERS AFFECTED: Anyone using floating point literals in all
    instances of xlC may suffer from this defect, though the number
    of numbers affected would be minimal
    

Problem conclusion

  • Issue was resolved via removing an extraneous (unneeded)
    rounding. It is now fixed.
    Appply applicable PTF.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI78260

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5725C7300

  • Reported release

    D10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2014-10-30

  • Closed date

    2014-10-30

  • Last modified date

    2014-10-30

  • APAR is sysrouted FROM one or more of the following:

    IV56267

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5725C7300

Applicable component levels

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSXVZZ","label":"XL C\/C++ for Linux"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"13.1","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
17 October 2021