本文整理匯總了PHP中Zend_Locale_Math_PhpMath::disable方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Locale_Math_PhpMath::disable方法的具體用法?PHP Zend_Locale_Math_PhpMath::disable怎麽用?PHP Zend_Locale_Math_PhpMath::disable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Locale_Math_PhpMath
的用法示例。
在下文中一共展示了Zend_Locale_Math_PhpMath::disable方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: floor
if ($op3 === null) {
$op3 = self::$_scale;
}
if ($op3 <> 0) {
$op1 = self::round($op1, $op3);
$op2 = self::round($op2, $op3);
} else {
$op1 = ($op1 > 0) ? floor($op1) : ceil($op1);
$op2 = ($op2 > 0) ? floor($op2) : ceil($op2);
}
if ($op1 > $op2) {
return 1;
} else if ($op1 < $op2) {
return -1;
}
return 0;
}
public static function Scale($op1)
{
if ($op1 > 9) {
require_once 'Zend/Locale/Math/Exception.php';
throw new Zend_Locale_Math_Exception("can not scale to precision $op1", $op1, null, null);
}
self::$_scale = $op1;
return true;
}
}
Zend_Locale_Math_PhpMath::disable(); // disable use of bcmath functions
示例2: floor
$op1 = self::normalize($op1);
$op2 = self::normalize($op2);
if ($scale != 0) {
$op1 = self::round($op1, $scale);
$op2 = self::round($op2, $scale);
} else {
$op1 = $op1 > 0 ? floor($op1) : ceil($op1);
$op2 = $op2 > 0 ? floor($op2) : ceil($op2);
}
if ($op1 > $op2) {
return 1;
} else {
if ($op1 < $op2) {
return -1;
}
}
return 0;
}
public static function Scale($scale)
{
if ($scale > 9) {
require_once 'Zend/Locale/Math/Exception.php';
throw new Zend_Locale_Math_Exception("can not scale to precision {$scale}", $scale, null, null);
}
self::$defaultScale = $scale;
self::$defaultPrecision = pow(10, -$scale);
return true;
}
}
Zend_Locale_Math_PhpMath::disable();
// disable use of bcmath functions
示例3: testScale
public function testScale()
{
Zend_Locale_Math_PhpMath::disable();
$this->assertTrue(Zend_Locale_Math_PhpMath::Scale(3));
try {
$this->assertTrue(Zend_Locale_Math_PhpMath::Scale(10));
$this->fail("exception expected");
} catch (Zend_Locale_Math_Exception $e) {
// success
}
$this->assertEquals(1, Zend_Locale_Math_PhpMath::Comp(10.5556, 10.4444));
$this->assertTrue(Zend_Locale_Math_PhpMath::Scale(0));
$this->assertEquals(0, Zend_Locale_Math_PhpMath::Comp(10.5556, 10.4444));
}