public static function pow($z, $w) {
        // If exponent is an integer, compute the power using a square-and-multiply algorithm
        if (is_int($w)) return static::powi($z, $w);

        // Otherwise compute the principal branch: z^w = exp(wlog z)
        return static::exp(static::mul($w, static::log($z)));
    }