Path: utzoo!attcan!uunet!lll-winken!lll-ncis!helios.ee.lbl.gov!nntp.ee.lbl.gov!max From: max@george.lbl.gov (Max Rible) Newsgroups: comp.lang.c Subject: Playing with the bits of floats Message-ID: Date: 14 Jan 89 00:32:56 GMT Sender: usenet@helios.ee.lbl.gov Distribution: comp Organization: Lawrence Berkeley Laboratories Lines: 19 I'm trying to do deal with floating point numbers as if they're ints. Things like "if(((3.1 - 3.14) & 0x7FFFFFF) <= 0.1)"--- lousy programming style, I know, but I'm interested in speed, not portability for this application. (On a Sun, if C blithely masked out the low bits, that would strip the sign bit.) Also tests like if((3.1 - 3.14) & 0x80000000) might be faster than if((3.1 - 3.14) < 0.0) ; I'd like to know if there's any dirty trick that would permit this sort of action. (I agree that it shouldn't be an easy dirty trick, but I'd certainly like for it to be possible without adding any extra instructions for conversion!) Reply to max@csam.lbl.gov and I'll summarise. Thank you. Max -- /----------------------------------v------------------------------------------\ | Max Rible, Computer Graphics Lab | "I have a very firm grasp on reality! I | | Lawrence Berkeley Laboratories | can reach out and strangle it any time!" | | ARPA: max@csam.lbl.gov |UUCP: {ames!ucbcad,ucbvax}!cartan!csam!max| \----------------------------------^------------------------------------------/