Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Type punning in C Message-ID: <11242@smoke.BRL.MIL> Date: 7 Oct 89 01:09:35 GMT References: <475@idacrd.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 9 In article <475@idacrd.UUCP> desj@idacrd.UUCP (David desJardins) writes: > Does anyone have any ideas on how one should go about converting an >integer to the floating-point number with the same bit pattern? The simple answer is, you shouldn't need to do that! However, C does provide "union" types that can be used for such purposes. Load the bit pattern into the integer union member and extract it via the floating-point member.