Xref: utzoo comp.lang.fortran:5348 comp.unix.aix:5015 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!sunic!news.funet.fi!funic!santra!santra!jkorpela From: jkorpela@vipunen.hut.fi (Jukka Korpela) Newsgroups: comp.lang.fortran,comp.unix.aix Subject: Re: HELP! Need Decent RS6000 Fortran Compiler! Message-ID: Date: 10 May 91 08:04:48 GMT References: <1991May3.211427.19026@pensoft.uucp> <1991May04.200345.26241@turnkey.tcc.com> <1991May9.015512.27264@murdoch.acc.Virginia.EDU> Sender: news@santra.uucp (Cnews - USENET news system) Organization: Helsinki University of Technology, Finland Lines: 25 In-Reply-To: gl8f@astsun.astro.Virginia.EDU's message of 9 May 91 01:55:12 GMT This is a brief summary of what I've found so far (thnx to all who sent me mail 'bout the problems) about arithmetics on RS/6000: - the default handling of almost all arithmetic errors (I guess integer divide by zero is the only exception - it generates core dump...) is to ignore them; but floating point errors do behave in the IEEE way, and a numeric variable who's value is infinity or NaN is printed out as "INF" or "NaNQ" or something like that - peculiarly, if you want to test within a program whether the value of X is NaN, X.NE.X seems to be the (undocumented) way; there are probably ways of detecting infinities as well - using the (documented, but poorly documented) routines FPGETS and FPSETS you can detect if floating-point errors have occurred - but you probably can't really trap them; even in C, you can't use the standardized tools; I tried to trap SIGFPE and the result is that a) 1.0/0.0 doesn't generate a trap, it simply produces INF, b) if I call fp_enable_all, 1.0/0.0 still doesn't generate a trap, but it produces 1.0 !!! - errors in math routines (well, actually, more or less invalid args to them, like SQRT(-1.0) or EXP(1E30)) do not necessarily (usually?) set FPE flags on (understandable), so you can't use FPGETS to see if they; you CAN use matherr, but it's designed to be C callable, so you need a simple interface routine I'm not happy with the situation, but at least I can tell our users how they can (and should!) insert a small piece of code to make their program report floating-point errors ***somehow***.