From: Waldemar Schultz 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 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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)