
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(if (<= x 1650000.0)
(/
(+
(/
(fma
0.5
(- (pow (log1p x) 2.0) (pow (log x) 2.0))
(/ (* 0.16666666666666666 (- (pow (log1p x) 3.0) (pow (log x) 3.0))) n))
n)
(- (log1p x) (log x)))
n)
(* (/ 1.0 n) (/ (pow x (/ 1.0 n)) x))))
double code(double x, double n) {
double tmp;
if (x <= 1650000.0) {
tmp = ((fma(0.5, (pow(log1p(x), 2.0) - pow(log(x), 2.0)), ((0.16666666666666666 * (pow(log1p(x), 3.0) - pow(log(x), 3.0))) / n)) / n) + (log1p(x) - log(x))) / n;
} else {
tmp = (1.0 / n) * (pow(x, (1.0 / n)) / x);
}
return tmp;
}
function code(x, n) tmp = 0.0 if (x <= 1650000.0) tmp = Float64(Float64(Float64(fma(0.5, Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)), Float64(Float64(0.16666666666666666 * Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0))) / n)) / n) + Float64(log1p(x) - log(x))) / n); else tmp = Float64(Float64(1.0 / n) * Float64((x ^ Float64(1.0 / n)) / x)); end return tmp end
code[x_, n_] := If[LessEqual[x, 1650000.0], N[(N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.16666666666666666 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] * N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1650000:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(0.5, {\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}, \frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{n}\right)}{n} + \left(\mathsf{log1p}\left(x\right) - \log x\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{{x}^{\left(\frac{1}{n}\right)}}{x}\\
\end{array}
\end{array}
if x < 1.65e6Initial program 45.7%
Taylor expanded in n around -inf
Applied rewrites77.2%
if 1.65e6 < x Initial program 64.5%
Taylor expanded in x around inf
lower-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6498.9
Applied rewrites98.9%
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
frac-2negN/A
neg-mul-1N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
times-fracN/A
frac-2negN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
frac-2negN/A
lower-/.f64N/A
lower-/.f64N/A
lower-neg.f6499.5
Applied rewrites99.5%
Final simplification87.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n)))
(t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0))
(t_2 (* n (* x x))))
(if (<= t_1 -2e-5)
(- 1.0 t_0)
(if (<= t_1 0.9101169306103679)
(/ (log (/ (+ x 1.0) x)) n)
(/
(+
(/ 1.0 n)
(/ (- (* (/ -0.5 x) t_2) (* n -0.3333333333333333)) (* n t_2)))
x)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
double t_2 = n * (x * x);
double tmp;
if (t_1 <= -2e-5) {
tmp = 1.0 - t_0;
} else if (t_1 <= 0.9101169306103679) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = ((1.0 / n) + ((((-0.5 / x) * t_2) - (n * -0.3333333333333333)) / (n * t_2))) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = ((x + 1.0d0) ** (1.0d0 / n)) - t_0
t_2 = n * (x * x)
if (t_1 <= (-2d-5)) then
tmp = 1.0d0 - t_0
else if (t_1 <= 0.9101169306103679d0) then
tmp = log(((x + 1.0d0) / x)) / n
else
tmp = ((1.0d0 / n) + (((((-0.5d0) / x) * t_2) - (n * (-0.3333333333333333d0))) / (n * t_2))) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
double t_2 = n * (x * x);
double tmp;
if (t_1 <= -2e-5) {
tmp = 1.0 - t_0;
} else if (t_1 <= 0.9101169306103679) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = ((1.0 / n) + ((((-0.5 / x) * t_2) - (n * -0.3333333333333333)) / (n * t_2))) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.pow((x + 1.0), (1.0 / n)) - t_0 t_2 = n * (x * x) tmp = 0 if t_1 <= -2e-5: tmp = 1.0 - t_0 elif t_1 <= 0.9101169306103679: tmp = math.log(((x + 1.0) / x)) / n else: tmp = ((1.0 / n) + ((((-0.5 / x) * t_2) - (n * -0.3333333333333333)) / (n * t_2))) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0) t_2 = Float64(n * Float64(x * x)) tmp = 0.0 if (t_1 <= -2e-5) tmp = Float64(1.0 - t_0); elseif (t_1 <= 0.9101169306103679) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(-0.5 / x) * t_2) - Float64(n * -0.3333333333333333)) / Float64(n * t_2))) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = ((x + 1.0) ^ (1.0 / n)) - t_0; t_2 = n * (x * x); tmp = 0.0; if (t_1 <= -2e-5) tmp = 1.0 - t_0; elseif (t_1 <= 0.9101169306103679) tmp = log(((x + 1.0) / x)) / n; else tmp = ((1.0 / n) + ((((-0.5 / x) * t_2) - (n * -0.3333333333333333)) / (n * t_2))) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(n * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-5], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 0.9101169306103679], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(-0.5 / x), $MachinePrecision] * t$95$2), $MachinePrecision] - N[(n * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(n * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
t_2 := n \cdot \left(x \cdot x\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-5}:\\
\;\;\;\;1 - t\_0\\
\mathbf{elif}\;t\_1 \leq 0.9101169306103679:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{x} \cdot t\_2 - n \cdot -0.3333333333333333}{n \cdot t\_2}}{x}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -2.00000000000000016e-5Initial program 98.8%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6498.8
Applied rewrites98.8%
if -2.00000000000000016e-5 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.910116930610367914Initial program 45.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6474.8
Applied rewrites74.8%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-/.f6474.8
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6475.0
Applied rewrites75.0%
if 0.910116930610367914 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 44.7%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f646.0
Applied rewrites6.0%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites0.1%
Taylor expanded in x around -inf
Applied rewrites11.3%
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6447.2
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
Applied rewrites47.2%
(FPCore (x n)
:precision binary64
(if (<= x 0.92)
(/
(-
(* -0.16666666666666666 (/ (pow (log x) 3.0) (* n n)))
(fma 0.5 (/ (pow (log x) 2.0) n) (log x)))
n)
(* (/ 1.0 n) (/ (pow x (/ 1.0 n)) x))))
double code(double x, double n) {
double tmp;
if (x <= 0.92) {
tmp = ((-0.16666666666666666 * (pow(log(x), 3.0) / (n * n))) - fma(0.5, (pow(log(x), 2.0) / n), log(x))) / n;
} else {
tmp = (1.0 / n) * (pow(x, (1.0 / n)) / x);
}
return tmp;
}
function code(x, n) tmp = 0.0 if (x <= 0.92) tmp = Float64(Float64(Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) / Float64(n * n))) - fma(0.5, Float64((log(x) ^ 2.0) / n), log(x))) / n); else tmp = Float64(Float64(1.0 / n) * Float64((x ^ Float64(1.0 / n)) / x)); end return tmp end
code[x_, n_] := If[LessEqual[x, 0.92], N[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / n), $MachinePrecision] + N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] * N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.92:\\
\;\;\;\;\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n \cdot n} - \mathsf{fma}\left(0.5, \frac{{\log x}^{2}}{n}, \log x\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{{x}^{\left(\frac{1}{n}\right)}}{x}\\
\end{array}
\end{array}
if x < 0.92000000000000004Initial program 46.3%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6444.9
Applied rewrites44.9%
Taylor expanded in n around inf
lower-/.f64N/A
Applied rewrites76.2%
if 0.92000000000000004 < x Initial program 63.5%
Taylor expanded in x around inf
lower-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6497.8
Applied rewrites97.8%
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
frac-2negN/A
neg-mul-1N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
times-fracN/A
frac-2negN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
frac-2negN/A
lower-/.f64N/A
lower-/.f64N/A
lower-neg.f6498.4
Applied rewrites98.4%
Final simplification86.5%
(FPCore (x n)
:precision binary64
(if (<= x 0.92)
(/
(-
(/
(fma
-0.16666666666666666
(/ (pow (log x) 3.0) n)
(* (pow (log x) 2.0) -0.5))
n)
(log x))
n)
(* (/ 1.0 n) (/ (pow x (/ 1.0 n)) x))))
double code(double x, double n) {
double tmp;
if (x <= 0.92) {
tmp = ((fma(-0.16666666666666666, (pow(log(x), 3.0) / n), (pow(log(x), 2.0) * -0.5)) / n) - log(x)) / n;
} else {
tmp = (1.0 / n) * (pow(x, (1.0 / n)) / x);
}
return tmp;
}
function code(x, n) tmp = 0.0 if (x <= 0.92) tmp = Float64(Float64(Float64(fma(-0.16666666666666666, Float64((log(x) ^ 3.0) / n), Float64((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n); else tmp = Float64(Float64(1.0 / n) * Float64((x ^ Float64(1.0 / n)) / x)); end return tmp end
code[x_, n_] := If[LessEqual[x, 0.92], N[(N[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / n), $MachinePrecision] + N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] * N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.92:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.16666666666666666, \frac{{\log x}^{3}}{n}, {\log x}^{2} \cdot -0.5\right)}{n} - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{{x}^{\left(\frac{1}{n}\right)}}{x}\\
\end{array}
\end{array}
if x < 0.92000000000000004Initial program 46.3%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6444.9
Applied rewrites44.9%
Taylor expanded in n around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites76.2%
if 0.92000000000000004 < x Initial program 63.5%
Taylor expanded in x around inf
lower-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6497.8
Applied rewrites97.8%
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
frac-2negN/A
neg-mul-1N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
times-fracN/A
frac-2negN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
frac-2negN/A
lower-/.f64N/A
lower-/.f64N/A
lower-neg.f6498.4
Applied rewrites98.4%
Final simplification86.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-29)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 1e-97)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 2e-34)
(/ 1.0 (* x (fma 0.5 (/ n x) n)))
(if (<= (/ 1.0 n) 2e+145)
(-
(fma
x
(fma
x
(fma
x
(+
(/ 0.16666666666666666 (* n (* n n)))
(+ (/ 0.3333333333333333 n) (/ -0.5 (* n n))))
(/ (+ -0.5 (/ 0.5 n)) n))
(/ 1.0 n))
1.0)
t_0)
(- (fma x (/ (fma x (/ 0.5 n) (fma x -0.5 1.0)) n) 1.0) t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-29) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 1e-97) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e-34) {
tmp = 1.0 / (x * fma(0.5, (n / x), n));
} else if ((1.0 / n) <= 2e+145) {
tmp = fma(x, fma(x, fma(x, ((0.16666666666666666 / (n * (n * n))) + ((0.3333333333333333 / n) + (-0.5 / (n * n)))), ((-0.5 + (0.5 / n)) / n)), (1.0 / n)), 1.0) - t_0;
} else {
tmp = fma(x, (fma(x, (0.5 / n), fma(x, -0.5, 1.0)) / n), 1.0) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-29) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 1e-97) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e-34) tmp = Float64(1.0 / Float64(x * fma(0.5, Float64(n / x), n))); elseif (Float64(1.0 / n) <= 2e+145) tmp = Float64(fma(x, fma(x, fma(x, Float64(Float64(0.16666666666666666 / Float64(n * Float64(n * n))) + Float64(Float64(0.3333333333333333 / n) + Float64(-0.5 / Float64(n * n)))), Float64(Float64(-0.5 + Float64(0.5 / n)) / n)), Float64(1.0 / n)), 1.0) - t_0); else tmp = Float64(fma(x, Float64(fma(x, Float64(0.5 / n), fma(x, -0.5, 1.0)) / n), 1.0) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-29], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-97], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-34], N[(1.0 / N[(x * N[(0.5 * N[(n / x), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+145], N[(N[(x * N[(x * N[(x * N[(N[(0.16666666666666666 / N[(n * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 / n), $MachinePrecision] + N[(-0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(x * N[(N[(x * N[(0.5 / n), $MachinePrecision] + N[(x * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-29}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-34}:\\
\;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(0.5, \frac{n}{x}, n\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+145}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, \frac{0.16666666666666666}{n \cdot \left(n \cdot n\right)} + \left(\frac{0.3333333333333333}{n} + \frac{-0.5}{n \cdot n}\right), \frac{-0.5 + \frac{0.5}{n}}{n}\right), \frac{1}{n}\right), 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{\mathsf{fma}\left(x, \frac{0.5}{n}, \mathsf{fma}\left(x, -0.5, 1\right)\right)}{n}, 1\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.99999999999999977e-29Initial program 88.6%
Taylor expanded in x around inf
lower-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.4
Applied rewrites91.4%
if -3.99999999999999977e-29 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-97Initial program 39.4%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6477.3
Applied rewrites77.3%
diff-logN/A
+-commutativeN/A
lift-+.f64N/A
clear-numN/A
lift-+.f64N/A
+-commutativeN/A
neg-logN/A
diff-logN/A
lift-log.f64N/A
lift-log1p.f64N/A
lift--.f64N/A
lower-neg.f6477.3
lift--.f64N/A
lift-log.f64N/A
lift-log1p.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6477.5
Applied rewrites77.5%
if 1.00000000000000004e-97 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999986e-34Initial program 4.0%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6430.2
Applied rewrites30.2%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6430.2
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6430.2
Applied rewrites30.2%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.2
Applied rewrites75.2%
if 1.99999999999999986e-34 < (/.f64 #s(literal 1 binary64) n) < 2e145Initial program 56.6%
lift-+.f64N/A
lift-/.f64N/A
pow-to-expN/A
lower-exp.f64N/A
lift-/.f64N/A
un-div-invN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-log1p.f6495.2
Applied rewrites95.2%
Taylor expanded in x around 0
Applied rewrites75.7%
if 2e145 < (/.f64 #s(literal 1 binary64) n) Initial program 35.4%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
Applied rewrites67.7%
Taylor expanded in n around inf
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6479.9
Applied rewrites79.9%
Final simplification81.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-29)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 1e-97)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 2e-34)
(/ 1.0 (* x (fma 0.5 (/ n x) n)))
(- (exp (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-29) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 1e-97) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e-34) {
tmp = 1.0 / (x * fma(0.5, (n / x), n));
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-29) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 1e-97) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e-34) tmp = Float64(1.0 / Float64(x * fma(0.5, Float64(n / x), n))); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-29], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-97], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-34], N[(1.0 / N[(x * N[(0.5 * N[(n / x), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-29}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-34}:\\
\;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(0.5, \frac{n}{x}, n\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.99999999999999977e-29Initial program 88.6%
Taylor expanded in x around inf
lower-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.4
Applied rewrites91.4%
if -3.99999999999999977e-29 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-97Initial program 39.4%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6477.3
Applied rewrites77.3%
diff-logN/A
+-commutativeN/A
lift-+.f64N/A
clear-numN/A
lift-+.f64N/A
+-commutativeN/A
neg-logN/A
diff-logN/A
lift-log.f64N/A
lift-log1p.f64N/A
lift--.f64N/A
lower-neg.f6477.3
lift--.f64N/A
lift-log.f64N/A
lift-log1p.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6477.5
Applied rewrites77.5%
if 1.00000000000000004e-97 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999986e-34Initial program 4.0%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6430.2
Applied rewrites30.2%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6430.2
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6430.2
Applied rewrites30.2%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.2
Applied rewrites75.2%
if 1.99999999999999986e-34 < (/.f64 #s(literal 1 binary64) n) Initial program 45.0%
lift-+.f64N/A
lift-/.f64N/A
pow-to-expN/A
lower-exp.f64N/A
lift-/.f64N/A
un-div-invN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-log1p.f6497.8
Applied rewrites97.8%
Taylor expanded in x around 0
lower-/.f6497.8
Applied rewrites97.8%
Final simplification85.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-29)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 1e-97)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 4e-21)
(/ 1.0 (* x (fma 0.5 (/ n x) n)))
(- (fma x (/ (fma x (/ 0.5 n) (fma x -0.5 1.0)) n) 1.0) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-29) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 1e-97) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e-21) {
tmp = 1.0 / (x * fma(0.5, (n / x), n));
} else {
tmp = fma(x, (fma(x, (0.5 / n), fma(x, -0.5, 1.0)) / n), 1.0) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-29) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 1e-97) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 4e-21) tmp = Float64(1.0 / Float64(x * fma(0.5, Float64(n / x), n))); else tmp = Float64(fma(x, Float64(fma(x, Float64(0.5 / n), fma(x, -0.5, 1.0)) / n), 1.0) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-29], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-97], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-21], N[(1.0 / N[(x * N[(0.5 * N[(n / x), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(N[(x * N[(0.5 / n), $MachinePrecision] + N[(x * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-29}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-21}:\\
\;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(0.5, \frac{n}{x}, n\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{\mathsf{fma}\left(x, \frac{0.5}{n}, \mathsf{fma}\left(x, -0.5, 1\right)\right)}{n}, 1\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.99999999999999977e-29Initial program 88.6%
Taylor expanded in x around inf
lower-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.4
Applied rewrites91.4%
if -3.99999999999999977e-29 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-97Initial program 39.4%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6477.3
Applied rewrites77.3%
diff-logN/A
+-commutativeN/A
lift-+.f64N/A
clear-numN/A
lift-+.f64N/A
+-commutativeN/A
neg-logN/A
diff-logN/A
lift-log.f64N/A
lift-log1p.f64N/A
lift--.f64N/A
lower-neg.f6477.3
lift--.f64N/A
lift-log.f64N/A
lift-log1p.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6477.5
Applied rewrites77.5%
if 1.00000000000000004e-97 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999963e-21Initial program 4.0%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6435.9
Applied rewrites35.9%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6435.9
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6435.9
Applied rewrites35.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6469.2
Applied rewrites69.2%
if 3.99999999999999963e-21 < (/.f64 #s(literal 1 binary64) n) Initial program 46.0%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
Applied rewrites63.5%
Taylor expanded in n around inf
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6470.4
Applied rewrites70.4%
Final simplification80.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-29)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 1e-97)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 4e-21)
(/ 1.0 (* x (fma 0.5 (/ n x) n)))
(- (fma x (fma x (/ 0.5 (* n n)) (/ 1.0 n)) 1.0) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-29) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 1e-97) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e-21) {
tmp = 1.0 / (x * fma(0.5, (n / x), n));
} else {
tmp = fma(x, fma(x, (0.5 / (n * n)), (1.0 / n)), 1.0) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-29) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 1e-97) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 4e-21) tmp = Float64(1.0 / Float64(x * fma(0.5, Float64(n / x), n))); else tmp = Float64(fma(x, fma(x, Float64(0.5 / Float64(n * n)), Float64(1.0 / n)), 1.0) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-29], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-97], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-21], N[(1.0 / N[(x * N[(0.5 * N[(n / x), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(x * N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-29}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-21}:\\
\;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(0.5, \frac{n}{x}, n\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, \frac{0.5}{n \cdot n}, \frac{1}{n}\right), 1\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.99999999999999977e-29Initial program 88.6%
Taylor expanded in x around inf
lower-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.4
Applied rewrites91.4%
if -3.99999999999999977e-29 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-97Initial program 39.4%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6477.3
Applied rewrites77.3%
diff-logN/A
+-commutativeN/A
lift-+.f64N/A
clear-numN/A
lift-+.f64N/A
+-commutativeN/A
neg-logN/A
diff-logN/A
lift-log.f64N/A
lift-log1p.f64N/A
lift--.f64N/A
lower-neg.f6477.3
lift--.f64N/A
lift-log.f64N/A
lift-log1p.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6477.5
Applied rewrites77.5%
if 1.00000000000000004e-97 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999963e-21Initial program 4.0%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6435.9
Applied rewrites35.9%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6435.9
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6435.9
Applied rewrites35.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6469.2
Applied rewrites69.2%
if 3.99999999999999963e-21 < (/.f64 #s(literal 1 binary64) n) Initial program 46.0%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
Applied rewrites63.5%
Taylor expanded in n around 0
lower-/.f64N/A
unpow2N/A
lower-*.f6463.5
Applied rewrites63.5%
Final simplification79.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (* n (* x x))))
(if (<= (/ 1.0 n) -4e-29)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 1e-97)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 4e-21)
(/ 1.0 (* x (fma 0.5 (/ n x) n)))
(if (<= (/ 1.0 n) 1e+93)
(- (+ (/ x n) 1.0) t_0)
(/
(+
(/ 1.0 n)
(/ (- (* (/ -0.5 x) t_1) (* n -0.3333333333333333)) (* n t_1)))
x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = n * (x * x);
double tmp;
if ((1.0 / n) <= -4e-29) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 1e-97) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e-21) {
tmp = 1.0 / (x * fma(0.5, (n / x), n));
} else if ((1.0 / n) <= 1e+93) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = ((1.0 / n) + ((((-0.5 / x) * t_1) - (n * -0.3333333333333333)) / (n * t_1))) / x;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(n * Float64(x * x)) tmp = 0.0 if (Float64(1.0 / n) <= -4e-29) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 1e-97) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 4e-21) tmp = Float64(1.0 / Float64(x * fma(0.5, Float64(n / x), n))); elseif (Float64(1.0 / n) <= 1e+93) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(-0.5 / x) * t_1) - Float64(n * -0.3333333333333333)) / Float64(n * t_1))) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(n * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-29], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-97], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-21], N[(1.0 / N[(x * N[(0.5 * N[(n / x), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+93], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(-0.5 / x), $MachinePrecision] * t$95$1), $MachinePrecision] - N[(n * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(n * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := n \cdot \left(x \cdot x\right)\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-29}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-21}:\\
\;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(0.5, \frac{n}{x}, n\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+93}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{x} \cdot t\_1 - n \cdot -0.3333333333333333}{n \cdot t\_1}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.99999999999999977e-29Initial program 88.6%
Taylor expanded in x around inf
lower-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.4
Applied rewrites91.4%
if -3.99999999999999977e-29 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-97Initial program 39.4%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6477.3
Applied rewrites77.3%
diff-logN/A
+-commutativeN/A
lift-+.f64N/A
clear-numN/A
lift-+.f64N/A
+-commutativeN/A
neg-logN/A
diff-logN/A
lift-log.f64N/A
lift-log1p.f64N/A
lift--.f64N/A
lower-neg.f6477.3
lift--.f64N/A
lift-log.f64N/A
lift-log1p.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6477.5
Applied rewrites77.5%
if 1.00000000000000004e-97 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999963e-21Initial program 4.0%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6435.9
Applied rewrites35.9%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6435.9
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6435.9
Applied rewrites35.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6469.2
Applied rewrites69.2%
if 3.99999999999999963e-21 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e93Initial program 79.5%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
lower-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f6476.1
Applied rewrites76.1%
if 1.00000000000000004e93 < (/.f64 #s(literal 1 binary64) n) Initial program 29.8%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f645.8
Applied rewrites5.8%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in x around -inf
Applied rewrites14.9%
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.8
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
Applied rewrites66.8%
Final simplification80.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (* n (* x x))) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-29)
(/ t_1 (* x n))
(if (<= (/ 1.0 n) 1e-97)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 2e-34)
(/ 1.0 (* x (fma 0.5 (/ n x) n)))
(if (<= (/ 1.0 n) 1e+93)
(- 1.0 t_1)
(/
(+
(/ 1.0 n)
(/ (- (* (/ -0.5 x) t_0) (* n -0.3333333333333333)) (* n t_0)))
x)))))))
double code(double x, double n) {
double t_0 = n * (x * x);
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-29) {
tmp = t_1 / (x * n);
} else if ((1.0 / n) <= 1e-97) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e-34) {
tmp = 1.0 / (x * fma(0.5, (n / x), n));
} else if ((1.0 / n) <= 1e+93) {
tmp = 1.0 - t_1;
} else {
tmp = ((1.0 / n) + ((((-0.5 / x) * t_0) - (n * -0.3333333333333333)) / (n * t_0))) / x;
}
return tmp;
}
function code(x, n) t_0 = Float64(n * Float64(x * x)) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-29) tmp = Float64(t_1 / Float64(x * n)); elseif (Float64(1.0 / n) <= 1e-97) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e-34) tmp = Float64(1.0 / Float64(x * fma(0.5, Float64(n / x), n))); elseif (Float64(1.0 / n) <= 1e+93) tmp = Float64(1.0 - t_1); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(-0.5 / x) * t_0) - Float64(n * -0.3333333333333333)) / Float64(n * t_0))) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(n * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-29], N[(t$95$1 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-97], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-34], N[(1.0 / N[(x * N[(0.5 * N[(n / x), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+93], N[(1.0 - t$95$1), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(-0.5 / x), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(n * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(n * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(x \cdot x\right)\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-29}:\\
\;\;\;\;\frac{t\_1}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-34}:\\
\;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(0.5, \frac{n}{x}, n\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+93}:\\
\;\;\;\;1 - t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{x} \cdot t\_0 - n \cdot -0.3333333333333333}{n \cdot t\_0}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.99999999999999977e-29Initial program 88.6%
Taylor expanded in x around inf
lower-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.4
Applied rewrites91.4%
if -3.99999999999999977e-29 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-97Initial program 39.4%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6477.3
Applied rewrites77.3%
diff-logN/A
+-commutativeN/A
lift-+.f64N/A
clear-numN/A
lift-+.f64N/A
+-commutativeN/A
neg-logN/A
diff-logN/A
lift-log.f64N/A
lift-log1p.f64N/A
lift--.f64N/A
lower-neg.f6477.3
lift--.f64N/A
lift-log.f64N/A
lift-log1p.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6477.5
Applied rewrites77.5%
if 1.00000000000000004e-97 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999986e-34Initial program 4.0%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6430.2
Applied rewrites30.2%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6430.2
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6430.2
Applied rewrites30.2%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.2
Applied rewrites75.2%
if 1.99999999999999986e-34 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e93Initial program 74.5%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6468.0
Applied rewrites68.0%
if 1.00000000000000004e93 < (/.f64 #s(literal 1 binary64) n) Initial program 29.8%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f645.8
Applied rewrites5.8%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in x around -inf
Applied rewrites14.9%
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.8
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
Applied rewrites66.8%
Final simplification80.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (* n (* x x))))
(if (<= (/ 1.0 n) -4e-29)
(/ (pow x (+ -1.0 (/ 1.0 n))) n)
(if (<= (/ 1.0 n) 1e-97)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 2e-34)
(/ 1.0 (* x (fma 0.5 (/ n x) n)))
(if (<= (/ 1.0 n) 1e+93)
(- 1.0 (pow x (/ 1.0 n)))
(/
(+
(/ 1.0 n)
(/ (- (* (/ -0.5 x) t_0) (* n -0.3333333333333333)) (* n t_0)))
x)))))))
double code(double x, double n) {
double t_0 = n * (x * x);
double tmp;
if ((1.0 / n) <= -4e-29) {
tmp = pow(x, (-1.0 + (1.0 / n))) / n;
} else if ((1.0 / n) <= 1e-97) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e-34) {
tmp = 1.0 / (x * fma(0.5, (n / x), n));
} else if ((1.0 / n) <= 1e+93) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = ((1.0 / n) + ((((-0.5 / x) * t_0) - (n * -0.3333333333333333)) / (n * t_0))) / x;
}
return tmp;
}
function code(x, n) t_0 = Float64(n * Float64(x * x)) tmp = 0.0 if (Float64(1.0 / n) <= -4e-29) tmp = Float64((x ^ Float64(-1.0 + Float64(1.0 / n))) / n); elseif (Float64(1.0 / n) <= 1e-97) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e-34) tmp = Float64(1.0 / Float64(x * fma(0.5, Float64(n / x), n))); elseif (Float64(1.0 / n) <= 1e+93) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(-0.5 / x) * t_0) - Float64(n * -0.3333333333333333)) / Float64(n * t_0))) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(n * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-29], N[(N[Power[x, N[(-1.0 + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-97], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-34], N[(1.0 / N[(x * N[(0.5 * N[(n / x), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+93], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(-0.5 / x), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(n * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(n * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(x \cdot x\right)\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-29}:\\
\;\;\;\;\frac{{x}^{\left(-1 + \frac{1}{n}\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-34}:\\
\;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(0.5, \frac{n}{x}, n\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+93}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{x} \cdot t\_0 - n \cdot -0.3333333333333333}{n \cdot t\_0}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.99999999999999977e-29Initial program 88.6%
Taylor expanded in x around inf
lower-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.4
Applied rewrites91.4%
lift-/.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
div-invN/A
lift-pow.f64N/A
inv-powN/A
pow-prod-upN/A
lower-pow.f64N/A
lower-+.f6491.1
Applied rewrites91.1%
if -3.99999999999999977e-29 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-97Initial program 39.4%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6477.3
Applied rewrites77.3%
diff-logN/A
+-commutativeN/A
lift-+.f64N/A
clear-numN/A
lift-+.f64N/A
+-commutativeN/A
neg-logN/A
diff-logN/A
lift-log.f64N/A
lift-log1p.f64N/A
lift--.f64N/A
lower-neg.f6477.3
lift--.f64N/A
lift-log.f64N/A
lift-log1p.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6477.5
Applied rewrites77.5%
if 1.00000000000000004e-97 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999986e-34Initial program 4.0%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6430.2
Applied rewrites30.2%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6430.2
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6430.2
Applied rewrites30.2%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.2
Applied rewrites75.2%
if 1.99999999999999986e-34 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e93Initial program 74.5%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6468.0
Applied rewrites68.0%
if 1.00000000000000004e93 < (/.f64 #s(literal 1 binary64) n) Initial program 29.8%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f645.8
Applied rewrites5.8%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in x around -inf
Applied rewrites14.9%
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.8
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
Applied rewrites66.8%
Final simplification79.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (* n (* x x))))
(if (<= (/ 1.0 n) -4e-29)
(/ (pow x (+ -1.0 (/ 1.0 n))) n)
(if (<= (/ 1.0 n) 1e-97)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 2e-34)
(/ 1.0 (* x (fma 0.5 (/ n x) n)))
(if (<= (/ 1.0 n) 1e+93)
(- 1.0 (pow x (/ 1.0 n)))
(/
(+
(/ 1.0 n)
(/ (- (* (/ -0.5 x) t_0) (* n -0.3333333333333333)) (* n t_0)))
x)))))))
double code(double x, double n) {
double t_0 = n * (x * x);
double tmp;
if ((1.0 / n) <= -4e-29) {
tmp = pow(x, (-1.0 + (1.0 / n))) / n;
} else if ((1.0 / n) <= 1e-97) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e-34) {
tmp = 1.0 / (x * fma(0.5, (n / x), n));
} else if ((1.0 / n) <= 1e+93) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = ((1.0 / n) + ((((-0.5 / x) * t_0) - (n * -0.3333333333333333)) / (n * t_0))) / x;
}
return tmp;
}
function code(x, n) t_0 = Float64(n * Float64(x * x)) tmp = 0.0 if (Float64(1.0 / n) <= -4e-29) tmp = Float64((x ^ Float64(-1.0 + Float64(1.0 / n))) / n); elseif (Float64(1.0 / n) <= 1e-97) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 2e-34) tmp = Float64(1.0 / Float64(x * fma(0.5, Float64(n / x), n))); elseif (Float64(1.0 / n) <= 1e+93) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(-0.5 / x) * t_0) - Float64(n * -0.3333333333333333)) / Float64(n * t_0))) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(n * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-29], N[(N[Power[x, N[(-1.0 + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-97], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-34], N[(1.0 / N[(x * N[(0.5 * N[(n / x), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+93], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(-0.5 / x), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(n * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(n * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(x \cdot x\right)\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-29}:\\
\;\;\;\;\frac{{x}^{\left(-1 + \frac{1}{n}\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-34}:\\
\;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(0.5, \frac{n}{x}, n\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+93}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{x} \cdot t\_0 - n \cdot -0.3333333333333333}{n \cdot t\_0}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.99999999999999977e-29Initial program 88.6%
Taylor expanded in x around inf
lower-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.4
Applied rewrites91.4%
lift-/.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
div-invN/A
lift-pow.f64N/A
inv-powN/A
pow-prod-upN/A
lower-pow.f64N/A
lower-+.f6491.1
Applied rewrites91.1%
if -3.99999999999999977e-29 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-97Initial program 39.4%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6477.3
Applied rewrites77.3%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-/.f6477.3
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6477.5
Applied rewrites77.5%
if 1.00000000000000004e-97 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999986e-34Initial program 4.0%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6430.2
Applied rewrites30.2%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6430.2
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6430.2
Applied rewrites30.2%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.2
Applied rewrites75.2%
if 1.99999999999999986e-34 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e93Initial program 74.5%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6468.0
Applied rewrites68.0%
if 1.00000000000000004e93 < (/.f64 #s(literal 1 binary64) n) Initial program 29.8%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f645.8
Applied rewrites5.8%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in x around -inf
Applied rewrites14.9%
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.8
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
Applied rewrites66.8%
Final simplification79.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (* n (* x x))))
(if (<= (/ 1.0 n) -100.0)
(/ 0.3333333333333333 (* x (* x (* x n))))
(if (<= (/ 1.0 n) 2e-34)
(/ 1.0 (* x (fma 0.5 (/ n x) n)))
(if (<= (/ 1.0 n) 1e+93)
(- 1.0 (pow x (/ 1.0 n)))
(/
(+
(/ 1.0 n)
(/ (- (* (/ -0.5 x) t_0) (* n -0.3333333333333333)) (* n t_0)))
x))))))
double code(double x, double n) {
double t_0 = n * (x * x);
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else if ((1.0 / n) <= 2e-34) {
tmp = 1.0 / (x * fma(0.5, (n / x), n));
} else if ((1.0 / n) <= 1e+93) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = ((1.0 / n) + ((((-0.5 / x) * t_0) - (n * -0.3333333333333333)) / (n * t_0))) / x;
}
return tmp;
}
function code(x, n) t_0 = Float64(n * Float64(x * x)) tmp = 0.0 if (Float64(1.0 / n) <= -100.0) tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); elseif (Float64(1.0 / n) <= 2e-34) tmp = Float64(1.0 / Float64(x * fma(0.5, Float64(n / x), n))); elseif (Float64(1.0 / n) <= 1e+93) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(-0.5 / x) * t_0) - Float64(n * -0.3333333333333333)) / Float64(n * t_0))) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(n * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -100.0], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-34], N[(1.0 / N[(x * N[(0.5 * N[(n / x), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+93], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(-0.5 / x), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(n * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(n * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(x \cdot x\right)\\
\mathbf{if}\;\frac{1}{n} \leq -100:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-34}:\\
\;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(0.5, \frac{n}{x}, n\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+93}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{x} \cdot t\_0 - n \cdot -0.3333333333333333}{n \cdot t\_0}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -100Initial program 100.0%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6446.1
Applied rewrites46.1%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites1.6%
Taylor expanded in x around -inf
Applied rewrites16.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.1
Applied rewrites68.1%
if -100 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999986e-34Initial program 36.7%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6469.8
Applied rewrites69.8%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6469.7
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6470.0
Applied rewrites70.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6463.5
Applied rewrites63.5%
if 1.99999999999999986e-34 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e93Initial program 74.5%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6468.0
Applied rewrites68.0%
if 1.00000000000000004e93 < (/.f64 #s(literal 1 binary64) n) Initial program 29.8%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f645.8
Applied rewrites5.8%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in x around -inf
Applied rewrites14.9%
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.8
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
Applied rewrites66.8%
(FPCore (x n)
:precision binary64
(if (<= x 2e-148)
(- (/ (log x) n))
(if (<= x 3.8e-71)
(/ 0.3333333333333333 (* x (* x (* x n))))
(if (<= x 0.5)
(/ (- x (log x)) n)
(if (<= x 1.1e+129)
(/
-1.0
(*
x
(-
(-
(/
(fma n -0.08333333333333333 (* n 0.041666666666666664))
(* x (* x x)))
n)
(/ (fma n 0.5 (* (/ n x) -0.08333333333333333)) x))))
0.0)))))
double code(double x, double n) {
double tmp;
if (x <= 2e-148) {
tmp = -(log(x) / n);
} else if (x <= 3.8e-71) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else if (x <= 0.5) {
tmp = (x - log(x)) / n;
} else if (x <= 1.1e+129) {
tmp = -1.0 / (x * (((fma(n, -0.08333333333333333, (n * 0.041666666666666664)) / (x * (x * x))) - n) - (fma(n, 0.5, ((n / x) * -0.08333333333333333)) / x)));
} else {
tmp = 0.0;
}
return tmp;
}
function code(x, n) tmp = 0.0 if (x <= 2e-148) tmp = Float64(-Float64(log(x) / n)); elseif (x <= 3.8e-71) tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); elseif (x <= 0.5) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 1.1e+129) tmp = Float64(-1.0 / Float64(x * Float64(Float64(Float64(fma(n, -0.08333333333333333, Float64(n * 0.041666666666666664)) / Float64(x * Float64(x * x))) - n) - Float64(fma(n, 0.5, Float64(Float64(n / x) * -0.08333333333333333)) / x)))); else tmp = 0.0; end return tmp end
code[x_, n_] := If[LessEqual[x, 2e-148], (-N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), If[LessEqual[x, 3.8e-71], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.5], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.1e+129], N[(-1.0 / N[(x * N[(N[(N[(N[(n * -0.08333333333333333 + N[(n * 0.041666666666666664), $MachinePrecision]), $MachinePrecision] / N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision] - N[(N[(n * 0.5 + N[(N[(n / x), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-148}:\\
\;\;\;\;-\frac{\log x}{n}\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-71}:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+129}:\\
\;\;\;\;\frac{-1}{x \cdot \left(\left(\frac{\mathsf{fma}\left(n, -0.08333333333333333, n \cdot 0.041666666666666664\right)}{x \cdot \left(x \cdot x\right)} - n\right) - \frac{\mathsf{fma}\left(n, 0.5, \frac{n}{x} \cdot -0.08333333333333333\right)}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.99999999999999987e-148Initial program 46.7%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6448.6
Applied rewrites48.6%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f64N/A
lower-log.f6448.6
Applied rewrites48.6%
if 1.99999999999999987e-148 < x < 3.79999999999999992e-71Initial program 45.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6427.4
Applied rewrites27.4%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites0.3%
Taylor expanded in x around -inf
Applied rewrites33.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6465.2
Applied rewrites65.2%
if 3.79999999999999992e-71 < x < 0.5Initial program 45.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6444.4
Applied rewrites44.4%
Taylor expanded in x around 0
lower--.f64N/A
lower-log.f6441.8
Applied rewrites41.8%
if 0.5 < x < 1.1e129Initial program 33.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6435.1
Applied rewrites35.1%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6435.1
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6435.8
Applied rewrites35.8%
Taylor expanded in x around inf
Applied rewrites81.4%
if 1.1e129 < x Initial program 86.5%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6458.9
Applied rewrites58.9%
Taylor expanded in n around inf
Applied rewrites86.5%
metadata-eval86.5
Applied rewrites86.5%
Final simplification65.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- (/ (log x) n))))
(if (<= x 2e-148)
t_0
(if (<= x 3.8e-71)
(/ 0.3333333333333333 (* x (* x (* x n))))
(if (<= x 2.7e-16)
t_0
(if (<= x 1.45e+129)
(/ (/ (+ (/ (+ -0.5 (/ 0.3333333333333333 x)) x) 1.0) n) x)
0.0))))))
double code(double x, double n) {
double t_0 = -(log(x) / n);
double tmp;
if (x <= 2e-148) {
tmp = t_0;
} else if (x <= 3.8e-71) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else if (x <= 2.7e-16) {
tmp = t_0;
} else if (x <= 1.45e+129) {
tmp = ((((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = -(log(x) / n)
if (x <= 2d-148) then
tmp = t_0
else if (x <= 3.8d-71) then
tmp = 0.3333333333333333d0 / (x * (x * (x * n)))
else if (x <= 2.7d-16) then
tmp = t_0
else if (x <= 1.45d+129) then
tmp = (((((-0.5d0) + (0.3333333333333333d0 / x)) / x) + 1.0d0) / n) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = -(Math.log(x) / n);
double tmp;
if (x <= 2e-148) {
tmp = t_0;
} else if (x <= 3.8e-71) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else if (x <= 2.7e-16) {
tmp = t_0;
} else if (x <= 1.45e+129) {
tmp = ((((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = -(math.log(x) / n) tmp = 0 if x <= 2e-148: tmp = t_0 elif x <= 3.8e-71: tmp = 0.3333333333333333 / (x * (x * (x * n))) elif x <= 2.7e-16: tmp = t_0 elif x <= 1.45e+129: tmp = ((((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / n) / x else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(-Float64(log(x) / n)) tmp = 0.0 if (x <= 2e-148) tmp = t_0; elseif (x <= 3.8e-71) tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); elseif (x <= 2.7e-16) tmp = t_0; elseif (x <= 1.45e+129) tmp = Float64(Float64(Float64(Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x) + 1.0) / n) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = -(log(x) / n); tmp = 0.0; if (x <= 2e-148) tmp = t_0; elseif (x <= 3.8e-71) tmp = 0.3333333333333333 / (x * (x * (x * n))); elseif (x <= 2.7e-16) tmp = t_0; elseif (x <= 1.45e+129) tmp = ((((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / n) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = (-N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision])}, If[LessEqual[x, 2e-148], t$95$0, If[LessEqual[x, 3.8e-71], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.7e-16], t$95$0, If[LessEqual[x, 1.45e+129], N[(N[(N[(N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + 1.0), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision], 0.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{\log x}{n}\\
\mathbf{if}\;x \leq 2 \cdot 10^{-148}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-71}:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+129}:\\
\;\;\;\;\frac{\frac{\frac{-0.5 + \frac{0.3333333333333333}{x}}{x} + 1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.99999999999999987e-148 or 3.79999999999999992e-71 < x < 2.69999999999999999e-16Initial program 44.7%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6448.4
Applied rewrites48.4%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f64N/A
lower-log.f6448.4
Applied rewrites48.4%
if 1.99999999999999987e-148 < x < 3.79999999999999992e-71Initial program 45.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6427.4
Applied rewrites27.4%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites0.3%
Taylor expanded in x around -inf
Applied rewrites33.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6465.2
Applied rewrites65.2%
if 2.69999999999999999e-16 < x < 1.45000000000000001e129Initial program 38.1%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6434.7
Applied rewrites34.7%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites71.7%
Taylor expanded in x around -inf
Applied rewrites73.8%
Taylor expanded in n around 0
lower-/.f64N/A
Applied rewrites73.8%
if 1.45000000000000001e129 < x Initial program 86.5%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6458.9
Applied rewrites58.9%
Taylor expanded in n around inf
Applied rewrites86.5%
metadata-eval86.5
Applied rewrites86.5%
Final simplification65.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (* n (* x x))))
(if (<= (/ 1.0 n) -100.0)
(/ 0.3333333333333333 (* x (* x (* x n))))
(if (<= (/ 1.0 n) 1e+93)
(/ 1.0 (* x (fma 0.5 (/ n x) n)))
(/
(+
(/ 1.0 n)
(/ (- (* (/ -0.5 x) t_0) (* n -0.3333333333333333)) (* n t_0)))
x)))))
double code(double x, double n) {
double t_0 = n * (x * x);
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else if ((1.0 / n) <= 1e+93) {
tmp = 1.0 / (x * fma(0.5, (n / x), n));
} else {
tmp = ((1.0 / n) + ((((-0.5 / x) * t_0) - (n * -0.3333333333333333)) / (n * t_0))) / x;
}
return tmp;
}
function code(x, n) t_0 = Float64(n * Float64(x * x)) tmp = 0.0 if (Float64(1.0 / n) <= -100.0) tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); elseif (Float64(1.0 / n) <= 1e+93) tmp = Float64(1.0 / Float64(x * fma(0.5, Float64(n / x), n))); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(-0.5 / x) * t_0) - Float64(n * -0.3333333333333333)) / Float64(n * t_0))) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(n * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -100.0], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+93], N[(1.0 / N[(x * N[(0.5 * N[(n / x), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(-0.5 / x), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(n * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(n * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(x \cdot x\right)\\
\mathbf{if}\;\frac{1}{n} \leq -100:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+93}:\\
\;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(0.5, \frac{n}{x}, n\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{x} \cdot t\_0 - n \cdot -0.3333333333333333}{n \cdot t\_0}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -100Initial program 100.0%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6446.1
Applied rewrites46.1%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites1.6%
Taylor expanded in x around -inf
Applied rewrites16.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.1
Applied rewrites68.1%
if -100 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e93Initial program 40.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6464.6
Applied rewrites64.6%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6464.5
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6464.7
Applied rewrites64.7%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6458.3
Applied rewrites58.3%
if 1.00000000000000004e93 < (/.f64 #s(literal 1 binary64) n) Initial program 29.8%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f645.8
Applied rewrites5.8%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in x around -inf
Applied rewrites14.9%
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.8
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
Applied rewrites66.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (* x (* x n))))
(if (<= (/ 1.0 n) -100.0)
(/ 0.3333333333333333 (* x t_0))
(if (<= (/ 1.0 n) 1e+93)
(/ 1.0 (* x (fma 0.5 (/ n x) n)))
(/ (+ (/ 1.0 n) (/ 0.3333333333333333 t_0)) x)))))
double code(double x, double n) {
double t_0 = x * (x * n);
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = 0.3333333333333333 / (x * t_0);
} else if ((1.0 / n) <= 1e+93) {
tmp = 1.0 / (x * fma(0.5, (n / x), n));
} else {
tmp = ((1.0 / n) + (0.3333333333333333 / t_0)) / x;
}
return tmp;
}
function code(x, n) t_0 = Float64(x * Float64(x * n)) tmp = 0.0 if (Float64(1.0 / n) <= -100.0) tmp = Float64(0.3333333333333333 / Float64(x * t_0)); elseif (Float64(1.0 / n) <= 1e+93) tmp = Float64(1.0 / Float64(x * fma(0.5, Float64(n / x), n))); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(0.3333333333333333 / t_0)) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -100.0], N[(0.3333333333333333 / N[(x * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+93], N[(1.0 / N[(x * N[(0.5 * N[(n / x), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(0.3333333333333333 / t$95$0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot n\right)\\
\mathbf{if}\;\frac{1}{n} \leq -100:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot t\_0}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+93}:\\
\;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(0.5, \frac{n}{x}, n\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{0.3333333333333333}{t\_0}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -100Initial program 100.0%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6446.1
Applied rewrites46.1%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites1.6%
Taylor expanded in x around -inf
Applied rewrites16.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.1
Applied rewrites68.1%
if -100 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e93Initial program 40.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6464.6
Applied rewrites64.6%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6464.5
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6464.7
Applied rewrites64.7%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6458.3
Applied rewrites58.3%
if 1.00000000000000004e93 < (/.f64 #s(literal 1 binary64) n) Initial program 29.8%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f645.8
Applied rewrites5.8%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in x around -inf
Applied rewrites14.9%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6460.6
Applied rewrites60.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 0.3333333333333333 (* x (* x (* x n))))))
(if (<= (/ 1.0 n) -100.0)
t_0
(if (<= (/ 1.0 n) 1e+93) (/ 1.0 (* x (fma 0.5 (/ n x) n))) t_0))))
double code(double x, double n) {
double t_0 = 0.3333333333333333 / (x * (x * (x * n)));
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = t_0;
} else if ((1.0 / n) <= 1e+93) {
tmp = 1.0 / (x * fma(0.5, (n / x), n));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, n) t_0 = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))) tmp = 0.0 if (Float64(1.0 / n) <= -100.0) tmp = t_0; elseif (Float64(1.0 / n) <= 1e+93) tmp = Float64(1.0 / Float64(x * fma(0.5, Float64(n / x), n))); else tmp = t_0; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -100.0], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+93], N[(1.0 / N[(x * N[(0.5 * N[(n / x), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -100:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+93}:\\
\;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(0.5, \frac{n}{x}, n\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -100 or 1.00000000000000004e93 < (/.f64 #s(literal 1 binary64) n) Initial program 78.3%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6433.7
Applied rewrites33.7%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites1.1%
Taylor expanded in x around -inf
Applied rewrites15.9%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6465.8
Applied rewrites65.8%
if -100 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e93Initial program 40.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6464.6
Applied rewrites64.6%
lift-log1p.f64N/A
lift-log.f64N/A
lift--.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6464.5
lift--.f64N/A
lift-log1p.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6464.7
Applied rewrites64.7%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6458.3
Applied rewrites58.3%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -2e-5) (/ 0.3333333333333333 (* x (* x (* x n)))) (/ (/ (+ (/ (+ -0.5 (/ 0.3333333333333333 x)) x) 1.0) n) x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e-5) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else {
tmp = ((((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= (-2d-5)) then
tmp = 0.3333333333333333d0 / (x * (x * (x * n)))
else
tmp = (((((-0.5d0) + (0.3333333333333333d0 / x)) / x) + 1.0d0) / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e-5) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else {
tmp = ((((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -2e-5: tmp = 0.3333333333333333 / (x * (x * (x * n))) else: tmp = ((((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / n) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-5) tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); else tmp = Float64(Float64(Float64(Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x) + 1.0) / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -2e-5) tmp = 0.3333333333333333 / (x * (x * (x * n))); else tmp = ((((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-5], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + 1.0), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-5}:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{-0.5 + \frac{0.3333333333333333}{x}}{x} + 1}{n}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000016e-5Initial program 99.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6445.8
Applied rewrites45.8%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites1.6%
Taylor expanded in x around -inf
Applied rewrites16.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.1
Applied rewrites67.1%
if -2.00000000000000016e-5 < (/.f64 #s(literal 1 binary64) n) Initial program 38.3%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6455.8
Applied rewrites55.8%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites46.8%
Taylor expanded in x around -inf
Applied rewrites50.1%
Taylor expanded in n around 0
lower-/.f64N/A
Applied rewrites57.1%
Final simplification59.7%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -100.0) (/ 0.3333333333333333 (* x (* x (* x n)))) (/ (/ 1.0 n) x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= (-100.0d0)) then
tmp = 0.3333333333333333d0 / (x * (x * (x * n)))
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -100.0: tmp = 0.3333333333333333 / (x * (x * (x * n))) else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -100.0) tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -100.0) tmp = 0.3333333333333333 / (x * (x * (x * n))); else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -100.0], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -100:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -100Initial program 100.0%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6446.1
Applied rewrites46.1%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites1.6%
Taylor expanded in x around -inf
Applied rewrites16.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.1
Applied rewrites68.1%
if -100 < (/.f64 #s(literal 1 binary64) n) Initial program 38.6%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6455.6
Applied rewrites55.6%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites46.6%
Taylor expanded in x around inf
lower-/.f6455.4
Applied rewrites55.4%
(FPCore (x n) :precision binary64 (if (<= x 1.45e+129) (/ (/ 1.0 n) x) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 1.45e+129) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.45d+129) then
tmp = (1.0d0 / n) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.45e+129) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.45e+129: tmp = (1.0 / n) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1.45e+129) tmp = Float64(Float64(1.0 / n) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.45e+129) tmp = (1.0 / n) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.45e+129], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.45 \cdot 10^{+129}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.45000000000000001e129Initial program 42.7%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6441.4
Applied rewrites41.4%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites22.2%
Taylor expanded in x around inf
lower-/.f6441.8
Applied rewrites41.8%
if 1.45000000000000001e129 < x Initial program 86.5%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6458.9
Applied rewrites58.9%
Taylor expanded in n around inf
Applied rewrites86.5%
metadata-eval86.5
Applied rewrites86.5%
(FPCore (x n) :precision binary64 (if (<= x 1.1e+129) (/ 1.0 (* x n)) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 1.1e+129) {
tmp = 1.0 / (x * n);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.1d+129) then
tmp = 1.0d0 / (x * n)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.1e+129) {
tmp = 1.0 / (x * n);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.1e+129: tmp = 1.0 / (x * n) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1.1e+129) tmp = Float64(1.0 / Float64(x * n)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.1e+129) tmp = 1.0 / (x * n); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.1e+129], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.1 \cdot 10^{+129}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.1e129Initial program 42.7%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log1p.f64N/A
lower-log.f6441.4
Applied rewrites41.4%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f6441.8
Applied rewrites41.8%
if 1.1e129 < x Initial program 86.5%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6458.9
Applied rewrites58.9%
Taylor expanded in n around inf
Applied rewrites86.5%
metadata-eval86.5
Applied rewrites86.5%
(FPCore (x n) :precision binary64 0.0)
double code(double x, double n) {
return 0.0;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double x, double n) {
return 0.0;
}
def code(x, n): return 0.0
function code(x, n) return 0.0 end
function tmp = code(x, n) tmp = 0.0; end
code[x_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 54.2%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
lower--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6442.8
Applied rewrites42.8%
Taylor expanded in n around inf
Applied rewrites31.0%
metadata-eval31.0
Applied rewrites31.0%
herbie shell --seed 2024219
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))