public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "krebbel1 at de dot ibm.com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug math/16427] ldbl-128 exp overflows to inf
Date: Mon, 13 Jan 2014 13:28:00 -0000	[thread overview]
Message-ID: <bug-16427-131-FnrSZfbgbg@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-16427-131@http.sourceware.org/bugzilla/>

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.


  parent reply	other threads:[~2014-01-13 13:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-10 10:22 [Bug libc/16427] New: test-ldouble and test-ildoubl fail on S/390 krebbel1 at de dot ibm.com
2014-01-10 14:04 ` [Bug libc/16427] " joseph at codesourcery dot com
2014-01-10 15:08 ` [Bug math/16427] ldbl-128 exp overflows to inf krebbel1 at de dot ibm.com
2014-01-10 17:47 ` joseph at codesourcery dot com
2014-01-13 13:28 ` krebbel1 at de dot ibm.com [this message]
2014-01-13 13:30 ` krebbel1 at de dot ibm.com
2014-01-13 14:32 ` krebbel1 at de dot ibm.com
2014-01-13 15:54 ` joseph at codesourcery dot com
2014-01-15  8:51 ` cvs-commit at gcc dot gnu.org
2014-02-25  8:18 ` krebbel1 at de dot ibm.com
2014-02-25  8:19 ` krebbel1 at de dot ibm.com
2014-06-13  9:05 ` fweimer at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-16427-131-FnrSZfbgbg@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).