You are here: Re: PHP Sockets: Reconstructing Floating Point Numbers « PHP Programming Language « IT news, forums, messages
Re: PHP Sockets: Reconstructing Floating Point Numbers

Posted by gosha bine on 09/27/07 15:38

DM wrote:
> Hi All,
>
> I'm writing a program that connects to a data stream containing a number of
> different variable types. Ie 4 & 8 byte integers, ASCII characters and 8
> byte floats.
>
> I use fgetc to capture the data in characters then I reconstruct the
> variables from these bytes.
>
> For integers this is easy, just multiply the bytes by orders of 256 to get
> the right offset values. The thing I can't figure out is how to reconstruct
> a double precision floating point number from its 8 component bytes.
>
> Is there an easy way to do this in PHP? I couldn't find anything useful
> through
> Google...
>
> Any pointers would be greatly appreciated.
>

You can try unpack()



--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok

 

Navigation:

[Reply to this 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

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