public function convert(NumberSystem $newSystem)
    {
        $newDigits = [];
        $decimalValue = gmp_init($this->decimalValue());

        do {
            $divisionResult = gmp_div_qr($decimalValue, $newSystem->getBase());
            $remainder = gmp_strval($divisionResult[1]);
            $decimalValue = $divisionResult[0];


            $newDigits[] = $newSystem->getSymbolForPosition($remainder);
        } while (gmp_strval($decimalValue) > 0);

        return $newSystem->buildNumber(array_reverse($newDigits));
    }
public function convert(NumberSystem $newSystem)
    {
        $newDigits = [];
        $decimalValue = gmp_init($this->decimalValue());

        do {
            $divisionResult = gmp_div_qr($decimalValue, $newSystem->getBase());
            $remainder = gmp_strval($divisionResult[1]);
            $decimalValue = $divisionResult[0];


            $newDigits[] = $newSystem->getSymbolForPosition($remainder);
        } while (gmp_strval($decimalValue) > 0);

        return $newSystem->buildNumber(array_reverse($newDigits));
    }
public function convert ( NumberSystem $ newSystem ) { $ newDigits = [ ] ; $ decimalValue = gmp_init ( $ this -> decimalValue ( ) ) ; do { $ divisionResult = gmp_div_qr ( $ decimalValue , $ newSystem -> getBase ( ) ) ; $ remainder = gmp_strval ( $ divisionResult [ 1 ] ) ; $ decimalValue = $ divisionResult [ 0 ] ; $ newDigits [ ] = $ newSystem -> getSymbolForPosition ( $ remainder ) ; } while ( gmp_strval ( $ decimalValue ) > 0 ) ; return $ newSystem -> buildNumber ( array_reverse ( $ newDigits ) ) ; }
Convert this number into a other number-system.

@param NumberSystem $newSystem

@return Number
Convert this number into a other number - system .