@param int    $num
@param int    $power
@param string $powsuffix

@return string
357736
protected function toWords($num, $power = 0, $powsuffix = '')
    {
        $ret = '';

        // add a minus sign
        if (substr($num, 0, 1) == '-') {
            $ret = $this->wordSeparator . $this->minus;
            $num = substr($num, 1);
        }

        // strip excessive zero signs and spaces
        $num = trim($num);
        $num = preg_replace('/^0+/', '', $num);

        if (strlen($num) > 3) {
            $maxp = strlen($num) - 1;
            $curp = $maxp;
            for ($p = $maxp; $p > 0; --$p) { // power

                // check for highest power
                if (isset(self::$exponent[$p])) {
                    // send substr from $curp to $p
                    $snum = substr($num, $maxp - $curp, $curp - $p + 1);
                    $snum = preg_replace('/^0+/', '', $snum);
                    if ($snum !== '') {
                        $cursuffix = self::$exponent[$power][count(self::$exponent[$power]) - 1];
                        if ($powsuffix != '') {
                            $cursuffix .= $this->wordSeparator . $powsuffix;
                        }

                        $ret .= $this->toWords($snum, $p, $cursuffix);
                    }
                    $curp = $p - 1;
                    continue;
                }
            }
            $num = substr($num, $maxp - $curp, $curp - $p + 1);
            if ($num == 0) {
                return $ret;
            }
        } elseif ($num == 0 || $num == '') {
            return $this->wordSeparator . self::$digits[0];
        }

        $h = $t = $d = 0;

        switch (strlen($num)) {
            case 3:
                $h = (int) substr($num, -3, 1);

            case 2:
                $t = (int) substr($num, -2, 1);

            case 1:
                $d = (int) substr($num, -1, 1);
                break;

            case 0:
                return;
                break;
        }

        if ($h) {
            $ret .= $this->wordSeparator . self::$digits[$h] . $this->wordSeparator . 'honderd';
        }

        // add digits only in <0>,<1,9> and <21,inf>
        if ($t != 1 && $d > 0) {
            if ($t > 0) {
                $ret .= self::$digits[$d] . 'en';
            } else {
                $ret .= self::$digits[$d];
                if ($d == 1) {
                    if ($power == 0) {
                        $ret .= 's'; // fuer eins
                    } else {
                        if ($power != 3) {  // tausend ausnehmen
                            $ret .= ''; // fuer eine
                        }
                    }
                }
            }
        }

        // ten, twenty etc.
        switch ($t) {
            case 9:
            case 8:
            case 7:
            case 6:
            case 5:
                $ret .= $this->wordSeparator . self::$digits[$t] . 'tig';
                break;

            case 4:
                $ret .= $this->wordSeparator . 'veertig';
                break;

            case 3:
                $ret .= $this->wordSeparator . 'dertig';
                break;

            case 2:
                $ret .= $this->wordSeparator . 'twintig';
                break;

            case 1:
                switch ($d) {
                    case 0:
                        $ret .= $this->wordSeparator . 'tien';
                        break;

                    case 1:
                        $ret .= $this->wordSeparator . 'elf';
                        break;

                    case 2:
                        $ret .= $this->wordSeparator . 'twaalf';
                        break;

                    case 3:
                        $ret .= $this->wordSeparator . 'dertien';
                        break;

                    case 4:
                        $ret .= $this->wordSeparator . 'veertien';
                        break;

                    case 5:
                    case 6:
                    case 7:
                    case 8:
                    case 9:
                        $ret .= $this->wordSeparator . self::$digits[$d] . 'tien';
                        break;
                }
                break;
        }

        if ($power > 0) {
            if (isset(self::$exponent[$power])) {
                $lev = self::$exponent[$power];
            }

            if (!isset($lev) || !is_array($lev)) {
                return null;
            }

            if ($power == 3) {
                $ret .= $this->wordSeparator . $lev[0];
            } elseif ($d == 1 && ($t + $h) == 0) {
                $ret .= self::$exponentWordSeparator . $lev[0] . self::$exponentWordSeparator;
            } else {
                $ret .= self::$exponentWordSeparator . $lev[1] . self::$exponentWordSeparator;
            }
        }

        if ($powsuffix != '') {
            $ret .= $this->wordSeparator . $powsuffix;
        }

        return $ret;
    }
