| delorie.com/archives/browse.cgi | search |
| 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 15:33:52 +0200 |
| Organization: | [posted via] Leibniz-Rechenzentrum, Muenchen (Germany) |
| Lines: | 42 |
| Message-ID: | <3961E7C0.178AC0B6@ma.tum.de> |
| References: | <39608EF6 DOT FC0856D1 AT ma DOT tum DOT de> <200007031820 DOT VAA11428 AT mailgw1 DOT netvision DOT net DOT il> |
| NNTP-Posting-Host: | pcritter10.mathematik.tu-muenchen.de |
| Mime-Version: | 1.0 |
| X-Trace: | wsc10.lrz-muenchen.de 962717684 2861 131.159.69.74 (4 Jul 2000 13:34:44 GMT) |
| X-Complaints-To: | news AT lrz-muenchen DOT de |
| NNTP-Posting-Date: | 4 Jul 2000 13:34:44 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:
>
> Isn't it better to link against libm.a and write a custom version of
> `matherr'? See "info libc alpha matherr" for more information.
matherr usage of course works fine with math FUNCTIONS.
> > The second problem is: is it possible to throw an exception when a number
> > becomes NaN (NOTaNUMBER) ir Inf (Infinite) ?
>
> You will have to give more details about how exactly do these come
> into existence. Does it happen in an FP instruction such as division
> or multiplication? Does it happen in a function? The answer depends
> on these details.
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', so if I don't have the printf, I wouldn't be notified
by matherr of course. Because of the huge amount of math operations in the whole
program it isn't feaseable to add something like 'if(fabs(a)<EPS) ...'
ir 'if(!finite(c)) ...' before any aritmetic operation.
so forehand I think I will use a combination of both and try to avoid
an environment where FPE is supposed to crash.
Or anyone a still better idea?
BTW: is it FPE or raise(SIGABRT) which causes the problems?
so if it were raise(SIGABRT) I would be fine if I could do somthing like
print_symified_traceback(...); // anyone did that before ???
exit(1);
instead.
Many thanks for your immediate help
--
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |