From: McDaid, Aaron (Aaron.McDaid at domain compaq.com)
Date: Tue 02 May 2000 - 17:02:35 IST
> is there a function out there that will convert a 8-byte string into a
> double
>
> something like
>
>
> double Bytes_To_double(unsigned char input_bytes[8])
> {
> double newdouble;
> newdouble = input_bytes[7]<<56;
> newdouble += input_bytes[6]<<48;
> newdouble += input_bytes[5]<<40;
> newdouble += input_bytes[4]<<32;
> newdouble += input_bytes[3]<<24;
> newdouble += input_bytes[2]<<16;
> newdouble += input_bytes[1]<<8;
> newdouble += input_bytes[0];
> return newdouble;
> }
Do you mean just casting it as a double?
Although I can't really think how you would write
the code to cast after dereferencing the pointer
to the array.
Anyway there's got to be a cuter way of implementing
the above using recursive calls and such or maybe
even just a for(;;) loop. I'll get back
to you on that (if anyone else cares about it!)
PS: How *dare* you assume double will always be 8 bytes!
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:05:59 GMT