1264657
def pow2(x: int, p: int) -> int:
    """"""
    while p > 0:
        x = x * x % q
        p -= 1
    return x
1281164
private function toDecimal(string $bytes) : string
    {
        $result = '0';
        $power = '1';

        for ($i = \strlen($bytes) - 1; $i >= 0; $i--) {
            $index = \ord($bytes[$i]);

            if ($index !== 0) {
                $result = $this->add($result, ($index === 1)
                    ? $power
                    : $this->mul($power, (string) $index)
                );
            }

            if ($i !== 0) {
                $power = $this->mul($power, '256');
            }
        }

        return $result;
    }
767875
public static INDArray pow(INDArray ndArray, Number power) {
        return pow(ndArray, power, true);

    }
114419
@Override
	public RandomVariable pow(double exponent) {
		return apply(new DoubleUnaryOperator() {
			@Override
			public double applyAsDouble(double x) {
				return FastMath.pow(x, exponent);
			}
		});
	}
320471
public static long nextPowerOf2(long num) {
    final long highBit = Long.highestOneBit(num);
    return (highBit == num) ? num : highBit << 1;
  }
1229228
public function pow($exponent)
    {
        $this->number = bcpow($this->number, static::validatePositiveInteger($exponent), $this->precision);

        return $this;
    }
485060
private void ensurePowerOfTwo(String parameter, int number) {
        if (Integer.bitCount(number) > 1) {
            LOG.warn("Parameter {} should be power of two but was {}", parameter, number);
        }
    }
