You are here: Re: Binary manipulation of a floating point number « PHP Programming Language « IT news, forums, messages
Re: Binary manipulation of a floating point number

Posted by vendredi5h on 06/12/06 16:28

Kimmo Laine a écrit :
> I did a little more testing and by golly, it seems actually to be working, I
> get the same result out what goes in
>
> $x = unpack('L2long', pack('d',999999.999999));
> $y = unpack('ddouble', pack('L2',$x['long1'],$x['long2']));
>
> print_r($x);
> print_r($y);
>
> So apparently the pack and it's evil twin sister unpack offer a workaround
> for splitting numbers to high and low end.

Hello Kimmo,

I'll have to look at both functions syntax in order to understand how
it works, but it works!

Thanks for that.

And I agree with Tom when he says that PHP has not been created for
that kind of work. Doing that in C, I used an union to reach
float/double's bits.

Thanks guys for your time.

Yannick

 

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

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