Floating exception(coredump) on HPUX 11.23 - HP UX

This is a discussion on Floating exception(coredump) on HPUX 11.23 - HP UX ; Hi, The below program coredumps on HPUX 11.23 but works fine on HPUX 11.11. What could be the possible cause ? ================================================== ====== #include #include #include int main() { char *ss=NULL; char str[]="1.2345E+999"; double vTmpDbl = strtod(str, &ss); long long ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Floating exception(coredump) on HPUX 11.23

  1. Floating exception(coredump) on HPUX 11.23

    Hi,

    The below program coredumps on HPUX 11.23 but works fine on HPUX
    11.11. What could be the possible cause ?
    ================================================== ======

    #include
    #include
    #include

    int main()
    {
    char *ss=NULL;
    char str[]="1.2345E+999";
    double vTmpDbl = strtod(str, &ss);

    long long sbig;
    unsigned long long ubig;
    printf("\n hello world\n");

    sbig=(long long )ceil(vTmpDbl);
    ubig=(unsigned long long )ceil(vTmpDbl);

    printf("\n sbig= %ld, ubig = %lu\n", sbig, ubig);
    printf("\n ubig = %lu\n", ubig);

    printf("\n happy world\n");

    return 0;
    }

  2. Re: Floating exception(coredump) on HPUX 11.23

    mukesh wrote:
    > The below program coredumps on HP-UX 11.23 but works fine on HP-UX
    > 11.11. What could be the possible cause?


    Your numbers are too large for a long long what do you expect?
    This works fine on IPF, where it is all done in hardware.

    > sbig=(long long)ceil(vTmpDbl);
    > ubig=(unsigned long long)ceil(vTmpDbl);


    The first is done in hardware on PA. The second is done by calling the
    quad lib. These had bugs where they don't look at the state of the
    traps enable bit and always give SIGFPE. I helped them fix some of
    those functions. And then again when we found some more.
    CR JAGaf00095, CR JAGaf99053, CR JAGag07464

    Yours in _U_Qfcnvfxt_quad_to_quad doesn't look like it was fixed until
    the last one, in 11.31.

    This fails for me on 11.11 in 64 bit mode, since it probably depends on
    the compiler and libc but not on the OS.
    (It doesn't fail in 32 bit mode, unless you use +DD32.)

    > printf("\n sbig= %ld, ubig = %lu\n", sbig, ubig);
    > printf("\n ubig = %lu\n", ubig);


    These formats are all broken. You should have %lld and %llu or %llx.

+ Reply to Thread