Issue Type: Bug Created: 2008-12-29T11:07:41.000+0000 Last Updated: 2009-01-03T05:33:04.000+0000 Status: Resolved Fix version(s): Reporter: Maxence Delannoy (mdelanno) Assignee: Thomas Weidner (thomas) Tags: - Zend_Measure
Related issues: - ZF-2878
Try this :
<pre class="highlight"> $unit = new Zend_Measure_Pressure(1, Zend_Measure_Pressure::KILOBAR); $unit->setType(Zend_Measure_Pressure::STANDARD); echo $unit->toString();
It should display 100000000.0000000000000000000000000 N/m², but it displays 0.
I think it's because bcmath doesn't handle numbers in exponential notation. If you look in Zend_Measure_Pressure, you can see that '1.0e+8' is set for KILOBAR factor. bcmath doesn't recognize the 'e+8', so it multiplies the value by 0. Obviously, it's like this everywhere.
One workaround is to remove the quote and use a float, or better write the factors expanded : 100000000 instead of 1.0e+8.
Posted by Thomas Weidner (thomas) on 2008-12-29T11:43:56.000+0000
bcmath is a php extension and not related to ZF. This is not a issue of ZF.
Posted by Maxence Delannoy (mdelanno) on 2008-12-30T00:27:55.000+0000
If you apply my patch of Zend_Locale_Math::normalize (see [http://framework.zend.com/issues/browse/…]) and use it in Zend_Measure_Abstract::setType, the problem is resolved (unless you don't use bcmath, because I use bcmul and bcpow).
<pre class="highlight"> $value = call_user_func(Zend_Locale_Math::$mul, $value, Zend_Locale_Math::normalize($this->_units[$this->getType()]), 25);
Posted by Thomas Weidner (thomas) on 2009-01-03T05:33:03.000+0000
Issues of php itself of it's extensions can't be solved by ZF. Therefor this issue will be closed.
Have you found an issue?
See the Overview section for more details.