
(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 14 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 1500.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)
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 1500.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 = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
function code(x, n) tmp = 0.0 if (x <= 1500.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((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
code[x_, n_] := If[LessEqual[x, 1500.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[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1500:\\
\;\;\;\;\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{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 1500Initial program 41.6%
Taylor expanded in n around -inf
Simplified78.2%
if 1500 < x Initial program 69.6%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6469.0
Applied egg-rr69.0%
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
metadata-evalN/A
distribute-neg-fracN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6497.4
Simplified97.4%
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
pow-flipN/A
distribute-neg-fracN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6499.3
Applied egg-rr99.3%
Final simplification88.0%
(FPCore (x n)
:precision binary64
(if (<= x 245.0)
(*
(/ 1.0 n)
(-
(/
(fma
0.5
(* (log (* x (+ x 1.0))) (log (/ (+ x 1.0) x)))
(* (- (pow (log1p x) 3.0) (pow (log x) 3.0)) (/ 0.16666666666666666 n)))
n)
(log (/ x (+ x 1.0)))))
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 245.0) {
tmp = (1.0 / n) * ((fma(0.5, (log((x * (x + 1.0))) * log(((x + 1.0) / x))), ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) * (0.16666666666666666 / n))) / n) - log((x / (x + 1.0))));
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
function code(x, n) tmp = 0.0 if (x <= 245.0) tmp = Float64(Float64(1.0 / n) * Float64(Float64(fma(0.5, Float64(log(Float64(x * Float64(x + 1.0))) * log(Float64(Float64(x + 1.0) / x))), Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) * Float64(0.16666666666666666 / n))) / n) - log(Float64(x / Float64(x + 1.0))))); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
code[x_, n_] := If[LessEqual[x, 245.0], N[(N[(1.0 / n), $MachinePrecision] * N[(N[(N[(0.5 * N[(N[Log[N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] * N[(0.16666666666666666 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 245:\\
\;\;\;\;\frac{1}{n} \cdot \left(\frac{\mathsf{fma}\left(0.5, \log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right), \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) \cdot \frac{0.16666666666666666}{n}\right)}{n} - \log \left(\frac{x}{x + 1}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 245Initial program 41.6%
Taylor expanded in n around -inf
Simplified78.2%
Applied egg-rr78.1%
if 245 < x Initial program 69.6%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6469.0
Applied egg-rr69.0%
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
metadata-evalN/A
distribute-neg-fracN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6497.4
Simplified97.4%
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
pow-flipN/A
distribute-neg-fracN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6499.3
Applied egg-rr99.3%
Final simplification87.9%
(FPCore (x n)
:precision binary64
(if (<= x 0.46)
(/
(+
(log x)
(/
(fma
0.5
(pow (log x) 2.0)
(* (pow (log x) 3.0) (/ 0.16666666666666666 n)))
n))
(- 0.0 n))
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 0.46) {
tmp = (log(x) + (fma(0.5, pow(log(x), 2.0), (pow(log(x), 3.0) * (0.16666666666666666 / n))) / n)) / (0.0 - n);
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
function code(x, n) tmp = 0.0 if (x <= 0.46) tmp = Float64(Float64(log(x) + Float64(fma(0.5, (log(x) ^ 2.0), Float64((log(x) ^ 3.0) * Float64(0.16666666666666666 / n))) / n)) / Float64(0.0 - n)); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
code[x_, n_] := If[LessEqual[x, 0.46], N[(N[(N[Log[x], $MachinePrecision] + N[(N[(0.5 * N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] * N[(0.16666666666666666 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.46:\\
\;\;\;\;\frac{\log x + \frac{\mathsf{fma}\left(0.5, {\log x}^{2}, {\log x}^{3} \cdot \frac{0.16666666666666666}{n}\right)}{n}}{0 - n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 0.46000000000000002Initial program 41.6%
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
--lowering--.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
pow-lowering-pow.f64N/A
/-lowering-/.f6440.9
Simplified40.9%
Taylor expanded in n around -inf
Simplified67.6%
Taylor expanded in n around inf
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
pow-lowering-pow.f64N/A
log-lowering-log.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
log-lowering-log.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6477.8
Simplified77.8%
if 0.46000000000000002 < x Initial program 69.6%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6469.0
Applied egg-rr69.0%
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
metadata-evalN/A
distribute-neg-fracN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6497.4
Simplified97.4%
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
pow-flipN/A
distribute-neg-fracN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6499.3
Applied egg-rr99.3%
Final simplification87.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 1.1e-83)
(* x (fma (log x) (/ -1.0 (* x n)) (/ 1.0 n)))
(if (<= x 0.88) (- (exp (/ (log1p x) n)) t_0) (/ (/ t_0 n) x)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 1.1e-83) {
tmp = x * fma(log(x), (-1.0 / (x * n)), (1.0 / n));
} else if (x <= 0.88) {
tmp = exp((log1p(x) / n)) - t_0;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 1.1e-83) tmp = Float64(x * fma(log(x), Float64(-1.0 / Float64(x * n)), Float64(1.0 / n))); elseif (x <= 0.88) tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.1e-83], N[(x * N[(N[Log[x], $MachinePrecision] * N[(-1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 1.1 \cdot 10^{-83}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(\log x, \frac{-1}{x \cdot n}, \frac{1}{n}\right)\\
\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < 1.10000000000000004e-83Initial program 44.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-/.f6444.8
Simplified44.8%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
log-lowering-log.f6453.7
Simplified53.7%
Taylor expanded in x around inf
*-lowering-*.f64N/A
log-recN/A
distribute-frac-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6478.3
Simplified78.3%
sub-negN/A
+-commutativeN/A
div-invN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6478.3
Applied egg-rr78.3%
if 1.10000000000000004e-83 < x < 0.880000000000000004Initial program 33.4%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6466.1
Applied egg-rr66.1%
if 0.880000000000000004 < x Initial program 69.6%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6469.0
Applied egg-rr69.0%
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
metadata-evalN/A
distribute-neg-fracN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6497.4
Simplified97.4%
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
pow-flipN/A
distribute-neg-fracN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6499.3
Applied egg-rr99.3%
Final simplification86.3%
(FPCore (x n) :precision binary64 (if (<= x 0.35) (* x (fma (log x) (/ -1.0 (* x n)) (/ 1.0 n))) (/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 0.35) {
tmp = x * fma(log(x), (-1.0 / (x * n)), (1.0 / n));
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
function code(x, n) tmp = 0.0 if (x <= 0.35) tmp = Float64(x * fma(log(x), Float64(-1.0 / Float64(x * n)), Float64(1.0 / n))); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
code[x_, n_] := If[LessEqual[x, 0.35], N[(x * N[(N[Log[x], $MachinePrecision] * N[(-1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.35:\\
\;\;\;\;x \cdot \mathsf{fma}\left(\log x, \frac{-1}{x \cdot n}, \frac{1}{n}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 0.34999999999999998Initial program 41.6%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6441.3
Simplified41.3%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
log-lowering-log.f6449.9
Simplified49.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
log-recN/A
distribute-frac-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6470.7
Simplified70.7%
sub-negN/A
+-commutativeN/A
div-invN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6470.7
Applied egg-rr70.7%
if 0.34999999999999998 < x Initial program 69.6%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6469.0
Applied egg-rr69.0%
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
metadata-evalN/A
distribute-neg-fracN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6497.4
Simplified97.4%
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
pow-flipN/A
distribute-neg-fracN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6499.3
Applied egg-rr99.3%
Final simplification84.0%
(FPCore (x n) :precision binary64 (if (<= x 0.33) (* x (- (/ 1.0 n) (/ (log x) (* x n)))) (/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 0.33) {
tmp = x * ((1.0 / n) - (log(x) / (x * n)));
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.33d0) then
tmp = x * ((1.0d0 / n) - (log(x) / (x * n)))
else
tmp = ((x ** (1.0d0 / n)) / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.33) {
tmp = x * ((1.0 / n) - (Math.log(x) / (x * n)));
} else {
tmp = (Math.pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.33: tmp = x * ((1.0 / n) - (math.log(x) / (x * n))) else: tmp = (math.pow(x, (1.0 / n)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 0.33) tmp = Float64(x * Float64(Float64(1.0 / n) - Float64(log(x) / Float64(x * n)))); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.33) tmp = x * ((1.0 / n) - (log(x) / (x * n))); else tmp = ((x ^ (1.0 / n)) / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.33], N[(x * N[(N[(1.0 / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.33:\\
\;\;\;\;x \cdot \left(\frac{1}{n} - \frac{\log x}{x \cdot n}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 0.330000000000000016Initial program 41.6%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6441.3
Simplified41.3%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
log-lowering-log.f6449.9
Simplified49.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
log-recN/A
distribute-frac-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6470.7
Simplified70.7%
if 0.330000000000000016 < x Initial program 69.6%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6469.0
Applied egg-rr69.0%
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
metadata-evalN/A
distribute-neg-fracN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6497.4
Simplified97.4%
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
pow-flipN/A
distribute-neg-fracN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6499.3
Applied egg-rr99.3%
(FPCore (x n) :precision binary64 (if (<= x 0.33) (* x (/ (log x) (- 0.0 (* x n)))) (/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 0.33) {
tmp = x * (log(x) / (0.0 - (x * n)));
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.33d0) then
tmp = x * (log(x) / (0.0d0 - (x * n)))
else
tmp = ((x ** (1.0d0 / n)) / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.33) {
tmp = x * (Math.log(x) / (0.0 - (x * n)));
} else {
tmp = (Math.pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.33: tmp = x * (math.log(x) / (0.0 - (x * n))) else: tmp = (math.pow(x, (1.0 / n)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 0.33) tmp = Float64(x * Float64(log(x) / Float64(0.0 - Float64(x * n)))); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.33) tmp = x * (log(x) / (0.0 - (x * n))); else tmp = ((x ^ (1.0 / n)) / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.33], N[(x * N[(N[Log[x], $MachinePrecision] / N[(0.0 - N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.33:\\
\;\;\;\;x \cdot \frac{\log x}{0 - x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 0.330000000000000016Initial program 41.6%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6441.3
Simplified41.3%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
log-lowering-log.f6449.9
Simplified49.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
log-recN/A
distribute-frac-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6470.7
Simplified70.7%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6466.7
Simplified66.7%
if 0.330000000000000016 < x Initial program 69.6%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6469.0
Applied egg-rr69.0%
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
metadata-evalN/A
distribute-neg-fracN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6497.4
Simplified97.4%
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
pow-flipN/A
distribute-neg-fracN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6499.3
Applied egg-rr99.3%
Final simplification81.8%
(FPCore (x n) :precision binary64 (if (<= x 0.33) (* x (/ (log x) (- 0.0 (* x n)))) (/ 1.0 (* n (* x (pow x (/ -1.0 n)))))))
double code(double x, double n) {
double tmp;
if (x <= 0.33) {
tmp = x * (log(x) / (0.0 - (x * n)));
} else {
tmp = 1.0 / (n * (x * pow(x, (-1.0 / n))));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.33d0) then
tmp = x * (log(x) / (0.0d0 - (x * n)))
else
tmp = 1.0d0 / (n * (x * (x ** ((-1.0d0) / n))))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.33) {
tmp = x * (Math.log(x) / (0.0 - (x * n)));
} else {
tmp = 1.0 / (n * (x * Math.pow(x, (-1.0 / n))));
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.33: tmp = x * (math.log(x) / (0.0 - (x * n))) else: tmp = 1.0 / (n * (x * math.pow(x, (-1.0 / n)))) return tmp
function code(x, n) tmp = 0.0 if (x <= 0.33) tmp = Float64(x * Float64(log(x) / Float64(0.0 - Float64(x * n)))); else tmp = Float64(1.0 / Float64(n * Float64(x * (x ^ Float64(-1.0 / n))))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.33) tmp = x * (log(x) / (0.0 - (x * n))); else tmp = 1.0 / (n * (x * (x ^ (-1.0 / n)))); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.33], N[(x * N[(N[Log[x], $MachinePrecision] / N[(0.0 - N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(n * N[(x * N[Power[x, N[(-1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.33:\\
\;\;\;\;x \cdot \frac{\log x}{0 - x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot \left(x \cdot {x}^{\left(\frac{-1}{n}\right)}\right)}\\
\end{array}
\end{array}
if x < 0.330000000000000016Initial program 41.6%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6441.3
Simplified41.3%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
log-lowering-log.f6449.9
Simplified49.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
log-recN/A
distribute-frac-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6470.7
Simplified70.7%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6466.7
Simplified66.7%
if 0.330000000000000016 < x Initial program 69.6%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6469.0
Applied egg-rr69.0%
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
metadata-evalN/A
distribute-neg-fracN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6497.4
Simplified97.4%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
mul-1-negN/A
log-recN/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6497.4
Simplified97.4%
Final simplification81.0%
(FPCore (x n) :precision binary64 (if (<= x 0.33) (* x (/ (log x) (- 0.0 (* x n)))) (/ (pow x (/ 1.0 n)) (* x n))))
double code(double x, double n) {
double tmp;
if (x <= 0.33) {
tmp = x * (log(x) / (0.0 - (x * n)));
} else {
tmp = pow(x, (1.0 / n)) / (x * n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.33d0) then
tmp = x * (log(x) / (0.0d0 - (x * n)))
else
tmp = (x ** (1.0d0 / n)) / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.33) {
tmp = x * (Math.log(x) / (0.0 - (x * n)));
} else {
tmp = Math.pow(x, (1.0 / n)) / (x * n);
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.33: tmp = x * (math.log(x) / (0.0 - (x * n))) else: tmp = math.pow(x, (1.0 / n)) / (x * n) return tmp
function code(x, n) tmp = 0.0 if (x <= 0.33) tmp = Float64(x * Float64(log(x) / Float64(0.0 - Float64(x * n)))); else tmp = Float64((x ^ Float64(1.0 / n)) / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.33) tmp = x * (log(x) / (0.0 - (x * n))); else tmp = (x ^ (1.0 / n)) / (x * n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.33], N[(x * N[(N[Log[x], $MachinePrecision] / N[(0.0 - N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.33:\\
\;\;\;\;x \cdot \frac{\log x}{0 - x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{x \cdot n}\\
\end{array}
\end{array}
if x < 0.330000000000000016Initial program 41.6%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6441.3
Simplified41.3%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
log-lowering-log.f6449.9
Simplified49.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
log-recN/A
distribute-frac-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6470.7
Simplified70.7%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6466.7
Simplified66.7%
if 0.330000000000000016 < x Initial program 69.6%
Taylor expanded in x around inf
/-lowering-/.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
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6497.4
Simplified97.4%
Final simplification81.0%
(FPCore (x n) :precision binary64 (if (<= x 0.32) (* x (/ (log x) (- 0.0 (* x n)))) (if (<= x 2e+143) (/ 1.0 (* x n)) 0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.32) {
tmp = x * (log(x) / (0.0 - (x * n)));
} else if (x <= 2e+143) {
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 <= 0.32d0) then
tmp = x * (log(x) / (0.0d0 - (x * n)))
else if (x <= 2d+143) 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 <= 0.32) {
tmp = x * (Math.log(x) / (0.0 - (x * n)));
} else if (x <= 2e+143) {
tmp = 1.0 / (x * n);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.32: tmp = x * (math.log(x) / (0.0 - (x * n))) elif x <= 2e+143: tmp = 1.0 / (x * n) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.32) tmp = Float64(x * Float64(log(x) / Float64(0.0 - Float64(x * n)))); elseif (x <= 2e+143) 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 <= 0.32) tmp = x * (log(x) / (0.0 - (x * n))); elseif (x <= 2e+143) tmp = 1.0 / (x * n); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.32], N[(x * N[(N[Log[x], $MachinePrecision] / N[(0.0 - N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e+143], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.32:\\
\;\;\;\;x \cdot \frac{\log x}{0 - x \cdot n}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+143}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.320000000000000007Initial program 41.1%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6441.5
Simplified41.5%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
log-lowering-log.f6450.2
Simplified50.2%
Taylor expanded in x around inf
*-lowering-*.f64N/A
log-recN/A
distribute-frac-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6471.2
Simplified71.2%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6467.2
Simplified67.2%
if 0.320000000000000007 < x < 2e143Initial program 52.2%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6452.1
Applied egg-rr52.1%
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
metadata-evalN/A
distribute-neg-fracN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6495.2
Simplified95.2%
Taylor expanded in n around inf
Simplified59.8%
if 2e143 < x Initial program 83.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
--lowering--.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
pow-lowering-pow.f64N/A
/-lowering-/.f6454.8
Simplified54.8%
Taylor expanded in n around inf
Simplified83.0%
metadata-eval83.0
Applied egg-rr83.0%
Final simplification69.9%
(FPCore (x n)
:precision binary64
(if (<= x 3.4e-190)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.32)
(/ (- x (log x)) n)
(if (<= x 1.15e+145) (/ 1.0 (* x n)) 0.0))))
double code(double x, double n) {
double tmp;
if (x <= 3.4e-190) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.32) {
tmp = (x - log(x)) / n;
} else if (x <= 1.15e+145) {
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 <= 3.4d-190) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.32d0) then
tmp = (x - log(x)) / n
else if (x <= 1.15d+145) 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 <= 3.4e-190) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.32) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 1.15e+145) {
tmp = 1.0 / (x * n);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 3.4e-190: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.32: tmp = (x - math.log(x)) / n elif x <= 1.15e+145: tmp = 1.0 / (x * n) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 3.4e-190) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.32) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 1.15e+145) 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 <= 3.4e-190) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.32) tmp = (x - log(x)) / n; elseif (x <= 1.15e+145) tmp = 1.0 / (x * n); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 3.4e-190], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.32], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.15e+145], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.4 \cdot 10^{-190}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.32:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+145}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3.39999999999999981e-190Initial program 60.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
--lowering--.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
pow-lowering-pow.f64N/A
/-lowering-/.f6460.2
Simplified60.2%
if 3.39999999999999981e-190 < x < 0.320000000000000007Initial program 29.7%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6430.1
Simplified30.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
log-lowering-log.f6452.9
Simplified52.9%
if 0.320000000000000007 < x < 1.15e145Initial program 52.2%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6452.1
Applied egg-rr52.1%
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
metadata-evalN/A
distribute-neg-fracN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6495.2
Simplified95.2%
Taylor expanded in n around inf
Simplified59.8%
if 1.15e145 < x Initial program 83.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
--lowering--.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
pow-lowering-pow.f64N/A
/-lowering-/.f6454.8
Simplified54.8%
Taylor expanded in n around inf
Simplified83.0%
metadata-eval83.0
Applied egg-rr83.0%
(FPCore (x n) :precision binary64 (if (<= x 0.32) (/ (- x (log x)) n) (if (<= x 2.8e+143) (/ 1.0 (* x n)) 0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.32) {
tmp = (x - log(x)) / n;
} else if (x <= 2.8e+143) {
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 <= 0.32d0) then
tmp = (x - log(x)) / n
else if (x <= 2.8d+143) 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 <= 0.32) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 2.8e+143) {
tmp = 1.0 / (x * n);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.32: tmp = (x - math.log(x)) / n elif x <= 2.8e+143: tmp = 1.0 / (x * n) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.32) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 2.8e+143) 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 <= 0.32) tmp = (x - log(x)) / n; elseif (x <= 2.8e+143) tmp = 1.0 / (x * n); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.32], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 2.8e+143], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.32:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+143}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.320000000000000007Initial program 41.1%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6441.5
Simplified41.5%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
log-lowering-log.f6450.2
Simplified50.2%
if 0.320000000000000007 < x < 2.79999999999999998e143Initial program 52.2%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6452.1
Applied egg-rr52.1%
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
metadata-evalN/A
distribute-neg-fracN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6495.2
Simplified95.2%
Taylor expanded in n around inf
Simplified59.8%
if 2.79999999999999998e143 < x Initial program 83.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
--lowering--.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
pow-lowering-pow.f64N/A
/-lowering-/.f6454.8
Simplified54.8%
Taylor expanded in n around inf
Simplified83.0%
metadata-eval83.0
Applied egg-rr83.0%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -1.0) 0.0 (/ 1.0 (* x n))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = 0.0;
} else {
tmp = 1.0 / (x * n);
}
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) <= (-1.0d0)) then
tmp = 0.0d0
else
tmp = 1.0d0 / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = 0.0;
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1.0: tmp = 0.0 else: tmp = 1.0 / (x * n) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1.0) tmp = 0.0; else tmp = Float64(1.0 / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1.0) tmp = 0.0; else tmp = 1.0 / (x * n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.0], 0.0, N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1Initial program 100.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
--lowering--.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
pow-lowering-pow.f64N/A
/-lowering-/.f6448.1
Simplified48.1%
Taylor expanded in n around inf
Simplified54.3%
metadata-eval54.3
Applied egg-rr54.3%
if -1 < (/.f64 #s(literal 1 binary64) n) Initial program 37.9%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6448.4
Applied egg-rr48.4%
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
metadata-evalN/A
distribute-neg-fracN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6444.3
Simplified44.3%
Taylor expanded in n around inf
Simplified48.6%
(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.6%
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
--lowering--.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
pow-lowering-pow.f64N/A
/-lowering-/.f6440.2
Simplified40.2%
Taylor expanded in n around inf
Simplified34.3%
metadata-eval34.3
Applied egg-rr34.3%
herbie shell --seed 2024197
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))