On Wed, 2007-03-07 at 12:35 -0800, Stewart Stremler wrote: > begin quoting Paul G. Allen as of Wed, Mar 07, 2007 at 10:31:02AM -0800: > > On Wed, 2007-03-07 at 10:10 -0800, Stewart Stremler wrote: > > > begin quoting Paul G. Allen as of Wed, Mar 07, 2007 at 09:18:52AM -0800: > > > > It's been a while (years?) since I've done anything in Perl. I need to > > > > convert an ASCII string of ones and zeros to a double. (Actually, I > > > > don't need to, but one of our engineers does.) > > > > > > As in a floating point? > > > > The exact request the I got was: > > > > "I spent more than 4 hours to convert the following binary string to > > double number using pack and unpack. > > 0100000000000110010111111100101100100101111111001011001001100000" > > > > He said he was unsuccessful. > > Hm... > > 0100000000000110010111111100101100100101111111001011001001100000 > 1 2 3 4 5 6 | 7 > 01234567890123456789012345678901234567890123456789012345678901234567890 > > It could be an IEEE 754 double. >
It seems he wants to convert as follows: 'So what I want to do with perl is, I want to convert the string "100011111100001011110101101000101110010011111111111000000" to 31.31 (which is the value of d variable)' PGA -- Paul G. Allen BSIT/SE Owner/Sr. Engineer Random Logic Consulting www.randomlogic.com -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