651880
function getMagnitude(num) {
	return math.pow(10, mathFloor(math.log(num) / math.LN10));
}
401738
protected function toWords($number, $power = 0)
    {
        $ret = '';

        if ($number < 0) {
            $ret .= $this->minus;
            $number *= -1;
        }

        if (strlen($number) > 6) {
            $current_power = 6;
            // check for highest power
            if (isset(self::$exponent[$power])) {
                // convert the number above the first 6 digits
                // with it's corresponding $power.
                $snum = substr($number, 0, -6);
                $snum = preg_replace('/^0+/', '', $snum);
                if ($snum !== '') {
                    $ret .= $this->toWords($snum, $power + 6);
                }
            }
            $number = substr($number, -6);
            if ($number == 0) {
                return $ret;
            }
        } elseif ($number == 0 || $number == '') {
            return (' ' . self::$digits[0] . ' ');
            $current_power = strlen($number);
        } else {
            $current_power = strlen($number);
        }

        $thousands = (int) ($number / 1000);

        if ($thousands == 1) {
            $ret .= $this->wordSeparator . 'mille' . $this->wordSeparator;
        } elseif ($thousands > 1) {
            $ret .= $this->toWords($thousands, 3) . $this->wordSeparator;
        }

        $hundreds = (int) ($number / 100 % 10);
        $tens = (int) ($number / 10 % 10);
        $units = (int) ($number % 10);

        // centinaia: duecento, trecento, etc...
        switch ($hundreds) {
            case 1:
                if ($units === 0 && $tens === 0) { // is it's '100' use 'cien'
                    $ret .= $this->wordSeparator . 'cento';
                } else {
                    $ret .= $this->wordSeparator . 'cento';
                }
                break;
            case 2:
            case 3:
            case 4:
            case 6:
            case 8:
                $ret .= $this->wordSeparator . self::$digits[$hundreds] . 'cento';
                break;
            case 5:
                $ret .= $this->wordSeparator . 'cinquecento';
                break;
            case 7:
                $ret .= $this->wordSeparator . 'settecento';
                break;
            case 9:
                $ret .= $this->wordSeparator . 'novecento';
                break;
        }

        // decine: venti trenta, etc...
        switch ($tens) {
            case 9:
                switch ($units) {
                    case 1:
                    case 8:
                        $ret .= $this->wordSeparator . 'novant';
                        break;
                    default:
                        $ret .= $this->wordSeparator . 'novanta';
                        break;
                }

                break;
            case 8:
                switch ($units) {
                    case 1:
                    case 8:
                        $ret .= $this->wordSeparator . 'ottant';
                        break;
                    default:
                        $ret .= $this->wordSeparator . 'ottanta';
                        break;
                }

                break;
            case 7:
                switch ($units) {
                    case 1:
                    case 8:
                        $ret .= $this->wordSeparator . 'settant';
                        break;
                    default:
                        $ret .= $this->wordSeparator . 'settanta';
                        break;
                }
                break;
            case 6:
                switch ($units) {
                    case 1:
                    case 8:
                        $ret .= $this->wordSeparator . 'sessant';
                        break;
                    default:
                        $ret .= $this->wordSeparator . 'sessanta';
                        break;
                }
                break;
            case 5:
                switch ($units) {
                    case 1:
                    case 8:
                        $ret .= $this->wordSeparator . 'cinquant';
                        break;
                    default:
                        $ret .= $this->wordSeparator . 'cinquanta';
                        break;
                }
                break;
            case 4:
                switch ($units) {
                    case 1:
                    case 8:
                        $ret .= $this->wordSeparator . 'quarant';
                        break;
                    default:
                        $ret .= $this->wordSeparator . 'quaranta';
                        break;
                }
                break;
            case 3:
                switch ($units) {
                    case 1:
                    case 8:
                        $ret .= $this->wordSeparator . 'trent';
                        break;
                    default:
                        $ret .= $this->wordSeparator . 'trenta';
                        break;
                }
                break;
            case 2:
                switch ($units) {
                    case 0:
                        $ret .= $this->wordSeparator . 'venti';
                        break;
                    case 1:
                    case 8:
                        $ret .= $this->wordSeparator . 'vent' . self::$digits[$units];
                        break;
                    default:
                        $ret .= $this->wordSeparator . 'venti' . self::$digits[$units];
                        break;
                }
                break;

            case 1:
                switch ($units) {
                    case 0:
                        $ret .= $this->wordSeparator . 'dieci';
                        break;

                    case 1:
                        $ret .= $this->wordSeparator . 'undici';
                        break;

                    case 2:
                        $ret .= $this->wordSeparator . 'dodici';
                        break;

                    case 3:
                        $ret .= $this->wordSeparator . 'tredici';
                        break;

                    case 4:
                        $ret .= $this->wordSeparator . 'quattordici';
                        break;

                    case 5:
                        $ret .= $this->wordSeparator . 'quindici';
                        break;

                    case 6:
                        $ret .= $this->wordSeparator . 'sedici';
                        break;

                    case 7:
                        $ret .= $this->wordSeparator . 'diciassette';
                        break;

                    case 8:
                        $ret .= $this->wordSeparator . 'diciotto';
                        break;

                    case 9:
                        $ret .= $this->wordSeparator . 'diciannove';
                        break;
                }
                break;
        }

        // add digits only if it is a multiple of 10 and not 1x or 2x
        if (($tens != 1) and ($tens != 2) and ($units > 0)) {
            // don'tens add 'e' for numbers below 10
            if ($tens != 0) {
                // use 'un' instead of 'uno' when there is a suffix ('mila', 'milloni', etc...)
                if (($power > 0) and ($units == 1)) {
                    $ret .= $this->wordSeparator . ' e un';
                } else {
                    $ret .= $this->wordSeparator . '' . self::$digits[$units];
                }
            } else {
                if (($power > 0) and ($units == 1)) {
                    $ret .= $this->wordSeparator . 'un ';
                } else {
                    $ret .= $this->wordSeparator . self::$digits[$units];
                }
            }
        }

        if ($power > 0) {
            if (!array_key_exists($power, self::$exponent)) {
                return null;
            }

            $lev = self::$exponent[$power];

            if ($units === 1 && $tens === 0 && $hundreds === 0) {
                $suffix = $lev[0];
            } else {
                $suffix = $lev[1];
            }

            if ($power >= 6) {
                $suffix = ' ' . $suffix . ' ';
            }

            if ($number !== 0) {
                $ret .= $this->wordSeparator . $suffix;
            }
        }

        return $ret;
    }
