This topic is locked

Array decimal values are trunctuated for Totals

4/28/2008 6:20:46 AM
PHPRunner General questions
rjks author

Hello Support,
I have tried to localize the Round problem and it seems that array decimal values are trunctuated to integer.
see mail on Support.
I have tested the values in the _list code and directly after adding a decimal value it loses its decimal value.
_list code

[codebox]

$totals=array();

$totals["Gesamt OP"]=0;

$totals["<030"]=0;

$totals["030-060"]=0;

$totals["060-090"]=0;

$totals["090-120"]=0;

$totals["120-150"]=0;

$totals["150+"]=0;

$totals[">90"]=0;
// fill $rowinfo array

$rowinfo = array();

$shade=false;

$editlink="";

$copylink="";
while($data=db_fetch_array($rs))

{

if(function_exists("BeforeProcessRowList"))

{

if(!BeforeProcessRowList($data))

continue;

}

break;

}
while($data && $recno<=$PageSize)

{

$row=array();

if(!$shade)

{

$row["shadeclass"]='class="shade"';

$row["shadeclassname"]="shade";

$shade=true;

}

else

{

$row["shadeclass"]="";

$row["shadeclassname"]="";

$shade=false;

}

for($col=1;$data && $recno<=$PageSize && $col<=1;$col++)

{
$totals["Gesamt OP"]+=($data["Gesamt OP"]+0);

$totals["<030"]+=($data["<030"]+0);

$totals["030-060"]+=($data["030-060"]+0);

$totals["060-090"]+=($data["060-090"]+0);

$totals["090-120"]+=($data["090-120"]+0);

$totals["120-150"]+=($data["120-150"]+0);

$totals["150+"]+=($data["150+"]+0);

$totals[">90"]+=($data[">90"]+0);

[/codebox]
The Value of $data["030-060"] is 18000.67

The value of $totals["030-060"] is 18001.00
I am having real trouble with this.
I found a comment in the php forum abouth this problem but it was fixed last year.
Bug fix trunctuation floating point value in array

[26 Jun 2007 1:24am UTC] iliaa@php.net

This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change

will be in the next snapshot. You can grab the snapshot at

http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.


I am using php 5.2.5 on IIS 6.0
Thanks for any help
Robert

rjks author 4/29/2008

Hello support,
I have uploaded my project to the demo site, information on support per email.
even after an update to PHP vers. 5.3 the decimals are still not being displayed.
Thanks for a quick reply as I must show this to the customer today.
Robert

Sergey Kornilov admin 4/29/2008

Answered to your personal email. Will be fixed in the next update.