mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kumar Gala <galak@kernel.crashing.org>
To: David Miller <davem@davemloft.net>
Cc: joseph@codesourcery.com, linux-kernel@vger.kernel.org,
	libc-alpha@sourceware.org
Subject: Re: math-emu issue with fp divide
Date: Fri, 27 Jun 2008 09:15:40 -0500	[thread overview]
Message-ID: <F02EB8BE-6780-4C75-ABB9-7F2397457374@kernel.crashing.org> (raw)
In-Reply-To: <20080612.212457.01943346.davem@davemloft.net>


On Jun 12, 2008, at 11:24 PM, David Miller wrote:

> From: Kumar Gala <galak@kernel.crashing.org>
> Date: Thu, 5 Jun 2008 08:38:44 -0500 (CDT)
>
>> Now that I'm digging into this a bit I'm thinking my issue has to  
>> do with
>> the fix you put in place from back in Aug 2007 (commit
>> 405849610fd96b4f34cd1875c4c033228fea6c0f):
>>
>> [MATH-EMU]: Fix underflow exception reporting.
>>
>>    2) we ended up rounding back up to normal (this is the case where
>>       we set the exponent to 1 and set the fraction to zero), this
>>       should set inexact too
>> ...
>>
>>    Another example, "0x0.0000000000001p-1022 / 16.0", should signal  
>> both
>>    inexact and underflow.  The cpu implementations and ieee1754
>>    literature is very clear about this.  This is case #2 above.
>>
>> I'm not clear from your commit comment on what actual number
>> 0x0.0....01p-1022 is?
>
> I haven't been able to look closely at this yet but I think I
> happened to stumble over the test case that lead me to that
> changeset you are referencing here.
>
> The "actual number" is exactly as listed "0x0.0000000000001p-1022",
> I don't know what's so confusing about it :-)))
>
> I think this was distilled by Jakub Jelinek from some glibc test case.
>
> #include <float.h>
> #include <fenv.h>
> #include <stdio.h>
>
> volatile double d = DBL_MIN;
> volatile double e = 0x0.0000000000001p-1022;
> volatile double f = 16.0;
> int
> main (void)
> {
>  printf ("%x\n", fetestexcept (FE_UNDERFLOW));
>  d /= f;
>  printf ("%x\n", fetestexcept (FE_UNDERFLOW));
>  e /= f;
>  printf ("%x\n", fetestexcept (FE_UNDERFLOW));
>  return 0;
> }

I tested this on PPC HW fp and kern emu w/my patch and get the same  
results:

0
0
8000000

(8000000 is underflow in the PPC FP status register)

- k

  parent reply	other threads:[~2008-06-27 14:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-04 20:38 Kumar Gala
2008-06-04 21:37 ` David Miller
2008-06-04 21:42 ` Joseph S. Myers
2008-06-04 21:49   ` David Miller
2008-06-05 13:38     ` Kumar Gala
2008-06-13  4:24       ` David Miller
2008-06-13 15:49         ` Kumar Gala
2008-06-27 13:48         ` Kumar Gala
2008-06-27 22:54           ` David Miller
2008-06-27 14:15         ` Kumar Gala [this message]
2008-10-22  5:15           ` David Miller

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=F02EB8BE-6780-4C75-ABB9-7F2397457374@kernel.crashing.org \
    --to=galak@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --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®