Path: utzoo!attcan!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!sun-barr!sun!gammara!khb From: khb%gammara@Sun.COM (gammara) Newsgroups: comp.arch Subject: Re: IEEE 754 vs. 854 (floating-point arithmetic) Message-ID: <106528@sun.Eng.Sun.COM> Date: 24 May 89 18:20:11 GMT References: <18721@cup.portal.com> Sender: news@sun.Eng.Sun.COM Reply-To: khb@sun.UUCP (gammara) Organization: Sun Microsystems, Mountain View Lines: 36 In article <18721@cup.portal.com> mmm@cup.portal.com (Mark Robert Thorson) writes: > Tim did a good job of clarifying the differences between 754 and 854. >Related question: How does your programming environment handle IEEE weirdness? >What happens when I scale a number, and the number range craps out? Does a >trap get invoked? If so, is the trap in the user program or the OS? Does >anybody support a programming environment in which the application program >can make use of the fancy bits of the IEEE standard? With SunOS and compilers (available from Phoneix, Lachman and Sun) ieee arithmetic is handled "naturally". If you scale a number and underflow occurs, your result is a denormalized number (presuming defaults haven't been tampered with :>). On machines where the hw does this, it does it (viz. 386i, 68K w/o FPA). On machines where denormalized numbers are not handled by the hardware, the computation takes place via a OS trap (SPARC, 3/FPA, 3/FPA+). Overflow results in +- Inf as mandated by your computation. Library routines are provided to check for NaN, Inf, changing the rounding mode, toggling underflow handling (one can have the hw to flush to zero instead of gradual underflow), and setting up user exception handlers. The Floating Point Programmers guide, its addendum, the mathlibrary and f77 man pages explain how to use ieee arithmetic features in user code. Keith H. Bierman |*My thoughts are my own. Only my work belongs to Sun* It's Not My Fault | Marketing Technical Specialist ! kbierman@sun.com I Voted for Bill & | Languages and Performance Tools. Opus (* strange as it may seem, I do more engineering now *)