delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/08/29/17:24:34

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3F4FC482.A71D96A1@phekda.freeserve.co.uk>
Date: Fri, 29 Aug 2003 22:24:18 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Arithmetic Exceptions in C99
References: <200308292046 DOT h7TKkAEJ012781 AT speedy DOT ludd DOT luth DOT se>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

ams AT ludd DOT luth DOT se wrote:
> 
> According to Kbwms AT aol DOT com:
> > > >>>The math functions shouldn't raise SIGFPE unless something goes
> > > >>>wrong.
> > > >By "something goes wrong", do you mean "an unreasonable argument was
> > > >passed", or do you mean "a bug in the math functions caused a problem"?
> > >
> > > I mean an unreasonable argument was passed (if passing arguments that
> > > causes overflow or underflow or ... is unreasonable).
> > >
> >
> > In this case, the affected math function sets errno to ERANGE and
> > (possibly) raises an appropriate exception.  In no case should a math
> > function issue SIGFPE.
> 
> What signal should it generate if not SIGFPE?
> 
> For me raise an exception == generate a signal. Both Eli and you
> seems to say that raising an exception is something else than
> generating a signal.
> 
> Can somebody explain this to me?

I think you're confusing the word "exception" in maths terms with "exceptions"
represented by SIG*. In the case of the maths "exceptions" I think the
exception is signalled by setting a bit in some exception register somewhere.
See section 7.6.1 (FE_* constants like FE_INVALID) and section 7.6.2 of the
C99 standard.

(That's from a quick read of the sections mentioned. I may be wrong.)

Bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019