本文整理汇总了PHP中float::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP float::getValue方法的具体用法?PHP float::getValue怎么用?PHP float::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类float
的用法示例。
在下文中一共展示了float::getValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: divide
/**
* Divides $this by $divisor and returns a new value object.
* Uses the default rounding method (ROUND_HALF_EVEN) which is preferred for financial calculations.
* @param Money|int|float|string $divisor
* @return Money|string
*/
public function divide($divisor)
{
if ($divisor instanceof Money) {
return $this->mathProvider->divide($this->getValue(), $divisor->getValue(), MathProvider::ROUND_MODE_NONE);
} else {
return new static($this->mathProvider->divide($this->getValue(), (string) $divisor), $this->mathProvider);
}
}
示例2: getVersionPreview
/**
* @see Object_Class_Data::getVersionPreview
* @param float $data
* @return float
*/
public function getVersionPreview($data)
{
if ($data instanceof \Object_Data_QuantityValue) {
return $data->getValue() . " " . $data->getUnit()->getAbbreviation();
}
return "";
}
示例3: getVersionPreview
/**
* @see Object_Class_Data::getVersionPreview
* @param float $data
* @param null|Model\Object\AbstractObject $object
* @param mixed $params
* @return float
*/
public function getVersionPreview($data, $object = null, $params = [])
{
if ($data instanceof \Pimcore\Model\Object\Data\QuantityValue) {
$unit = "";
if ($data->getUnitId()) {
$unitDefinition = Model\Object\QuantityValue\Unit::getById($data->getUnitId());
if ($unitDefinition) {
$unit = " " . $unitDefinition->getAbbreviation();
}
}
return $data->getValue() . $unit;
}
return "";
}
示例4: direct
/**
* Ceil a float
*
* @param \Scalar\Float $float eg 13.22222
* @return float eg 14.0
*/
public function direct(float $float)
{
return ceil($float->getValue());
}
示例5: marshallFloat
/**
* Marshall a QTI float datatype into its PCI JSON Representation.
*
* @param \qtism\common\datatypes\Float $float
* @return array
*/
protected function marshallFloat(float $float)
{
return array('base' => array('float' => $float->getValue()));
}
示例6: getRadiusOfCurvaturePrimeVertical
/**
* Get the Radius of Curvature along the Prime Vertical at a specified latitude
* for this Reference Ellipsoid object
*
* The formula used here is from http://www.epsg.org/guides/docs/G7-2.pdf
*
* @param integer|float $latitude Angle of Latitude for the Radius of Curvature,
* positive when to the north of the equator, negative when to the south
* @param string $degrad Indicating whether the Angle of Latitude is being specified
* in degrees or radians
* @param string $uom Unit of Measure for the returned value
* @return float The Radius of Curvature along the Prime Vertical at the specified latitude
* for this ellipsoid
* @throws Exception
*/
public function getRadiusOfCurvaturePrimeVertical($latitude = null, $degrad = Angle::DEGREES, $uom = Distance::METRES)
{
$latitude = LatLong::validateLatitude($latitude, $degrad);
if ($this->dirty) {
$this->calculateDerivedParameters();
}
$radius = $this->semiMajorAxis->getValue() / pow(1 - $this->firstEccentricitySquared * self::sinSquared($latitude), 0.5);
return Distance::convertFromMeters($radius, $uom);
}
示例7: testAddDoubles
/**
* Testing addition of two Double values.
*
* @since 1.0
*/
public function testAddDoubles()
{
$this->dbl1 = new Double(1.25);
$this->dbl2 = new Double(3.5);
$this->assertEquals(4.75, $this->dbl1->getValue() + $this->dbl2->getValue(), 'testing addition of two Double values');
}