本文整理汇总了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));
}