當前位置: 首頁>>代碼示例>>PHP>>正文


PHP float::getValue方法代碼示例

本文整理匯總了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);
     }
 }
開發者ID:lusitanian,項目名稱:phpmoney,代碼行數:14,代碼來源:Money.php

示例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 "";
 }
開發者ID:rolandstoll,項目名稱:pimcore,代碼行數:12,代碼來源:QuantityValue.php

示例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 "";
 }
開發者ID:pimcore,項目名稱:pimcore,代碼行數:21,代碼來源:QuantityValue.php

示例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());
 }
開發者ID:void-sector,項目名稱:scalar-objects,代碼行數:10,代碼來源:Ceil.php

示例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()));
 }
開發者ID:hutnikau,項目名稱:qti-sdk,代碼行數:10,代碼來源:Marshaller.php

示例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);
 }
開發者ID:markbaker,項目名稱:phpgeodetic,代碼行數:24,代碼來源:ReferenceEllipsoid.php

示例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');
 }
開發者ID:alphadevx,項目名稱:alpha,代碼行數:11,代碼來源:DoubleTest.php


注:本文中的float::getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。