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 Richard Levasseur on 06/11/06 22:26

Perhaps the binary<->decimal functions would be of use:

http://us3.php.net/manual/en/function.decbin.php
http://us3.php.net/manual/en/function.bindec.php
http://us3.php.net/manual/en/function.base-convert.php

Convert it to a binary string, cut it in half, then pad with zeroes
(don't forget to sign extend if you need to).

Also, bitwise operators don't work on floating point numbers in PHP? I
don't have access to PHP right now, but I find that odd.



vendredi5h@gmail.com wrote:
> Tim Roberts a écrit :
> > >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?
> >
> > Impossible in straight PHP. You can't get access to the bits.
>
> Ok.
>
> > You could do it with a C extension. What are you actually trying to do?
>
> That's a kind of experimentation of a floating point dissection. As
> with rats in high school! :o) But the goal is to get the n most
> significant bits of a floating point fraction part and keep them for
> futur use. Any other suggestion?
>
> I would prefer PHP but I can do this little program in C too.
>
> 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

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