original_string: public function to($unit, $precision = null)
      {
          $fromUnit = UnitResolver::resolve($this->from);
          $toUnit = UnitResolver::resolve($unit);
          $this->setBase($unit);
          $base = $this->getBase() == 2 ? 1024 : 1000;
          //some funky stuff with negative exponents and pow
          if ($toUnit > $fromUnit)
              return $this->div($this->start, pow($base, $toUnit - $fromUnit), $precision);
          return $this->mul($this->start, pow($base, $fromUnit - $toUnit), $precision);
      }
code: public function to($unit, $precision = null)
      {
          $fromUnit = UnitResolver::resolve($this->from);
          $toUnit = UnitResolver::resolve($unit);
          $this->setBase($unit);
          $base = $this->getBase() == 2 ? 1024 : 1000;
          //some funky stuff with negative exponents and pow
          if ($toUnit > $fromUnit)
              return $this->div($this->start, pow($base, $toUnit - $fromUnit), $precision);
          return $this->mul($this->start, pow($base, $fromUnit - $toUnit), $precision);
      }
code_tokens: public function to ( $ unit , $ precision = null ) { $ fromUnit = UnitResolver :: resolve ( $ this -> from ) ; $ toUnit = UnitResolver :: resolve ( $ unit ) ; $ this -> setBase ( $ unit ) ; $ base = $ this -> getBase ( ) == 2 ? 1024 : 1000 ; //some funky stuff with negative exponents and pow if ( $ toUnit > $ fromUnit ) return $ this -> div ( $ this -> start , pow ( $ base , $ toUnit - $ fromUnit ) , $ precision ) ; return $ this -> mul ( $ this -> start , pow ( $ base , $ fromUnit - $ toUnit ) , $ precision ) ; }
docstring: Convert the start value to the given unit.
  Accepts an optional precision for how many significant digits to
  retain
  
  @param $unit
  @param int|null $precision
  @return float
docstring_tokens: Convert the start value to the given unit . Accepts an optional precision for how many significant digits to retain