Playing with the bits of floats

Max Rible max at george.lbl.gov
Sat Jan 14 10:32:56 AEST 1989


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 at 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 at csam.lbl.gov          |UUCP: {ames!ucbcad,ucbvax}!cartan!csam!max|
\----------------------------------^------------------------------------------/



More information about the Comp.lang.c mailing list