Path: utzoo!attcan!uunet!lll-winken!ames!husc6!bloom-beacon!gatech!emory!km From: km@emory.uucp (Ken Mandelberg) Newsgroups: comp.unix.aux Subject: Re: Printf Core Dumps on A/UX Message-ID: <3570@emory.uucp> Date: 7 Jan 89 14:40:03 GMT References: <3568@emory.uucp> <8686@alice.UUCP> Reply-To: km@emory.UUCP (Ken Mandelberg) Organization: Emory University Lines: 50 In article <8686@alice.UUCP> debra@alice.UUCP () writes: >In article <3568@emory.uucp> km@emory.uucp (Ken Mandelberg) writes: >}I consider this a bug: >} >}The printf on A/UX will core dump with a floating point >}exception on extreme data. For example: >} >} printf("%g\n", 0x7fffffff); >} >}will core dump on A/UX. On our BSD and other USG systems, this >}prints "NaN", or some appropriate value (depending on the type >}of internal floating point format). > >I don't consider this a bug. %g expects a double, i.e. 64 bits and >you only give it an int, i.e. 32 bits. > >But maybe you have other examples... > >Paul. >-- >------------------------------------------------------ >|debra@research.att.com | uunet!research!debra | >------------------------------------------------------ I tried to submit this as compactly as possible. Note that the core dump was a floating point exception not a bus error, so it does show that printf can't handle some exceptional data. However, here is another version of the test program which gets the same exception on A/UX (and not the other Unix systems): main () { union { int hex[2]; double d; } data; data.hex[0]=0x7fffffff; data.hex[1]=0xffffffff; printf("%g\n", data.d); } -- Ken Mandelberg | km@mathcs.emory.edu PREFERRED Emory University | {decvax,gatech}!emory!km UUCP Dept of Math and CS | km@emory.bitnet NON-DOMAIN BITNET Atlanta, GA 30322 | Phone: (404) 727-7963