This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/16427] ldbl-128 exp overflows to inf


https://sourceware.org/bugzilla/show_bug.cgi?id=16427

--- Comment #4 from Andreas Krebbel <krebbel1 at de dot ibm.com> ---
The code path in __ieee_expl reaches the statement:

return TWO16383*x;

The multiplication is performed using the mxbr hardware instruction dealing
with FPR register pairs.

At the end of the function the expected results were generated and can be
printed correctly:

=> 0x3fffdf6117a <__ieee754_expl+78>:   mxbr    %f8,%f1
(gdb) 
0x000003fffdf6117e      247         return TWO16383*x;
1: x/i $pc
=> 0x3fffdf6117e <__ieee754_expl+82>:   std     %f8,0(%r8)
(gdb) p printf ("%Le %La\n", &{$f8, $f10}, &{$f8, $f10})
1.189731e+4932 0x1.ffffffffffffffffffffffffffffp+16383

long double values are returned in memory, pointed to by r2:

=> 0x3fffdf611a0 <__ieee754_expl+116>:  lmg     %r8,%r15,320(%r15)
(gdb) x/4xw $r2
0x3ffffffef78:  0x7ffeffff      0xffffffff      0xffffffff      0xffffffff
(gdb) p printf ("%Le %La\n", $r2, $r2)
1.189731e+4932 0x1.ffffffffffffffffffffffffffffp+16383
$12 = 55

The code in k_standard.c:211 then seems to turn the value into "inf":

        case 206:
        /* exp(finite) overflow */
        exc.type = OVERFLOW;
        exc.name = type < 100 ? "exp" : (type < 200
                         ? "expf" : "expl");
        if (_LIB_VERSION == _SVID_)
          exc.retval = HUGE;
        else
          exc.retval = HUGE_VAL;
        if (_LIB_VERSION == _POSIX_)
          __set_errno (ERANGE);
        else if (!matherr(&exc)) {
            __set_errno (ERANGE);
        }
        break;

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]