Xref: utzoo comp.lang.c:11743 comp.std.c:247 sci.math:4357 Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!accelerator.eng.ohio-state.edu!kaa.eng.ohio-state.edu!rob From: rob@kaa.eng.ohio-state.edu (Rob Carriere) Newsgroups: comp.lang.c,comp.std.c,sci.math Subject: Re: Floating point puzzle Summary: Extended precision registers the culprit? Keywords: floating point representation Message-ID: <447@accelerator.eng.ohio-state.edu> Date: 7 Aug 88 21:13:25 GMT References: <3117@emory.uucp> Sender: news@accelerator.eng.ohio-state.edu Reply-To: rob@kaa.eng.ohio-state.edu (Rob Carriere) Organization: Ohio State Univ, College of Engineering Lines: 17 In article <3117@emory.uucp> riddle@emory.uucp (Larry Riddle) writes: > [ C program on Sun-4 gives strange single precision results, to wit, > the results look like mutilated doubles ] I don't *know*, but you might want to look into what your floating point hardware does. Most floating point hardware I know of, only implements IEEE to whatever extent was convenient. Specifically, many of these devices leave results hanging around in the (extended precision) floating registers if at all possible. This means that you may get more precision than you asked for, ie probably your results really are doubles, despite you asking for singles. This would also explain why you see truncated rather than rounded doubles: you are doing the truncation manually when you ask for the hex output. Note that this behaviour, while not IEEE, is ANSI C acceptable. Rob Carriere