delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/04/13:30:32

From: Waldemar Schultz <schultz AT ma DOT tum DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Floating point exception
Date: Tue, 04 Jul 2000 19:10:56 +0200
Organization: [posted via] Leibniz-Rechenzentrum, Muenchen (Germany)
Lines: 42
Message-ID: <39621AA0.ED96DBE0@ma.tum.de>
References: <39608EF6 DOT FC0856D1 AT ma DOT tum DOT de> <200007031820 DOT VAA11428 AT mailgw1 DOT netvision DOT net DOT il> <3961E7C0 DOT 178AC0B6 AT ma DOT tum DOT de> <200007041511 DOT SAA04094 AT alpha DOT netvision DOT net DOT il>
NNTP-Posting-Host: pcritter10.mathematik.tu-muenchen.de
Mime-Version: 1.0
X-Trace: wsc10.lrz-muenchen.de 962730708 12908 131.159.69.74 (4 Jul 2000 17:11:48 GMT)
X-Complaints-To: news AT lrz-muenchen DOT de
NNTP-Posting-Date: 4 Jul 2000 17:11:48 GMT
X-Mailer: Mozilla 4.73 [de]C-CCK-MCD DT (Win98; U)
X-Accept-Language: de,en,en-US
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii schrieb:
> > if I don't use FPE
> >   double a=0;
> >   double b=1;
> >   double c=b/a;
> >   double d=a*c;
> >   printf("%g %g\n",c,d);
> > just prints 'Inf NaN'
> 
> Even if you unmask numerical exceptions in the FPU?  What about the
> FPU status word--does it have the corresponding exception bits set?

if I call the sigfpe() function I posted before, it behaves much like
how I intended: It throws the SIGABRT telling me [DIVBYZERO] or [INVALID].
The only odd thing is that I have to call symify manually. And of course
the fact tat I DO USE exceptions in that case.(as you discussed before/below) 

> But you could place such checkpoints in strategic places and zero in
> on the problem.  (IMHO, you will want to leave these safeguards in the
> production code anyway, whereas FP exceptions generally cannot remain
> unmasked beyond the debugging period.)

of course, I agree.
My actual intent is to use it (mainly) in the development phase.

> It's the exception itself, long before it gets converted into SIGFPE.
> (To do this, DJGPP startup code installs a handler for Int 75h in
> protected mode, and when the interrupt hits, it invalidates the DS
> selector, exactly like the keyboard handler does with Ctrl-C.)
> 
> >   print_symified_traceback(...); // anyone did that before ???
> 
> Yes.  See the docs for the function __djgpp_traceback_exit.  However,
> SIGABRT is not your problem, so this won't help you.

Thanks for clarification.
a __djgpp_symified_traceback_exit() would be handy though :-)

-- 
 Gruss Waldemar Schultz.
 Technische Universität München, Zentrum Mathematik M1, D 80290 München
 Tel: +49 (0)89 2892 8226        FAX: +49 (0)89 2892 8228

- Raw text -


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