
(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 16 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 (<= (/ 1.0 n) -0.0005)
(/ (/ 1.0 (pow x (/ -1.0 n))) (* n x))
(if (<= (/ 1.0 n) 2e-22)
(/
(-
(* (/ 0.5 n) (- (pow (log1p x) 2.0) (pow (log x) 2.0)))
(log (/ x (+ x 1.0))))
n)
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.0005) {
tmp = (1.0 / pow(x, (-1.0 / n))) / (n * x);
} else if ((1.0 / n) <= 2e-22) {
tmp = (((0.5 / n) * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) - log((x / (x + 1.0)))) / n;
} else {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.0005) {
tmp = (1.0 / Math.pow(x, (-1.0 / n))) / (n * x);
} else if ((1.0 / n) <= 2e-22) {
tmp = (((0.5 / n) * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) - Math.log((x / (x + 1.0)))) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -0.0005: tmp = (1.0 / math.pow(x, (-1.0 / n))) / (n * x) elif (1.0 / n) <= 2e-22: tmp = (((0.5 / n) * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0))) - math.log((x / (x + 1.0)))) / n else: tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -0.0005) tmp = Float64(Float64(1.0 / (x ^ Float64(-1.0 / n))) / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-22) tmp = Float64(Float64(Float64(Float64(0.5 / n) * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) - log(Float64(x / Float64(x + 1.0)))) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.0005], N[(N[(1.0 / N[Power[x, N[(-1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-22], N[(N[(N[(N[(0.5 / n), $MachinePrecision] * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -0.0005:\\
\;\;\;\;\frac{\frac{1}{{x}^{\left(\frac{-1}{n}\right)}}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\frac{\frac{0.5}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \log \left(\frac{x}{x + 1}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5.0000000000000001e-4Initial program 98.7%
Taylor expanded in x around inf
/-lowering-/.f64N/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
exp-negN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
metadata-evalN/A
distribute-neg-fracN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0%
Simplified100.0%
if -5.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22Initial program 31.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified79.2%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6479.6%
Applied egg-rr79.6%
if 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n) Initial program 64.3%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f64100.0%
Applied egg-rr100.0%
Final simplification87.9%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -0.0005)
(/ (/ 1.0 (pow x (/ -1.0 n))) (* n x))
(if (<= (/ 1.0 n) 2e-22)
(/ (log (/ x (+ x 1.0))) (- 0.0 n))
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.0005) {
tmp = (1.0 / pow(x, (-1.0 / n))) / (n * x);
} else if ((1.0 / n) <= 2e-22) {
tmp = log((x / (x + 1.0))) / (0.0 - n);
} else {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.0005) {
tmp = (1.0 / Math.pow(x, (-1.0 / n))) / (n * x);
} else if ((1.0 / n) <= 2e-22) {
tmp = Math.log((x / (x + 1.0))) / (0.0 - n);
} else {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -0.0005: tmp = (1.0 / math.pow(x, (-1.0 / n))) / (n * x) elif (1.0 / n) <= 2e-22: tmp = math.log((x / (x + 1.0))) / (0.0 - n) else: tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -0.0005) tmp = Float64(Float64(1.0 / (x ^ Float64(-1.0 / n))) / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-22) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)); else tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.0005], N[(N[(1.0 / N[Power[x, N[(-1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-22], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -0.0005:\\
\;\;\;\;\frac{\frac{1}{{x}^{\left(\frac{-1}{n}\right)}}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5.0000000000000001e-4Initial program 98.7%
Taylor expanded in x around inf
/-lowering-/.f64N/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
exp-negN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
metadata-evalN/A
distribute-neg-fracN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0%
Simplified100.0%
if -5.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22Initial program 31.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified79.2%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6479.6%
Applied egg-rr79.6%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6479.3%
Simplified79.3%
if 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n) Initial program 64.3%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f64100.0%
Applied egg-rr100.0%
Final simplification87.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ -1.0 n))))
(if (<= (/ 1.0 n) -0.0005)
(/ (/ 1.0 t_0) (* n x))
(if (<= (/ 1.0 n) 2e-22)
(/ (log (/ x (+ x 1.0))) (- 0.0 n))
(- (+ (/ -1.0 t_0) 1.0) (* x (/ (- -1.0 (* x (/ 0.5 n))) n)))))))
double code(double x, double n) {
double t_0 = pow(x, (-1.0 / n));
double tmp;
if ((1.0 / n) <= -0.0005) {
tmp = (1.0 / t_0) / (n * x);
} else if ((1.0 / n) <= 2e-22) {
tmp = log((x / (x + 1.0))) / (0.0 - n);
} else {
tmp = ((-1.0 / t_0) + 1.0) - (x * ((-1.0 - (x * (0.5 / n))) / n));
}
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 = x ** ((-1.0d0) / n)
if ((1.0d0 / n) <= (-0.0005d0)) then
tmp = (1.0d0 / t_0) / (n * x)
else if ((1.0d0 / n) <= 2d-22) then
tmp = log((x / (x + 1.0d0))) / (0.0d0 - n)
else
tmp = (((-1.0d0) / t_0) + 1.0d0) - (x * (((-1.0d0) - (x * (0.5d0 / n))) / n))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (-1.0 / n));
double tmp;
if ((1.0 / n) <= -0.0005) {
tmp = (1.0 / t_0) / (n * x);
} else if ((1.0 / n) <= 2e-22) {
tmp = Math.log((x / (x + 1.0))) / (0.0 - n);
} else {
tmp = ((-1.0 / t_0) + 1.0) - (x * ((-1.0 - (x * (0.5 / n))) / n));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (-1.0 / n)) tmp = 0 if (1.0 / n) <= -0.0005: tmp = (1.0 / t_0) / (n * x) elif (1.0 / n) <= 2e-22: tmp = math.log((x / (x + 1.0))) / (0.0 - n) else: tmp = ((-1.0 / t_0) + 1.0) - (x * ((-1.0 - (x * (0.5 / n))) / n)) return tmp
function code(x, n) t_0 = x ^ Float64(-1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.0005) tmp = Float64(Float64(1.0 / t_0) / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-22) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)); else tmp = Float64(Float64(Float64(-1.0 / t_0) + 1.0) - Float64(x * Float64(Float64(-1.0 - Float64(x * Float64(0.5 / n))) / n))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (-1.0 / n); tmp = 0.0; if ((1.0 / n) <= -0.0005) tmp = (1.0 / t_0) / (n * x); elseif ((1.0 / n) <= 2e-22) tmp = log((x / (x + 1.0))) / (0.0 - n); else tmp = ((-1.0 / t_0) + 1.0) - (x * ((-1.0 - (x * (0.5 / n))) / n)); end tmp_2 = 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], -0.0005], N[(N[(1.0 / t$95$0), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-22], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 / t$95$0), $MachinePrecision] + 1.0), $MachinePrecision] - N[(x * N[(N[(-1.0 - N[(x * N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{-1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.0005:\\
\;\;\;\;\frac{\frac{1}{t\_0}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{-1}{t\_0} + 1\right) - x \cdot \frac{-1 - x \cdot \frac{0.5}{n}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5.0000000000000001e-4Initial program 98.7%
Taylor expanded in x around inf
/-lowering-/.f64N/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
exp-negN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
metadata-evalN/A
distribute-neg-fracN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0%
Simplified100.0%
if -5.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22Initial program 31.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified79.2%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6479.6%
Applied egg-rr79.6%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6479.3%
Simplified79.3%
if 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n) Initial program 64.3%
Taylor expanded in x around 0
Simplified65.6%
Taylor expanded in n around inf
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6476.4%
Simplified76.4%
Taylor expanded in n around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6476.4%
Simplified76.4%
Final simplification84.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ -1.0 n))))
(if (<= (/ 1.0 n) -0.0005)
(/ (/ 1.0 t_0) (* n x))
(if (<= (/ 1.0 n) 2e-22)
(/ (log (/ x (+ x 1.0))) (- 0.0 n))
(+ (+ (/ -1.0 t_0) 1.0) (* x (/ (* x 0.5) (* n n))))))))
double code(double x, double n) {
double t_0 = pow(x, (-1.0 / n));
double tmp;
if ((1.0 / n) <= -0.0005) {
tmp = (1.0 / t_0) / (n * x);
} else if ((1.0 / n) <= 2e-22) {
tmp = log((x / (x + 1.0))) / (0.0 - n);
} else {
tmp = ((-1.0 / t_0) + 1.0) + (x * ((x * 0.5) / (n * n)));
}
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 = x ** ((-1.0d0) / n)
if ((1.0d0 / n) <= (-0.0005d0)) then
tmp = (1.0d0 / t_0) / (n * x)
else if ((1.0d0 / n) <= 2d-22) then
tmp = log((x / (x + 1.0d0))) / (0.0d0 - n)
else
tmp = (((-1.0d0) / t_0) + 1.0d0) + (x * ((x * 0.5d0) / (n * n)))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (-1.0 / n));
double tmp;
if ((1.0 / n) <= -0.0005) {
tmp = (1.0 / t_0) / (n * x);
} else if ((1.0 / n) <= 2e-22) {
tmp = Math.log((x / (x + 1.0))) / (0.0 - n);
} else {
tmp = ((-1.0 / t_0) + 1.0) + (x * ((x * 0.5) / (n * n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (-1.0 / n)) tmp = 0 if (1.0 / n) <= -0.0005: tmp = (1.0 / t_0) / (n * x) elif (1.0 / n) <= 2e-22: tmp = math.log((x / (x + 1.0))) / (0.0 - n) else: tmp = ((-1.0 / t_0) + 1.0) + (x * ((x * 0.5) / (n * n))) return tmp
function code(x, n) t_0 = x ^ Float64(-1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.0005) tmp = Float64(Float64(1.0 / t_0) / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-22) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)); else tmp = Float64(Float64(Float64(-1.0 / t_0) + 1.0) + Float64(x * Float64(Float64(x * 0.5) / Float64(n * n)))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (-1.0 / n); tmp = 0.0; if ((1.0 / n) <= -0.0005) tmp = (1.0 / t_0) / (n * x); elseif ((1.0 / n) <= 2e-22) tmp = log((x / (x + 1.0))) / (0.0 - n); else tmp = ((-1.0 / t_0) + 1.0) + (x * ((x * 0.5) / (n * n))); end tmp_2 = 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], -0.0005], N[(N[(1.0 / t$95$0), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-22], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 / t$95$0), $MachinePrecision] + 1.0), $MachinePrecision] + N[(x * N[(N[(x * 0.5), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{-1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.0005:\\
\;\;\;\;\frac{\frac{1}{t\_0}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{-1}{t\_0} + 1\right) + x \cdot \frac{x \cdot 0.5}{n \cdot n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5.0000000000000001e-4Initial program 98.7%
Taylor expanded in x around inf
/-lowering-/.f64N/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
exp-negN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
metadata-evalN/A
distribute-neg-fracN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0%
Simplified100.0%
if -5.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22Initial program 31.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified79.2%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6479.6%
Applied egg-rr79.6%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6479.3%
Simplified79.3%
if 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n) Initial program 64.3%
Taylor expanded in x around 0
Simplified65.6%
Taylor expanded in n around 0
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.5%
Simplified65.5%
Final simplification83.7%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -0.0005)
(/ (/ 1.0 (pow x (/ -1.0 n))) (* n x))
(if (<= (/ 1.0 n) 2e-22)
(/ (log (/ x (+ x 1.0))) (- 0.0 n))
(if (<= (/ 1.0 n) 4e+244)
(- (+ (/ x n) 1.0) (pow x (/ 1.0 n)))
(/ 1.0 (* n x))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.0005) {
tmp = (1.0 / pow(x, (-1.0 / n))) / (n * x);
} else if ((1.0 / n) <= 2e-22) {
tmp = log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 4e+244) {
tmp = ((x / n) + 1.0) - pow(x, (1.0 / 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) <= (-0.0005d0)) then
tmp = (1.0d0 / (x ** ((-1.0d0) / n))) / (n * x)
else if ((1.0d0 / n) <= 2d-22) then
tmp = log((x / (x + 1.0d0))) / (0.0d0 - n)
else if ((1.0d0 / n) <= 4d+244) then
tmp = ((x / n) + 1.0d0) - (x ** (1.0d0 / 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) <= -0.0005) {
tmp = (1.0 / Math.pow(x, (-1.0 / n))) / (n * x);
} else if ((1.0 / n) <= 2e-22) {
tmp = Math.log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 4e+244) {
tmp = ((x / n) + 1.0) - Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -0.0005: tmp = (1.0 / math.pow(x, (-1.0 / n))) / (n * x) elif (1.0 / n) <= 2e-22: tmp = math.log((x / (x + 1.0))) / (0.0 - n) elif (1.0 / n) <= 4e+244: tmp = ((x / n) + 1.0) - math.pow(x, (1.0 / n)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -0.0005) tmp = Float64(Float64(1.0 / (x ^ Float64(-1.0 / n))) / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-22) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)); elseif (Float64(1.0 / n) <= 4e+244) tmp = Float64(Float64(Float64(x / n) + 1.0) - (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -0.0005) tmp = (1.0 / (x ^ (-1.0 / n))) / (n * x); elseif ((1.0 / n) <= 2e-22) tmp = log((x / (x + 1.0))) / (0.0 - n); elseif ((1.0 / n) <= 4e+244) tmp = ((x / n) + 1.0) - (x ^ (1.0 / n)); else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.0005], N[(N[(1.0 / N[Power[x, N[(-1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-22], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+244], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -0.0005:\\
\;\;\;\;\frac{\frac{1}{{x}^{\left(\frac{-1}{n}\right)}}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+244}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5.0000000000000001e-4Initial program 98.7%
Taylor expanded in x around inf
/-lowering-/.f64N/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
exp-negN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
metadata-evalN/A
distribute-neg-fracN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0%
Simplified100.0%
if -5.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22Initial program 31.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified79.2%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6479.6%
Applied egg-rr79.6%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6479.3%
Simplified79.3%
if 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000003e244Initial program 76.5%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6470.8%
Simplified70.8%
if 4.0000000000000003e244 < (/.f64 #s(literal 1 binary64) n) Initial program 3.1%
flip3--N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
pow-powN/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
pow-powN/A
pow-lowering-pow.f64N/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
Applied egg-rr3.1%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
Simplified0.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0%
Simplified100.0%
Final simplification84.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e+167)
(- 1.0 t_0)
(if (<= (/ 1.0 n) 2e-22)
(/ (log (/ x (+ x 1.0))) (- 0.0 n))
(if (<= (/ 1.0 n) 4e+244) (- (+ (/ x n) 1.0) t_0) (/ 1.0 (* n x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e+167) {
tmp = 1.0 - t_0;
} else if ((1.0 / n) <= 2e-22) {
tmp = log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 4e+244) {
tmp = ((x / n) + 1.0) - t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d+167)) then
tmp = 1.0d0 - t_0
else if ((1.0d0 / n) <= 2d-22) then
tmp = log((x / (x + 1.0d0))) / (0.0d0 - n)
else if ((1.0d0 / n) <= 4d+244) then
tmp = ((x / n) + 1.0d0) - t_0
else
tmp = 1.0d0 / (n * 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 tmp;
if ((1.0 / n) <= -1e+167) {
tmp = 1.0 - t_0;
} else if ((1.0 / n) <= 2e-22) {
tmp = Math.log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 4e+244) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e+167: tmp = 1.0 - t_0 elif (1.0 / n) <= 2e-22: tmp = math.log((x / (x + 1.0))) / (0.0 - n) elif (1.0 / n) <= 4e+244: tmp = ((x / n) + 1.0) - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e+167) tmp = Float64(1.0 - t_0); elseif (Float64(1.0 / n) <= 2e-22) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)); elseif (Float64(1.0 / n) <= 4e+244) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e+167) tmp = 1.0 - t_0; elseif ((1.0 / n) <= 2e-22) tmp = log((x / (x + 1.0))) / (0.0 - n); elseif ((1.0 / n) <= 4e+244) tmp = ((x / n) + 1.0) - t_0; else tmp = 1.0 / (n * x); end tmp_2 = 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], -1e+167], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-22], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+244], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+167}:\\
\;\;\;\;1 - t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+244}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e167Initial program 100.0%
Taylor expanded in x around 0
Simplified70.2%
if -1e167 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22Initial program 47.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified75.7%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6476.0%
Applied egg-rr76.0%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6475.1%
Simplified75.1%
if 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000003e244Initial program 76.5%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6470.8%
Simplified70.8%
if 4.0000000000000003e244 < (/.f64 #s(literal 1 binary64) n) Initial program 3.1%
flip3--N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
pow-powN/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
pow-powN/A
pow-lowering-pow.f64N/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
Applied egg-rr3.1%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
Simplified0.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0%
Simplified100.0%
Final simplification74.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -1e+167)
t_0
(if (<= (/ 1.0 n) 2e-22)
(/ (log (/ x (+ x 1.0))) (- 0.0 n))
(if (<= (/ 1.0 n) 5e+234) t_0 (/ 1.0 (* n x)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e+167) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-22) {
tmp = log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 5e+234) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-1d+167)) then
tmp = t_0
else if ((1.0d0 / n) <= 2d-22) then
tmp = log((x / (x + 1.0d0))) / (0.0d0 - n)
else if ((1.0d0 / n) <= 5d+234) then
tmp = t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e+167) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-22) {
tmp = Math.log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 5e+234) {
tmp = t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e+167: tmp = t_0 elif (1.0 / n) <= 2e-22: tmp = math.log((x / (x + 1.0))) / (0.0 - n) elif (1.0 / n) <= 5e+234: tmp = t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -1e+167) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-22) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)); elseif (Float64(1.0 / n) <= 5e+234) tmp = t_0; else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -1e+167) tmp = t_0; elseif ((1.0 / n) <= 2e-22) tmp = log((x / (x + 1.0))) / (0.0 - n); elseif ((1.0 / n) <= 5e+234) tmp = t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+167], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-22], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+234], t$95$0, N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+167}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+234}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e167 or 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000003e234Initial program 90.0%
Taylor expanded in x around 0
Simplified70.9%
if -1e167 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22Initial program 47.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified75.7%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6476.0%
Applied egg-rr76.0%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6475.1%
Simplified75.1%
if 5.0000000000000003e234 < (/.f64 #s(literal 1 binary64) n) Initial program 17.0%
flip3--N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
pow-powN/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
pow-powN/A
pow-lowering-pow.f64N/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
Applied egg-rr17.0%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
Simplified0.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6486.2%
Simplified86.2%
Final simplification74.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -1e+167)
t_0
(if (<= (/ 1.0 n) 2e-22)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e+234) t_0 (/ 1.0 (* n x)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e+167) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-22) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+234) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-1d+167)) then
tmp = t_0
else if ((1.0d0 / n) <= 2d-22) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d+234) then
tmp = t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e+167) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-22) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+234) {
tmp = t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e+167: tmp = t_0 elif (1.0 / n) <= 2e-22: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e+234: tmp = t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -1e+167) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-22) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e+234) tmp = t_0; else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -1e+167) tmp = t_0; elseif ((1.0 / n) <= 2e-22) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e+234) tmp = t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+167], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-22], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+234], t$95$0, N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+167}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+234}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e167 or 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000003e234Initial program 90.0%
Taylor expanded in x around 0
Simplified70.9%
if -1e167 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22Initial program 47.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified75.7%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6476.0%
Applied egg-rr76.0%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6475.1%
Simplified75.1%
distribute-frac-neg2N/A
distribute-frac-negN/A
/-lowering-/.f64N/A
neg-logN/A
clear-numN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6475.1%
Applied egg-rr75.1%
if 5.0000000000000003e234 < (/.f64 #s(literal 1 binary64) n) Initial program 17.0%
flip3--N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
pow-powN/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
pow-powN/A
pow-lowering-pow.f64N/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
Applied egg-rr17.0%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
Simplified0.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6486.2%
Simplified86.2%
Final simplification74.6%
(FPCore (x n)
:precision binary64
(if (<= x 1.26e-266)
(- 0.0 (/ (log x) n))
(if (<= x 6.5e-223)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.88)
(/ (- x (log x)) n)
(if (<= x 6.5e+45)
(/
(/ (+ (/ (- (/ (+ 0.3333333333333333 (/ -0.25 x)) x) 0.5) x) 1.0) x)
n)
0.0)))))
double code(double x, double n) {
double tmp;
if (x <= 1.26e-266) {
tmp = 0.0 - (log(x) / n);
} else if (x <= 6.5e-223) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.88) {
tmp = (x - log(x)) / n;
} else if (x <= 6.5e+45) {
tmp = ((((((0.3333333333333333 + (-0.25 / x)) / x) - 0.5) / x) + 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.26d-266) then
tmp = 0.0d0 - (log(x) / n)
else if (x <= 6.5d-223) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.88d0) then
tmp = (x - log(x)) / n
else if (x <= 6.5d+45) then
tmp = ((((((0.3333333333333333d0 + ((-0.25d0) / x)) / x) - 0.5d0) / x) + 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.26e-266) {
tmp = 0.0 - (Math.log(x) / n);
} else if (x <= 6.5e-223) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.88) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 6.5e+45) {
tmp = ((((((0.3333333333333333 + (-0.25 / x)) / x) - 0.5) / x) + 1.0) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.26e-266: tmp = 0.0 - (math.log(x) / n) elif x <= 6.5e-223: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.88: tmp = (x - math.log(x)) / n elif x <= 6.5e+45: tmp = ((((((0.3333333333333333 + (-0.25 / x)) / x) - 0.5) / x) + 1.0) / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1.26e-266) tmp = Float64(0.0 - Float64(log(x) / n)); elseif (x <= 6.5e-223) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.88) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 6.5e+45) tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(-0.25 / x)) / x) - 0.5) / x) + 1.0) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.26e-266) tmp = 0.0 - (log(x) / n); elseif (x <= 6.5e-223) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.88) tmp = (x - log(x)) / n; elseif (x <= 6.5e+45) tmp = ((((((0.3333333333333333 + (-0.25 / x)) / x) - 0.5) / x) + 1.0) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.26e-266], N[(0.0 - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.5e-223], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 6.5e+45], N[(N[(N[(N[(N[(N[(N[(0.3333333333333333 + N[(-0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision] + 1.0), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.26 \cdot 10^{-266}:\\
\;\;\;\;0 - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-223}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+45}:\\
\;\;\;\;\frac{\frac{\frac{\frac{0.3333333333333333 + \frac{-0.25}{x}}{x} - 0.5}{x} + 1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.26000000000000008e-266Initial program 40.0%
Taylor expanded in x around 0
Simplified40.0%
Taylor expanded in n around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6466.1%
Simplified66.1%
if 1.26000000000000008e-266 < x < 6.4999999999999996e-223Initial program 68.6%
Taylor expanded in x around 0
Simplified68.6%
if 6.4999999999999996e-223 < x < 0.880000000000000004Initial program 36.2%
Taylor expanded in x around 0
Simplified29.4%
Taylor expanded in n around inf
/-lowering-/.f64N/A
mul-1-negN/A
log-recN/A
+-commutativeN/A
log-recN/A
sub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6460.0%
Simplified60.0%
Taylor expanded in x around 0
--lowering--.f64N/A
log-lowering-log.f6459.7%
Simplified59.7%
if 0.880000000000000004 < x < 6.50000000000000034e45Initial program 21.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified28.1%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6432.2%
Applied egg-rr32.2%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6432.2%
Simplified32.2%
Taylor expanded in x around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
Simplified85.9%
if 6.50000000000000034e45 < x Initial program 78.3%
Taylor expanded in x around 0
Simplified42.3%
Taylor expanded in n around inf
Simplified78.3%
metadata-eval78.3%
Applied egg-rr78.3%
Final simplification69.7%
(FPCore (x n)
:precision binary64
(if (<= x 0.88)
(/ (- x (log x)) n)
(if (<= x 1.95e+42)
(/ (/ (+ (/ (- (/ (+ 0.3333333333333333 (/ -0.25 x)) x) 0.5) x) 1.0) x) n)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.88) {
tmp = (x - log(x)) / n;
} else if (x <= 1.95e+42) {
tmp = ((((((0.3333333333333333 + (-0.25 / x)) / x) - 0.5) / x) + 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 <= 0.88d0) then
tmp = (x - log(x)) / n
else if (x <= 1.95d+42) then
tmp = ((((((0.3333333333333333d0 + ((-0.25d0) / x)) / x) - 0.5d0) / x) + 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 <= 0.88) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 1.95e+42) {
tmp = ((((((0.3333333333333333 + (-0.25 / x)) / x) - 0.5) / x) + 1.0) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.88: tmp = (x - math.log(x)) / n elif x <= 1.95e+42: tmp = ((((((0.3333333333333333 + (-0.25 / x)) / x) - 0.5) / x) + 1.0) / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.88) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 1.95e+42) tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(-0.25 / x)) / x) - 0.5) / x) + 1.0) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.88) tmp = (x - log(x)) / n; elseif (x <= 1.95e+42) tmp = ((((((0.3333333333333333 + (-0.25 / x)) / x) - 0.5) / x) + 1.0) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.88], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.95e+42], N[(N[(N[(N[(N[(N[(N[(0.3333333333333333 + N[(-0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision] + 1.0), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.88:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+42}:\\
\;\;\;\;\frac{\frac{\frac{\frac{0.3333333333333333 + \frac{-0.25}{x}}{x} - 0.5}{x} + 1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.880000000000000004Initial program 42.1%
Taylor expanded in x around 0
Simplified29.7%
Taylor expanded in n around inf
/-lowering-/.f64N/A
mul-1-negN/A
log-recN/A
+-commutativeN/A
log-recN/A
sub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6455.8%
Simplified55.8%
Taylor expanded in x around 0
--lowering--.f64N/A
log-lowering-log.f6455.6%
Simplified55.6%
if 0.880000000000000004 < x < 1.94999999999999985e42Initial program 21.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified28.1%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6432.2%
Applied egg-rr32.2%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6432.2%
Simplified32.2%
Taylor expanded in x around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
Simplified85.9%
if 1.94999999999999985e42 < x Initial program 78.3%
Taylor expanded in x around 0
Simplified42.3%
Taylor expanded in n around inf
Simplified78.3%
metadata-eval78.3%
Applied egg-rr78.3%
Final simplification66.1%
(FPCore (x n)
:precision binary64
(if (<= x 0.7)
(- 0.0 (/ (log x) n))
(if (<= x 1.8e+44)
(/ (/ (+ (/ (- (/ (+ 0.3333333333333333 (/ -0.25 x)) x) 0.5) x) 1.0) x) n)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.7) {
tmp = 0.0 - (log(x) / n);
} else if (x <= 1.8e+44) {
tmp = ((((((0.3333333333333333 + (-0.25 / x)) / x) - 0.5) / x) + 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 <= 0.7d0) then
tmp = 0.0d0 - (log(x) / n)
else if (x <= 1.8d+44) then
tmp = ((((((0.3333333333333333d0 + ((-0.25d0) / x)) / x) - 0.5d0) / x) + 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 <= 0.7) {
tmp = 0.0 - (Math.log(x) / n);
} else if (x <= 1.8e+44) {
tmp = ((((((0.3333333333333333 + (-0.25 / x)) / x) - 0.5) / x) + 1.0) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.7: tmp = 0.0 - (math.log(x) / n) elif x <= 1.8e+44: tmp = ((((((0.3333333333333333 + (-0.25 / x)) / x) - 0.5) / x) + 1.0) / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.7) tmp = Float64(0.0 - Float64(log(x) / n)); elseif (x <= 1.8e+44) tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(-0.25 / x)) / x) - 0.5) / x) + 1.0) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.7) tmp = 0.0 - (log(x) / n); elseif (x <= 1.8e+44) tmp = ((((((0.3333333333333333 + (-0.25 / x)) / x) - 0.5) / x) + 1.0) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.7], N[(0.0 - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e+44], N[(N[(N[(N[(N[(N[(N[(0.3333333333333333 + N[(-0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision] + 1.0), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.7:\\
\;\;\;\;0 - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+44}:\\
\;\;\;\;\frac{\frac{\frac{\frac{0.3333333333333333 + \frac{-0.25}{x}}{x} - 0.5}{x} + 1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.69999999999999996Initial program 42.1%
Taylor expanded in x around 0
Simplified41.0%
Taylor expanded in n around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6455.0%
Simplified55.0%
if 0.69999999999999996 < x < 1.8e44Initial program 21.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified28.1%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6432.2%
Applied egg-rr32.2%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6432.2%
Simplified32.2%
Taylor expanded in x around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
Simplified85.9%
if 1.8e44 < x Initial program 78.3%
Taylor expanded in x around 0
Simplified42.3%
Taylor expanded in n around inf
Simplified78.3%
metadata-eval78.3%
Applied egg-rr78.3%
Final simplification65.7%
(FPCore (x n) :precision binary64 (if (<= x 6.5e+45) (/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x)) x) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 6.5e+45) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / 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 <= 6.5d+45) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 6.5e+45) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 6.5e+45: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 6.5e+45) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 6.5e+45) tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 6.5e+45], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{+45}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 6.50000000000000034e45Initial program 40.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified63.9%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6464.3%
Applied egg-rr64.3%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6453.8%
Simplified53.8%
Taylor expanded in x around -inf
associate-*r/N/A
mul-1-negN/A
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
remove-double-negN/A
/-lowering-/.f64N/A
Simplified33.2%
if 6.50000000000000034e45 < x Initial program 78.3%
Taylor expanded in x around 0
Simplified42.3%
Taylor expanded in n around inf
Simplified78.3%
metadata-eval78.3%
Applied egg-rr78.3%
Final simplification50.3%
(FPCore (x n) :precision binary64 (if (<= x 8.5e+44) (/ (/ (+ 1.0 (/ (- (/ 0.3333333333333333 x) 0.5) x)) x) n) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 8.5e+44) {
tmp = ((1.0 + (((0.3333333333333333 / x) - 0.5) / x)) / 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 <= 8.5d+44) then
tmp = ((1.0d0 + (((0.3333333333333333d0 / x) - 0.5d0) / x)) / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 8.5e+44) {
tmp = ((1.0 + (((0.3333333333333333 / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 8.5e+44: tmp = ((1.0 + (((0.3333333333333333 / x) - 0.5) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 8.5e+44) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 / x) - 0.5) / x)) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 8.5e+44) tmp = ((1.0 + (((0.3333333333333333 / x) - 0.5) / x)) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 8.5e+44], N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.5 \cdot 10^{+44}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 8.5e44Initial program 40.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified63.9%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6464.3%
Applied egg-rr64.3%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6453.8%
Simplified53.8%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified33.1%
if 8.5e44 < x Initial program 78.3%
Taylor expanded in x around 0
Simplified42.3%
Taylor expanded in n around inf
Simplified78.3%
metadata-eval78.3%
Applied egg-rr78.3%
Final simplification50.2%
(FPCore (x n) :precision binary64 (let* ((t_0 (/ (/ 1.0 n) x))) (if (<= n -7.0) t_0 (if (<= n -9e-168) 0.0 t_0))))
double code(double x, double n) {
double t_0 = (1.0 / n) / x;
double tmp;
if (n <= -7.0) {
tmp = t_0;
} else if (n <= -9e-168) {
tmp = 0.0;
} else {
tmp = t_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 = (1.0d0 / n) / x
if (n <= (-7.0d0)) then
tmp = t_0
else if (n <= (-9d-168)) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (1.0 / n) / x;
double tmp;
if (n <= -7.0) {
tmp = t_0;
} else if (n <= -9e-168) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = (1.0 / n) / x tmp = 0 if n <= -7.0: tmp = t_0 elif n <= -9e-168: tmp = 0.0 else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(Float64(1.0 / n) / x) tmp = 0.0 if (n <= -7.0) tmp = t_0; elseif (n <= -9e-168) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = (1.0 / n) / x; tmp = 0.0; if (n <= -7.0) tmp = t_0; elseif (n <= -9e-168) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[n, -7.0], t$95$0, If[LessEqual[n, -9e-168], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{n}}{x}\\
\mathbf{if}\;n \leq -7:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -9 \cdot 10^{-168}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -7 or -9.0000000000000002e-168 < n Initial program 44.3%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified70.2%
diff-logN/A
+-commutativeN/A
clear-numN/A
log-recN/A
neg-lowering-neg.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6470.5%
Applied egg-rr70.5%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6463.1%
Simplified63.1%
Taylor expanded in x around inf
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f6447.5%
Simplified47.5%
if -7 < n < -9.0000000000000002e-168Initial program 100.0%
Taylor expanded in x around 0
Simplified38.2%
Taylor expanded in n around inf
Simplified64.4%
metadata-eval64.4%
Applied egg-rr64.4%
(FPCore (x n) :precision binary64 (let* ((t_0 (/ 1.0 (* n x)))) (if (<= n -2.9) t_0 (if (<= n -1.35e-167) 0.0 t_0))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double tmp;
if (n <= -2.9) {
tmp = t_0;
} else if (n <= -1.35e-167) {
tmp = 0.0;
} else {
tmp = t_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 = 1.0d0 / (n * x)
if (n <= (-2.9d0)) then
tmp = t_0
else if (n <= (-1.35d-167)) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double tmp;
if (n <= -2.9) {
tmp = t_0;
} else if (n <= -1.35e-167) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = 1.0 / (n * x) tmp = 0 if n <= -2.9: tmp = t_0 elif n <= -1.35e-167: tmp = 0.0 else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) tmp = 0.0 if (n <= -2.9) tmp = t_0; elseif (n <= -1.35e-167) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 / (n * x); tmp = 0.0; if (n <= -2.9) tmp = t_0; elseif (n <= -1.35e-167) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.9], t$95$0, If[LessEqual[n, -1.35e-167], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
\mathbf{if}\;n \leq -2.9:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.35 \cdot 10^{-167}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.89999999999999991 or -1.35e-167 < n Initial program 44.3%
flip3--N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
pow-powN/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
pow-powN/A
pow-lowering-pow.f64N/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
Applied egg-rr31.4%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
Simplified35.8%
Taylor expanded in n around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6446.5%
Simplified46.5%
if -2.89999999999999991 < n < -1.35e-167Initial program 100.0%
Taylor expanded in x around 0
Simplified38.2%
Taylor expanded in n around inf
Simplified64.4%
metadata-eval64.4%
Applied egg-rr64.4%
Final simplification49.8%
(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.5%
Taylor expanded in x around 0
Simplified39.5%
Taylor expanded in n around inf
Simplified33.1%
metadata-eval33.1%
Applied egg-rr33.1%
herbie shell --seed 2024140
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))