1293017
static long biggestPowerTen(int number,
                                int number_bits) {
        int power, exponent;
        switch (number_bits) {
            case 32:
            case 31:
            case 30:
                if (kTen9 <= number) {
                    power = kTen9;
                    exponent = 9;
                    break;
                }  // else fallthrough
            case 29:
            case 28:
            case 27:
                if (kTen8 <= number) {
                    power = kTen8;
                    exponent = 8;
                    break;
                }  // else fallthrough
            case 26:
            case 25:
            case 24:
                if (kTen7 <= number) {
                    power = kTen7;
                    exponent = 7;
                    break;
                }  // else fallthrough
            case 23:
            case 22:
            case 21:
            case 20:
                if (kTen6 <= number) {
                    power = kTen6;
                    exponent = 6;
                    break;
                }  // else fallthrough
            case 19:
            case 18:
            case 17:
                if (kTen5 <= number) {
                    power = kTen5;
                    exponent = 5;
                    break;
                }  // else fallthrough
            case 16:
            case 15:
            case 14:
                if (kTen4 <= number) {
                    power = kTen4;
                    exponent = 4;
                    break;
                }  // else fallthrough
            case 13:
            case 12:
            case 11:
            case 10:
                if (1000 <= number) {
                    power = 1000;
                    exponent = 3;
                    break;
                }  // else fallthrough
            case 9:
            case 8:
            case 7:
                if (100 <= number) {
                    power = 100;
                    exponent = 2;
                    break;
                }  // else fallthrough
            case 6:
            case 5:
            case 4:
                if (10 <= number) {
                    power = 10;
                    exponent = 1;
                    break;
                }  // else fallthrough
            case 3:
            case 2:
            case 1:
                if (1 <= number) {
                    power = 1;
                    exponent = 0;
                    break;
                }  // else fallthrough
            case 0:
                power = 0;
                exponent = -1;
                break;
            default:
                // Following assignments are here to silence compiler warnings.
                power = 0;
                exponent = 0;
                // UNREACHABLE();
        }
        return ((long)power << 32) | (0xffffffffL & exponent);
    }
750897
public static function toRoman($num)
  {
    $num = (int)$num;
    switch($num){
      case 1:
        $roman = 'I';
        break;
      case 2:
        $roman = 'II';
        break;
      case 3:
        $roman = 'III';
        break;
      case 4:
        $roman = 'IV';
        break;
      case 5:
        $roman = 'V';
        break;
      case 6:
        $roman = 'VI';
        break;
      case 7:
        $roman = 'VII';
        break;
      case 8:
        $roman = 'VIII';
        break;
      case 9:
        $roman = 'IX';
        break;
      case 10:
        $roman = 'X';
        break;
      default:
        $roman = (string)$num;
        break;
    }
    
    return $roman;
  }
609859
public static int nextPowerOf2(int n) {
    if (n == 0) {
      return 1;
    }
    int b = Integer.highestOneBit(n);
    return b == n ? n : b << 1;
  }
1363939
private void ensurePowerOfTwo(String parameter, int number) {
        if (Integer.bitCount(number) > 1) {
            if (log.isLoggable(Level.WARNING)) {
                log.warning("Parameter '" + parameter + "' should be power of two but was " + number);
            }
        }
    }
177574
private static int nextPowerOfTwo(int v) {
        assert v >= 0;
        v--;
        v |= v >> 1;
        v |= v >> 2;
        v |= v >> 4;
        v |= v >> 8;
        v |= v >> 16;
        v++;
        return v;
    }
988914
def _abs_pow_ufunc(self, fi, out, p):
        """"""
        # Optimization for very common cases
        if p == 0.5:
            fi.ufuncs.absolute(out=out)
            out.ufuncs.sqrt(out=out)
        elif p == 2.0 and self.base_space.field == RealNumbers():
            fi.multiply(fi, out=out)
        else:
            fi.ufuncs.absolute(out=out)
            out.ufuncs.power(p, out=out)
1066904
public function pow($other, array $options = []): Image
    {
        return $this->callEnum($other, 'math2', OperationMath2::POW, $options);
    }