Mantis - Quercus
Viewing Issue Advanced Details
3469 major always 04-29-09 19:46 04-30-09 15:45
pablorg  
 
normal  
new 3.2.1  
open  
none    
none  
0003469: quercus float/rounding bug
I have a report that accumulates odometer values it pulls from the db. You can see in the image it does some funky math while interpreting this code:

    while($rs->moveNext())
    {
      $vehId = $rs->fields['veh_id'];
      
      if ($showSummary)
      {
        if (!isset($odomCache[$vehId]))
          $odomCache[$vehId] = 0;
        $odomCache[$vehId] += $rs->fields['distance_from_last'];
        $rs->fields['odom'] = $odomCache[$vehId];
      }
    }

I've put the list of values below.

 distance_from_last
--------------------
                  0
                  0
                0.1
                0.1
                0.7
                0.6
                  0
                1.5
                  0
                4.8
                0.4
                  0
                0.5
                0.5
                0.3
                4.3
 quercus-rounding.gif [^] (11,079 bytes) 04-29-09 19:46
 php-rounding.gif [^] (10,371 bytes) 04-29-09 19:47

Notes
(0003970)
pablorg   
04-29-09 19:48   
note the two image files are mis-named -rounding. In reality, there should not need to be any rounding.
(0003971)
nam   
04-30-09 11:03   
Can you try the Resin 4.0 snapshot at: http://www.caucho.com/download [^]

We had made our float rounding to be more like PHP.
(0003976)
pablorg   
04-30-09 15:45   
I tried resin 4, but I cant even log into the app b/c it wont connect to db. See bug: http://bugs.caucho.com/view.php?id=3471 [^]