Reply to Re: Binary manipulation of a floating point number

Your name:

Reply:


Posted by Kimmo Laine on 06/12/06 10:33

<vendredi5h@gmail.com> wrote in message
news:1149905810.660991.135400@f6g2000cwb.googlegroups.com...
> Hello all,
>
> I'd like to split a 64-bits word (hold as a floating point number) into
> two 32-bits words (hold as integers). Bitwise operators are working on
> Integers, not on floating point.
>
> Anyone can tell me how I can do this?


This is just a guess but manipulating it with pack and unpack just might
work, something like this:
print_r(unpack('Lhigh/Llow', pack('d',12.015)));

first pack the 64bit double into a string and then read two 32bit longs from
the packed string. Just an idea. Altough when I tested it with 12.015 didn't
seem anything like 12 and 015 after unpacking it, so it might not work at
all but give it a try...

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация