Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!panews.awdpa.ibm.com!slo.awdpa.ibm.com!jsalter From: jsalter@slo.awdpa.ibm.com Newsgroups: comp.arch Subject: Denorms, Infs, and NaNs (was: Alignment on RS/6000) Message-ID: <1990Nov29.191342.669@panews> Date: 29 Nov 90 19:13:42 GMT References: <897@sibyl.eleceng.ua.OZ> <13342@encore.Encore.COM> <46866@apple.Apple.COM> Sender: news@panews (news id) Reply-To: jsalter@slo.awdpa.ibm.com (Jim Salter) Organization: IBM AWD Development, Palo Alto Lines: 45 In article <46866@apple.Apple.COM> baum@apple.UUCP (Allen Baum) writes: >[] >>In article <13342@encore.Encore.COM> jkenton@pinocchio.encore.com (Jeff Kenton) writes: Re: returning NaNs, Infs and Denorms is probably because of a bug and should just core dump... >>This is probably true for NaN's and Infinities, but Denorms occur all the >>time. printf() often generates them when dealing with floats, and the >>math library routines do also. It isn't true for NaNs and Infs, either. NaNs and Infs return valuable information if you know what to look for (i.e. you know IEEE [78]54; Sec. 3.1.4.2 - 80387 Programmer's Ref. Manual [1987] - Intel). >I still don't understand the assertion that Denorms occur all the time. >Just because printf() knows how to handle them doesn't mean that it >happens very often. Likewise the math routines. What is your evidence >than it happens "often" (whatever that means- 1% is incredibly often by >my definition in this case) Many of the conversion routines (str -> fp, fp -> str) also must handle Denorms, Infs and NaNs. The routines would run much faster if they didn't have to check for all these special cases. >If you are saying that printf() and the math libraries can produce intermediate >results internally which are denorm, even if the inputs and outputs aren't, >would it be possible to re-write them to avoid it (given the impetus that >perhaps denorms are really slow)? No. Routines can either produce intermediate *or* end-results which are denorms, whether the input is denormal or not (see Sec. 7.4 IEEE 754). The i387 attempts to normalize most values, but sometimes can't. And sometimes it doesn't understand denorms correctly, either, but that's another matter... It would make life much easier on math libraries and conversion routines if we didn't have to account for them, but we do. > baum@apple.com (408)974-3385 >{decwrl,hplabs}!amdahl!apple!baum jim/jsalter IBM AWD, Palo Alto T465/(415)855-4427 VNET: JSALTER at AUSVMQ Internet: jsalter@slo.awdpa.ibm.com UUCP: ..!uunet!ibmsupt!jsalter PS/2 it, or DIE! :-) The ramblings above have nothing to do with Big Blue.