/** * We use this to convert every number to decimal for calculations. */ protected function decimalValue() { $base = $this->numberSystem->getBase(); $result = 0; foreach (array_reverse($this->getDigits()) as $position => $value) { $numberSystemPosition = $this->numberSystem->getSymbolPosition($value); $result += $numberSystemPosition * pow($base, $position); } return $result; }