delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/11/09/01:48:01

Date: Thu, 9 Nov 2000 08:45:54 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Graham Reeds <grahamr AT dtn DOT ntl DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Looking at the individual bits of a float.
In-Reply-To: <6fqO5.60817$mv2.276178@news2-win.server.ntlworld.com>
Message-ID: <Pine.SUN.3.91.1001109084310.16891G-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 9 Nov 2000, Graham Reeds wrote:

> I was wondering if anyone has any fast ways of looking at the individual
> bits and bytes of a float with or without (preferably) destroying the float
> in question.

What's the problem, exactly?  You don't destroy anything by examining the 
bits, e.g. with "(f & MASK)", where MASK is an appropriately set-up bit 
mask variable.

If your problem is with double's (as opposed to float's), define a union 
of a double and two 32-bit unsigned int's, and do the bit fiddling on the 
int's.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019