Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 1.10.2, 1.10.6
-
Fix Version/s: 1.10.7
-
Component/s: Zend_Measure
-
Labels:None
Description
When i convert small numbers to another unit/type, Zend_Measure miscalculates the values. This occurs between many of the measurement units. The example code is:
// convert 1 cubic inch to cubic centimeters
$bug=new Zend_Measure_Volume(1, Zend_Measure_Volume::CUBIC_INCH);
$bug->setType(Zend_Measure_Volume::CUBIC_CENTIMETER);
echo $bug->getValue(2); // returns -163870640693, should return 16.39
// method 2, "->convertTo()":
$bug=new Zend_Measure_Volume(1, Zend_Measure_Volume::CUBIC_INCH);
$v2=$bug->convertTo(Zend_Measure_Volume::CUBIC_CENTIMETER);
echo $v2; // returns -163 870 640 693 cm³
As far as i can tell, this happens in Zend_Measure_Volume, Zend_Measure_Area, Zend_Measure_Length and Zend_Measure_Weight - did not test others
Strangely, the following code also fails:
$bug=new Zend_Measure_Volume(1.0, Zend_Measure_Volume::CUBIC_INCH);
$bug->setType(Zend_Measure_Volume::CUBIC_INCH); // same unit
echo $bug->getValue(); // returns -10000000000 (!!!)
Should return "1", not "-10000000000"