Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!puffin!mrm From: mrm%puffin@Sun.COM (Marianne Mueller) Newsgroups: comp.lang.c Subject: Re: Playing with the bits of floats Summary: Check out cache Keywords: union types, caches Message-ID: <85735@sun.uucp> Date: 17 Jan 89 22:06:24 GMT References: <1825@dataio.Data-IO.COM> <1096@l.cc.purdue.edu> Sender: news@sun.uucp Reply-To: mrm@sun.UUCP (Marianne Mueller) Distribution: comp Organization: Sun Microsystems, Mountain View Lines: 18 Various people have been recommending things like > Define a union such as: > typedef union > { double d; > unsigned long u[2]; > } dblunion; > to let a programmer access/manipulate bits directly. You might want to make sure that your machine doesn't penalize you on caching. Some machines cache only floating point values, and opt not to cache things that have a union type. (I think it was the compiler that forced main memory loads/stores, not the hardware.) I once thought I was speeding up my program by using union types, but it turned out I slowed it down significantly!