本文整理匯總了PHP中float::setValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP float::setValue方法的具體用法?PHP float::setValue怎麽用?PHP float::setValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類float
的用法示例。
在下文中一共展示了float::setValue方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSetSizeInvalid
/**
* Testing the setSize method to see if validation fails.
*
* @since 1.0
*/
public function testSetSizeInvalid()
{
$this->dbl1 = new Double();
$this->dbl1->setSize(2);
try {
$this->dbl1->setValue(200);
$this->fail('testing passing invalid data to setValue');
} catch (IllegalArguementException $e) {
$this->assertEquals('Not a valid double value!', $e->getMessage(), 'testing passing invalid data to setValue');
}
}
示例2: setFlattening
/**
* Set the Flattening for this Reference Ellipsoid object
* This will nullify the Semi-Minor (Polar) Axis,
* and force a recalculation from the Semi-Major (Equatorial) axis and the specified flattening
*
* @param integer|float $flattening Flattening to use for this ellipsoid
* @throws Exception
*/
public function setFlattening($flattening = null)
{
if (is_null($flattening)) {
throw new Exception('Missing Flattening value');
} elseif (!is_numeric($flattening)) {
throw new Exception('Flattening is not a numeric value');
}
$this->inverseFlattening = (double) 1 / $flattening;
$this->semiMinorAxis->setValue();
$this->dirty = true;
return $this;
}