From: Spehro Pefhany
Subject: Re: Integer divide
References: <firstname.lastname@example.org> <3E1DF384.email@example.com> <firstname.lastname@example.org>
X-Newsreader: Forte Agent 1.92/32.572
Date: Fri, 10 Jan 2003 20:04:19 GMT
NNTP-Posting-Date: Fri, 10 Jan 2003 15:04:19 EST
On Fri, 10 Jan 2003 19:44:03 -0000, the renowned "John Jardine"
>John Larkin wrote in message
>> On Thu, 09 Jan 2003 14:31:47 -0800, John Larkin
>> >On Thu, 09 Jan 2003 22:11:16 +0000, Mike Page
>> > wrote:
>> >>My first task at my current employer was to write a utility that
>> >>"converted" between single precision float and the hex digits
>> >>representing the number for a HART transmitter we were developing. My
>> >>new boss suggested I used QuickBasic or some such contrivance. Okay -
>> >>not my first choice, but I persevered for two days without really
>> >>finishing it. Eventually I gave up and coded it in C in half an hour.
>> >>Today it would take me a few minutes.
>It's been 24hours now. I was rather hoping to see a couple of neat 'C'
>solutions turn up.
>Seems like the C afficionado's enjoy talking the talk but not walking the
I'm not sure I understand the problem. You mean a string of ASCII hex
characters representing each nibble of the internal representation of,
say, a FP 32 bit number, or do you mean to convert the number to
integer first or something?
It's not very portable, but you could do something like this:
unsigned long a;
floatlong.a = 13.0;
// put 8 character null-terminated string into buffer
// letters are upper case
"it's the network..." "The Journey is the reward"
email@example.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com