ID: 22516 Updated by: [EMAIL PROTECTED] Reported By: eugen at iwep dot ab dot ru -Status: Open +Status: Wont fix Bug Type: Scripting Engine problem Operating System: Windows 2000 PHP Version: 5CVS-2003-03-03 (dev) New Comment:
The optimal approach at solving this problem, would be to use doubles, since in PHP floats are emulated via doubles. <? $dat=pack ("d", 1.1); $ar=unpack('dx',$dat); print 'x='.$ar['x'].'<br>'; ?> correctly will return ["x"]=> float(1.1) Previous Comments: ------------------------------------------------------------------------ [2003-03-03 06:12:35] [EMAIL PROTECTED] i reproduced that. seems that due to the fact that php's floats are actually doubles only half of the double gets initialized and should be initialized with 0.0 first. ------------------------------------------------------------------------ [2003-03-03 04:04:00] eugen at iwep dot ab dot ru Hi all, Please try <? $dat=pack ("f", 1.1); $ar=unpack('fx',$dat); print 'x='.$ar['x'].'<br>'; ?> Output: x=1.10000002384 ^^^^^^^^^^^^^^^^?????????????? maybe bug with float ? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22516&edit=1