Exemple #1
0
 public function matchBest($value, $pos = 9)
 {
     if ($pos > 6 && $pos < 12) {
         if ($value < 1) {
             $newVal = MathProvider::multiply($value, $this->scale);
         }
     }
 }
Exemple #2
0
 /**
  * @param Quantity[] $mults
  * @param Quantity[] $divides
  */
 public static function naiveMultiOpt($mults, $divides, $precision = 2)
 {
     $newUnit = self::getMultiUnits($mults, $divides);
     $newVal = 1;
     foreach ($mults as $quantity) {
         $newVal = MathProvider::multiply($newVal, $quantity->toNative()->getValue());
     }
     foreach ($divides as $quantity) {
         $newVal = MathProvider::divide($newVal, $quantity->toNative()->getValue(), $precision);
     }
     return $newUnit->preConvertedAdd($newVal);
 }
Exemple #3
0
 public function convert($value, $from, $to)
 {
     return MathProvider::divide(MathProvider::multiply($value, $this->getConversionRate($from)), $this->getConversionRate($to));
 }
Exemple #4
0
 /**
  * Surface gravity in meters per second squared
  *
  * @return string
  */
 public function getSurfaceGravity()
 {
     return $this->math->divide($this->math->multiply($this->mass, self::$GRAVITATION), $this->math->exp($this->radius, '2'), 2);
 }