linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Gabriel Paubert <paubert@iram.es>
To: Wolfgang Grandegger <wg@grandegger.com>
Cc: linuxppc-dev <Linuxppc-dev@ozlabs.org>
Subject: Re: Floating point exceptions with MPC5200
Date: Mon, 19 Jan 2009 11:03:47 +0100	[thread overview]
Message-ID: <20090119100347.GA27655@iram.es> (raw)
In-Reply-To: <497448F4.7080806@grandegger.com>

On Mon, Jan 19, 2009 at 10:33:40AM +0100, Wolfgang Grandegger wrote:
> Hello,
> 
> I want to provoke a "floating point exception" by doing a division by 0.
> The expection does come as expected on my x86 PC:
> 
>   $ ./divby0
>   Floating point exception
> 
> but not on my MPC5200 board. Any idea why? I think the processor can
> handle all floating-point exceptions. I'm using Linux 2.6.28 and the
> ELDK v4.2.

No, the PPC continue happily after performing an _integer_ division by zero.
It is in the architecture specification AFAIR and allowed by C and other 
language definitions. 

This is not exactly a floating point exception per se: it has a different
vector on x86, that the Linux kernel remaps to a floating point exception,
although numeric exception would be more correct. PPC implements all 
standard IEEE754 floating point exceptions (you have to enable them 
with fesetenv() or something equivalent, but it's the same on all 
architectures).

Even the C++ headers acknowledge this, see for example: 
/usr/include/c++/4.3/powerpc-linux-gnu/bits/cpu_defines.h
(or a similar file on your system, note that older versions
of GCC got it wrong, but I can't remember when it was fixed).

	Gabriel

  parent reply	other threads:[~2009-01-19 10:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-19  9:33 Floating point exceptions with MPC5200 Wolfgang Grandegger
2009-01-19  9:50 ` Andreas Schwab
2009-01-19  9:58   ` Wolfgang Grandegger
2009-01-19 10:03 ` Gabriel Paubert [this message]
2009-01-19 12:10   ` Wolfgang Grandegger

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=20090119100347.GA27655@iram.es \
    --to=paubert@iram.es \
    --cc=Linuxppc-dev@ozlabs.org \
    --cc=wg@grandegger.com \
    /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 NNTP newsgroup(s).