Doc #63673 [NEW]: Bug in number_format

From: Date: Mon, 03 Dec 2012 09:08:32 +0000
Subject: Doc #63673 [NEW]: Bug in number_format
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-9246@lists.php.net to get a copy of this message
From: lorenavva at gmail dot com Operating system: number_format PHP version: Irrelevant Package: Testing related Bug Type: Documentation Problem Bug description:Bug in number_format Description: ------------ Dears developer: I have the next problem with function number_format. I understand thar number_format do a high round. I am write one case where there is bug: Original Number --> Number with round 2462.055--2462.05 However in this case there isn´t bug: Original Number --> Number with round 3707.055--3707.06 Could you help me, please? Best Regards --- From manual page: http://www.php.net/function.number-format#refsect1-function.number-format-description --- Test script: --------------- $sql = "SELECT * FROM access_subv_abona WHERE borrado = 0"; $rs_abonada =mysql_query($sql); if($rs_abonada) { if(mysql_num_rows($rs_abonada)>0) { for($i=0; $i<mysql_num_rows($rs_abonada);$i++) { if(mysql_result($rs_abonada,$i, "subvencion_concedida") >0){ $datos_expediente=consultaSimple("expedientes","id=".intval(mysql_result($rs_abonada,$i,"id_expediente"))." and borrado=0"); $subvencion_total= $datos_expediente['subvencion_concedida']; $subvencion_abonada = number_format(0.5* $subvencion_total,2,'.','')+number_format(0.25* $subvencion_total,2,'.',''); $exp_actualizado=array(); $subvencion_abonada_bd= mysql_result($rs_abonada,$i,"subvencion_abonada"); $ajuste_abono=($subvencion_abonada_bd- $subvencion_abonada); print_r((0.25* $subvencion_total)."--".number_format((0.25* $subvencion_total),2,'.','')."<br>"); print_r($subvencion_abonada_bd."--".$subvencion_abonada."<br>"); print_r($datos_expediente['name']."-->".$ajuste_abono); } } } } -- Edit bug report at https://bugs.php.net/bug.php?id=63673&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63673&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63673&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63673&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63673&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63673&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63673&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63673&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63673&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63673&r=support Expected behavior: https://bugs.php.net/fix.php?id=63673&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63673&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63673&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63673&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63673&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63673&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63673&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63673&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63673&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63673&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63673&r=mysqlcfg

« previous php.doc.bugs (#9246) next »