Path: utzoo!attcan!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpcc01!hpbbn!hpbbrd!hpfcmdd!hpfcso!hplisa!hplvli!boyne From: boyne@hplvli.HP.COM (Art Boyne) Newsgroups: comp.std.c Subject: Re: Re: IEEE FP (was: Questions about NCEG) Message-ID: <4000002@hplvli.HP.COM> Date: 29 May 90 15:02:38 GMT References: <415@mtndew.UUCP> Organization: Loveland Inst. Div Lines: 22 richard@pantor.UUCP (Richard Sargent) writes: >> People want hex float so they can represent 7/4096, say, without >> worrying about flipping a digit and making hash. >I don't get it. Why would you code some indecipherable >'magic' fraction rather than just simply declare: > float fract = 7.0/4096.0; >and let the optimizer/compiler turn that into the correct >constant? Because algorithms to calculate trigonometric, hyperbolic, etc., functions require *exact* values down to the LSB for maximum accuracy. I have seen experimentation done with the LSB as part of efforts to improve accuracy (increase the LSB of this constant, decrease it on this other constant). It is easier, and you are more assured of getting the exact value, if you simply specify the value in hex rather than writing 1.708984374999999E-4. Look into articles on numerical analysis and computation of transcendental functions to learn of the need for exact values. Art Boyne, boyne@hplvla.hp.com