mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: schwidefsky@de.ibm.com
To: linux-kernel@vger.kernel.org
Subject: bug in generic math-emu
Date: Mon, 19 Feb 2001 20:18:02 +0100	[thread overview]
Message-ID: <C12569F8.006A2C9E.00@d12mta07.de.ibm.com> (raw)



Hi,
I found a bug in the generic floating point emulation code. The glibc
math testcases showed errors for the nearbyint(0.5) test. The problem
is in the _FP_FRAC_SRS_2 macro. The expression to find out if some 1
bits have been shifted out is wrong. Try the _FP_FRAC_SRS_2 macro
with the following parameters: X_f1 = 0x00800000, X_f0 = 0x00000000,
N = 53, sz = 56. It comes back with 0x0000000000000005 instead of
0x0000000000000004. Now you can do the math ;-)
With the following patch test-float and test-double (both from glibc)
now run without errors on a S/390 without IEEE fpu.

diff -u -r1.1.1.1 op-2.h
--- include/math-emu/op-2.h   2000/02/04 13:53:47  1.1.1.1
+++ include/math-emu/op-2.h   2001/02/19 18:53:41
@@ -79,7 +79,7 @@
     else                                     \
       {                                           \
     X##_f0 = (X##_f1 >> ((N) - _FP_W_TYPE_SIZE) |                \
-           (((X##_f1 << (sz - (N))) | X##_f0) != 0));       \
+           (((X##_f1 << (2*_FP_W_TYPE_SIZE - (N))) | X##_f0) != 0)); \
     X##_f1 = 0;                                   \
       }                                           \
   } while (0)


blue skies,
   Martin

Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH
Schönaicherstr. 220, D-71032 Böblingen, Telefon: 49 - (0)7031 - 16-2247
E-Mail: schwidefsky@de.ibm.com



                 reply	other threads:[~2001-02-19 19:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=C12569F8.006A2C9E.00@d12mta07.de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®