
(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 20 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
(let* ((t_0 (/ (/ (exp (/ (log x) n)) n) x)))
(if (<= (/ 1.0 n) -2e-11)
t_0
(if (<= (/ 1.0 n) 2e-50)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 1.0)
t_0
(- (pow (exp -1.0) (/ (log1p x) (- n))) (pow x (/ 1.0 n))))))))
double code(double x, double n) {
double t_0 = (exp((log(x) / n)) / n) / x;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-50) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 1.0) {
tmp = t_0;
} else {
tmp = pow(exp(-1.0), (log1p(x) / -n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = (Math.exp((Math.log(x) / n)) / n) / x;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-50) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 1.0) {
tmp = t_0;
} else {
tmp = Math.pow(Math.exp(-1.0), (Math.log1p(x) / -n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = (math.exp((math.log(x) / n)) / n) / x tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_0 elif (1.0 / n) <= 2e-50: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 1.0: tmp = t_0 else: tmp = math.pow(math.exp(-1.0), (math.log1p(x) / -n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64(Float64(exp(Float64(log(x) / n)) / n) / x) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-50) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 1.0) tmp = t_0; else tmp = Float64((exp(-1.0) ^ Float64(log1p(x) / Float64(-n))) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-50], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.0], t$95$0, N[(N[Power[N[Exp[-1.0], $MachinePrecision], 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}
t_0 := \frac{\frac{e^{\frac{\log x}{n}}}{n}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-50}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 1:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;{\left(e^{-1}\right)}^{\left(\frac{\mathsf{log1p}\left(x\right)}{-n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11 or 2.00000000000000002e-50 < (/.f64 #s(literal 1 binary64) n) < 1Initial program 88.0%
Taylor expanded in x around inf
Simplified51.5%
Taylor expanded in x around inf
mul-1-negN/A
log-recN/A
distribute-frac-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6496.2
Simplified96.2%
if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000002e-50Initial program 31.3%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6482.6
Simplified82.6%
if 1 < (/.f64 #s(literal 1 binary64) n) Initial program 61.7%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6499.8
Applied egg-rr99.8%
frac-2negN/A
distribute-frac-neg2N/A
exp-negN/A
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
accelerator-lowering-log1p.f6499.7
Applied egg-rr99.7%
rec-expN/A
neg-mul-1N/A
exp-prodN/A
pow-lowering-pow.f64N/A
exp-lowering-exp.f64N/A
remove-double-negN/A
neg-lowering-neg.f64N/A
distribute-frac-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
accelerator-lowering-log1p.f6499.8
Applied egg-rr99.8%
Final simplification90.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (/ (exp (/ (log x) n)) n) x)))
(if (<= (/ 1.0 n) -2e-11)
t_0
(if (<= (/ 1.0 n) 2e-50)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 1.0) t_0 (- (pow E (/ x n)) (pow x (/ 1.0 n))))))))
double code(double x, double n) {
double t_0 = (exp((log(x) / n)) / n) / x;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-50) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 1.0) {
tmp = t_0;
} else {
tmp = pow(((double) M_E), (x / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = (Math.exp((Math.log(x) / n)) / n) / x;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-50) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 1.0) {
tmp = t_0;
} else {
tmp = Math.pow(Math.E, (x / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = (math.exp((math.log(x) / n)) / n) / x tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_0 elif (1.0 / n) <= 2e-50: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 1.0: tmp = t_0 else: tmp = math.pow(math.e, (x / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64(Float64(exp(Float64(log(x) / n)) / n) / x) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-50) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 1.0) tmp = t_0; else tmp = Float64((exp(1) ^ Float64(x / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-50], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.0], t$95$0, N[(N[Power[E, N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{e^{\frac{\log x}{n}}}{n}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-50}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 1:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;{e}^{\left(\frac{x}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11 or 2.00000000000000002e-50 < (/.f64 #s(literal 1 binary64) n) < 1Initial program 88.0%
Taylor expanded in x around inf
Simplified51.5%
Taylor expanded in x around inf
mul-1-negN/A
log-recN/A
distribute-frac-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6496.2
Simplified96.2%
if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000002e-50Initial program 31.3%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6482.6
Simplified82.6%
if 1 < (/.f64 #s(literal 1 binary64) n) Initial program 61.7%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6499.8
Applied egg-rr99.8%
clear-numN/A
div-invN/A
clear-numN/A
exp-prodN/A
pow-lowering-pow.f64N/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
accelerator-lowering-log1p.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f6499.8
Simplified99.8%
Final simplification90.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (/ (exp (/ (log x) n)) n) x)))
(if (<= (/ 1.0 n) -2e-11)
t_0
(if (<= (/ 1.0 n) 2e-50)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 1.0) t_0 (- (exp (/ x n)) (pow x (/ 1.0 n))))))))
double code(double x, double n) {
double t_0 = (exp((log(x) / n)) / n) / x;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-50) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 1.0) {
tmp = t_0;
} else {
tmp = exp((x / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = (Math.exp((Math.log(x) / n)) / n) / x;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-50) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 1.0) {
tmp = t_0;
} else {
tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = (math.exp((math.log(x) / n)) / n) / x tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_0 elif (1.0 / n) <= 2e-50: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 1.0: tmp = t_0 else: tmp = math.exp((x / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64(Float64(exp(Float64(log(x) / n)) / n) / x) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-50) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 1.0) tmp = t_0; else tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-50], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.0], t$95$0, N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{e^{\frac{\log x}{n}}}{n}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-50}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 1:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11 or 2.00000000000000002e-50 < (/.f64 #s(literal 1 binary64) n) < 1Initial program 88.0%
Taylor expanded in x around inf
Simplified51.5%
Taylor expanded in x around inf
mul-1-negN/A
log-recN/A
distribute-frac-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6496.2
Simplified96.2%
if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000002e-50Initial program 31.3%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6482.6
Simplified82.6%
if 1 < (/.f64 #s(literal 1 binary64) n) Initial program 61.7%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f6499.8
Simplified99.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* n x))))
(if (<= (/ 1.0 n) -2e-11)
t_1
(if (<= (/ 1.0 n) 2e-50)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 1.0) t_1 (- (exp (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-50) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 1.0) {
tmp = t_1;
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-50) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 1.0) {
tmp = t_1;
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = t_0 / (n * x) tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_1 elif (1.0 / n) <= 2e-50: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 1.0: tmp = t_1 else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-50) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 1.0) tmp = t_1; else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-50], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.0], t$95$1, N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t\_0}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-50}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 1:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11 or 2.00000000000000002e-50 < (/.f64 #s(literal 1 binary64) n) < 1Initial program 88.0%
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-*.f6496.2
Simplified96.2%
if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000002e-50Initial program 31.3%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6482.6
Simplified82.6%
if 1 < (/.f64 #s(literal 1 binary64) n) Initial program 61.7%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f6499.8
Simplified99.8%
Final simplification90.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* n x))))
(if (<= (/ 1.0 n) -2e-11)
t_1
(if (<= (/ 1.0 n) 2e-50)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 1.0)
t_1
(fma
x
(/
(fma
x
(+ (fma x 0.3333333333333333 -0.5) (/ (fma x -0.5 0.5) n))
(fma 0.16666666666666666 (/ (* x (/ x n)) n) 1.0))
n)
(- 1.0 t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-50) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 1.0) {
tmp = t_1;
} else {
tmp = fma(x, (fma(x, (fma(x, 0.3333333333333333, -0.5) + (fma(x, -0.5, 0.5) / n)), fma(0.16666666666666666, ((x * (x / n)) / n), 1.0)) / n), (1.0 - t_0));
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-50) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 1.0) tmp = t_1; else tmp = fma(x, Float64(fma(x, Float64(fma(x, 0.3333333333333333, -0.5) + Float64(fma(x, -0.5, 0.5) / n)), fma(0.16666666666666666, Float64(Float64(x * Float64(x / n)) / n), 1.0)) / n), Float64(1.0 - t_0)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-50], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.0], t$95$1, N[(x * N[(N[(x * N[(N[(x * 0.3333333333333333 + -0.5), $MachinePrecision] + N[(N[(x * -0.5 + 0.5), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(N[(x * N[(x / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t\_0}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-50}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 1:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right) + \frac{\mathsf{fma}\left(x, -0.5, 0.5\right)}{n}, \mathsf{fma}\left(0.16666666666666666, \frac{x \cdot \frac{x}{n}}{n}, 1\right)\right)}{n}, 1 - t\_0\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11 or 2.00000000000000002e-50 < (/.f64 #s(literal 1 binary64) n) < 1Initial program 88.0%
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-*.f6496.2
Simplified96.2%
if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000002e-50Initial program 31.3%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6482.6
Simplified82.6%
if 1 < (/.f64 #s(literal 1 binary64) n) Initial program 61.7%
Taylor expanded in x around 0
Simplified48.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified74.0%
times-fracN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6487.2
Applied egg-rr87.2%
Final simplification88.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* n x))))
(if (<= (/ 1.0 n) -2e-11)
t_1
(if (<= (/ 1.0 n) 5e-190)
(- (/ (log x) n))
(if (<= (/ 1.0 n) 1.0)
t_1
(fma x (/ (fma x (+ -0.5 (/ 0.5 n)) 1.0) n) (- 1.0 t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-190) {
tmp = -(log(x) / n);
} else if ((1.0 / n) <= 1.0) {
tmp = t_1;
} else {
tmp = fma(x, (fma(x, (-0.5 + (0.5 / n)), 1.0) / n), (1.0 - t_0));
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-190) tmp = Float64(-Float64(log(x) / n)); elseif (Float64(1.0 / n) <= 1.0) tmp = t_1; else tmp = fma(x, Float64(fma(x, Float64(-0.5 + Float64(0.5 / n)), 1.0) / n), Float64(1.0 - t_0)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-190], (-N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.0], t$95$1, N[(x * N[(N[(x * N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / n), $MachinePrecision] + N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t\_0}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-190}:\\
\;\;\;\;-\frac{\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 1:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{\mathsf{fma}\left(x, -0.5 + \frac{0.5}{n}, 1\right)}{n}, 1 - t\_0\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11 or 5.00000000000000034e-190 < (/.f64 #s(literal 1 binary64) n) < 1Initial program 76.8%
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-*.f6487.9
Simplified87.9%
if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000034e-190Initial program 32.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-/.f6432.0
Simplified32.0%
Taylor expanded in n around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6456.8
Simplified56.8%
if 1 < (/.f64 #s(literal 1 binary64) n) Initial program 61.7%
Taylor expanded in x around 0
Simplified48.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified74.0%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6475.1
Simplified75.1%
Final simplification75.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 8e-5)
(fma
x
(/
(fma
x
(+ (fma x 0.3333333333333333 -0.5) (/ (fma x -0.5 0.5) n))
(fma 0.16666666666666666 (/ (* x (/ x n)) n) 1.0))
n)
(- 1.0 t_0))
(/ t_0 (* n x)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 8e-5) {
tmp = fma(x, (fma(x, (fma(x, 0.3333333333333333, -0.5) + (fma(x, -0.5, 0.5) / n)), fma(0.16666666666666666, ((x * (x / n)) / n), 1.0)) / n), (1.0 - 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 <= 8e-5) tmp = fma(x, Float64(fma(x, Float64(fma(x, 0.3333333333333333, -0.5) + Float64(fma(x, -0.5, 0.5) / n)), fma(0.16666666666666666, Float64(Float64(x * Float64(x / n)) / n), 1.0)) / n), Float64(1.0 - t_0)); else tmp = Float64(t_0 / Float64(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, 8e-5], N[(x * N[(N[(x * N[(N[(x * 0.3333333333333333 + -0.5), $MachinePrecision] + N[(N[(x * -0.5 + 0.5), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(N[(x * N[(x / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 8 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right) + \frac{\mathsf{fma}\left(x, -0.5, 0.5\right)}{n}, \mathsf{fma}\left(0.16666666666666666, \frac{x \cdot \frac{x}{n}}{n}, 1\right)\right)}{n}, 1 - t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\end{array}
\end{array}
if x < 8.00000000000000065e-5Initial program 50.7%
Taylor expanded in x around 0
Simplified33.4%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified49.6%
times-fracN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6457.8
Applied egg-rr57.8%
if 8.00000000000000065e-5 < x Initial program 70.4%
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-*.f6498.0
Simplified98.0%
Final simplification74.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* n x))))
(if (<= (/ 1.0 n) -2e-11)
t_1
(if (<= (/ 1.0 n) 5e-190)
(- (/ (log x) n))
(if (<= (/ 1.0 n) 1.0)
t_1
(if (<= (/ 1.0 n) 5e+114)
(- (+ 1.0 (/ x n)) t_0)
(+ -1.0 (exp (/ x n)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-190) {
tmp = -(log(x) / n);
} else if ((1.0 / n) <= 1.0) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+114) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = -1.0 + exp((x / 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) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = t_0 / (n * x)
if ((1.0d0 / n) <= (-2d-11)) then
tmp = t_1
else if ((1.0d0 / n) <= 5d-190) then
tmp = -(log(x) / n)
else if ((1.0d0 / n) <= 1.0d0) then
tmp = t_1
else if ((1.0d0 / n) <= 5d+114) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = (-1.0d0) + exp((x / 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 t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-190) {
tmp = -(Math.log(x) / n);
} else if ((1.0 / n) <= 1.0) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+114) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = -1.0 + Math.exp((x / n));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = t_0 / (n * x) tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_1 elif (1.0 / n) <= 5e-190: tmp = -(math.log(x) / n) elif (1.0 / n) <= 1.0: tmp = t_1 elif (1.0 / n) <= 5e+114: tmp = (1.0 + (x / n)) - t_0 else: tmp = -1.0 + math.exp((x / n)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-190) tmp = Float64(-Float64(log(x) / n)); elseif (Float64(1.0 / n) <= 1.0) tmp = t_1; elseif (Float64(1.0 / n) <= 5e+114) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(-1.0 + exp(Float64(x / n))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = t_0 / (n * x); tmp = 0.0; if ((1.0 / n) <= -2e-11) tmp = t_1; elseif ((1.0 / n) <= 5e-190) tmp = -(log(x) / n); elseif ((1.0 / n) <= 1.0) tmp = t_1; elseif ((1.0 / n) <= 5e+114) tmp = (1.0 + (x / n)) - t_0; else tmp = -1.0 + exp((x / n)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-190], (-N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.0], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+114], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(-1.0 + N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t\_0}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-190}:\\
\;\;\;\;-\frac{\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+114}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;-1 + e^{\frac{x}{n}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11 or 5.00000000000000034e-190 < (/.f64 #s(literal 1 binary64) n) < 1Initial program 76.8%
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-*.f6487.9
Simplified87.9%
if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000034e-190Initial program 32.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-/.f6432.0
Simplified32.0%
Taylor expanded in n around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6456.8
Simplified56.8%
if 1 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000001e114Initial program 99.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-/.f6490.3
Simplified90.3%
if 5.0000000000000001e114 < (/.f64 #s(literal 1 binary64) n) Initial program 23.6%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6499.5
Applied egg-rr99.5%
Taylor expanded in x around 0
/-lowering-/.f6499.5
Simplified99.5%
Taylor expanded in n around inf
Simplified73.1%
Final simplification76.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 6.5e-167)
(- (+ 1.0 (/ x n)) t_0)
(if (<= x 4.5e-134)
(/ (log x) (* (* n n) (/ -1.0 n)))
(if (<= x 7.5e-5)
(fma
x
(/
(fma
x
(+ -0.5 (/ 0.5 n))
(fma 0.16666666666666666 (/ (* x x) (* n n)) 1.0))
n)
(- 1.0 t_0))
(/ t_0 (* n x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 6.5e-167) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 4.5e-134) {
tmp = log(x) / ((n * n) * (-1.0 / n));
} else if (x <= 7.5e-5) {
tmp = fma(x, (fma(x, (-0.5 + (0.5 / n)), fma(0.16666666666666666, ((x * x) / (n * n)), 1.0)) / n), (1.0 - 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 <= 6.5e-167) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); elseif (x <= 4.5e-134) tmp = Float64(log(x) / Float64(Float64(n * n) * Float64(-1.0 / n))); elseif (x <= 7.5e-5) tmp = fma(x, Float64(fma(x, Float64(-0.5 + Float64(0.5 / n)), fma(0.16666666666666666, Float64(Float64(x * x) / Float64(n * n)), 1.0)) / n), Float64(1.0 - t_0)); else tmp = Float64(t_0 / Float64(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, 6.5e-167], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 4.5e-134], N[(N[Log[x], $MachinePrecision] / N[(N[(n * n), $MachinePrecision] * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e-5], N[(x * N[(N[(x * N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(N[(x * x), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 6.5 \cdot 10^{-167}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-134}:\\
\;\;\;\;\frac{\log x}{\left(n \cdot n\right) \cdot \frac{-1}{n}}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{\mathsf{fma}\left(x, -0.5 + \frac{0.5}{n}, \mathsf{fma}\left(0.16666666666666666, \frac{x \cdot x}{n \cdot n}, 1\right)\right)}{n}, 1 - t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\end{array}
\end{array}
if x < 6.49999999999999973e-167Initial program 58.2%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6458.4
Simplified58.4%
if 6.49999999999999973e-167 < x < 4.5000000000000005e-134Initial program 30.4%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--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-/.f6430.4
Simplified30.4%
flip--N/A
/-lowering-/.f64N/A
metadata-evalN/A
--lowering--.f64N/A
pow-sqrN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
pow-lowering-pow.f64N/A
/-lowering-/.f649.4
Applied egg-rr9.4%
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
mul-1-negN/A
neg-lowering-neg.f6446.2
Simplified46.2%
neg-sub0N/A
flip--N/A
div-invN/A
+-lft-identityN/A
*-lowering-*.f64N/A
metadata-evalN/A
sub0-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6469.9
Applied egg-rr69.9%
if 4.5000000000000005e-134 < x < 7.49999999999999934e-5Initial program 48.7%
Taylor expanded in x around 0
Simplified33.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified58.6%
Taylor expanded in x around 0
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6458.6
Simplified58.6%
if 7.49999999999999934e-5 < x Initial program 70.4%
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-*.f6498.0
Simplified98.0%
Final simplification75.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* n x))))
(if (<= (/ 1.0 n) -2e-11)
t_1
(if (<= (/ 1.0 n) 5e-190)
(- (/ (log x) n))
(if (<= (/ 1.0 n) 1.0)
t_1
(if (<= (/ 1.0 n) 5e+114) (- 1.0 t_0) (+ -1.0 (exp (/ x n)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-190) {
tmp = -(log(x) / n);
} else if ((1.0 / n) <= 1.0) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+114) {
tmp = 1.0 - t_0;
} else {
tmp = -1.0 + exp((x / 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) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = t_0 / (n * x)
if ((1.0d0 / n) <= (-2d-11)) then
tmp = t_1
else if ((1.0d0 / n) <= 5d-190) then
tmp = -(log(x) / n)
else if ((1.0d0 / n) <= 1.0d0) then
tmp = t_1
else if ((1.0d0 / n) <= 5d+114) then
tmp = 1.0d0 - t_0
else
tmp = (-1.0d0) + exp((x / 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 t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-190) {
tmp = -(Math.log(x) / n);
} else if ((1.0 / n) <= 1.0) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+114) {
tmp = 1.0 - t_0;
} else {
tmp = -1.0 + Math.exp((x / n));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = t_0 / (n * x) tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_1 elif (1.0 / n) <= 5e-190: tmp = -(math.log(x) / n) elif (1.0 / n) <= 1.0: tmp = t_1 elif (1.0 / n) <= 5e+114: tmp = 1.0 - t_0 else: tmp = -1.0 + math.exp((x / n)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-190) tmp = Float64(-Float64(log(x) / n)); elseif (Float64(1.0 / n) <= 1.0) tmp = t_1; elseif (Float64(1.0 / n) <= 5e+114) tmp = Float64(1.0 - t_0); else tmp = Float64(-1.0 + exp(Float64(x / n))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = t_0 / (n * x); tmp = 0.0; if ((1.0 / n) <= -2e-11) tmp = t_1; elseif ((1.0 / n) <= 5e-190) tmp = -(log(x) / n); elseif ((1.0 / n) <= 1.0) tmp = t_1; elseif ((1.0 / n) <= 5e+114) tmp = 1.0 - t_0; else tmp = -1.0 + exp((x / n)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-190], (-N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.0], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+114], N[(1.0 - t$95$0), $MachinePrecision], N[(-1.0 + N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t\_0}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-190}:\\
\;\;\;\;-\frac{\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+114}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;-1 + e^{\frac{x}{n}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11 or 5.00000000000000034e-190 < (/.f64 #s(literal 1 binary64) n) < 1Initial program 76.8%
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-*.f6487.9
Simplified87.9%
if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000034e-190Initial program 32.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-/.f6432.0
Simplified32.0%
Taylor expanded in n around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6456.8
Simplified56.8%
if 1 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000001e114Initial program 99.7%
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-/.f6490.0
Simplified90.0%
if 5.0000000000000001e114 < (/.f64 #s(literal 1 binary64) n) Initial program 23.6%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6499.5
Applied egg-rr99.5%
Taylor expanded in x around 0
/-lowering-/.f6499.5
Simplified99.5%
Taylor expanded in n around inf
Simplified73.1%
Final simplification76.1%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -1.0)
(/ 0.3333333333333333 (* n (* x (* x x))))
(if (<= (/ 1.0 n) -2e-294)
(- (/ (log x) n))
(if (<= (/ 1.0 n) 1.0)
(/ (/ 1.0 n) x)
(if (<= (/ 1.0 n) 5e+114)
(- 1.0 (pow x (/ 1.0 n)))
(+ -1.0 (exp (/ x n))))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = 0.3333333333333333 / (n * (x * (x * x)));
} else if ((1.0 / n) <= -2e-294) {
tmp = -(log(x) / n);
} else if ((1.0 / n) <= 1.0) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 5e+114) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = -1.0 + exp((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.3333333333333333d0 / (n * (x * (x * x)))
else if ((1.0d0 / n) <= (-2d-294)) then
tmp = -(log(x) / n)
else if ((1.0d0 / n) <= 1.0d0) then
tmp = (1.0d0 / n) / x
else if ((1.0d0 / n) <= 5d+114) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = (-1.0d0) + exp((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.3333333333333333 / (n * (x * (x * x)));
} else if ((1.0 / n) <= -2e-294) {
tmp = -(Math.log(x) / n);
} else if ((1.0 / n) <= 1.0) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 5e+114) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = -1.0 + Math.exp((x / n));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1.0: tmp = 0.3333333333333333 / (n * (x * (x * x))) elif (1.0 / n) <= -2e-294: tmp = -(math.log(x) / n) elif (1.0 / n) <= 1.0: tmp = (1.0 / n) / x elif (1.0 / n) <= 5e+114: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = -1.0 + math.exp((x / n)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1.0) tmp = Float64(0.3333333333333333 / Float64(n * Float64(x * Float64(x * x)))); elseif (Float64(1.0 / n) <= -2e-294) tmp = Float64(-Float64(log(x) / n)); elseif (Float64(1.0 / n) <= 1.0) tmp = Float64(Float64(1.0 / n) / x); elseif (Float64(1.0 / n) <= 5e+114) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(-1.0 + exp(Float64(x / n))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1.0) tmp = 0.3333333333333333 / (n * (x * (x * x))); elseif ((1.0 / n) <= -2e-294) tmp = -(log(x) / n); elseif ((1.0 / n) <= 1.0) tmp = (1.0 / n) / x; elseif ((1.0 / n) <= 5e+114) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = -1.0 + exp((x / n)); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.0], N[(0.3333333333333333 / N[(n * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-294], (-N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.0], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+114], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot \left(x \cdot \left(x \cdot x\right)\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-294}:\\
\;\;\;\;-\frac{\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 1:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+114}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;-1 + e^{\frac{x}{n}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1Initial program 100.0%
Taylor expanded in x around inf
Simplified47.7%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6448.6
Simplified48.6%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6482.6
Simplified82.6%
if -1 < (/.f64 #s(literal 1 binary64) n) < -2.00000000000000003e-294Initial program 24.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-/.f6424.1
Simplified24.1%
Taylor expanded in n around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6456.0
Simplified56.0%
if -2.00000000000000003e-294 < (/.f64 #s(literal 1 binary64) n) < 1Initial program 35.2%
Taylor expanded in x around inf
Simplified57.5%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6453.3
Simplified53.3%
Taylor expanded in x around inf
/-lowering-/.f6453.5
Simplified53.5%
if 1 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000001e114Initial program 99.7%
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-/.f6490.0
Simplified90.0%
if 5.0000000000000001e114 < (/.f64 #s(literal 1 binary64) n) Initial program 23.6%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6499.5
Applied egg-rr99.5%
Taylor expanded in x around 0
/-lowering-/.f6499.5
Simplified99.5%
Taylor expanded in n around inf
Simplified73.1%
Final simplification68.5%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -1.0)
(/ 0.3333333333333333 (* n (* x (* x x))))
(if (<= (/ 1.0 n) -2e-294)
(- (/ (log x) n))
(if (<= (/ 1.0 n) 500000.0) (/ (/ 1.0 n) x) (+ -1.0 (exp (/ x n)))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = 0.3333333333333333 / (n * (x * (x * x)));
} else if ((1.0 / n) <= -2e-294) {
tmp = -(log(x) / n);
} else if ((1.0 / n) <= 500000.0) {
tmp = (1.0 / n) / x;
} else {
tmp = -1.0 + exp((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.3333333333333333d0 / (n * (x * (x * x)))
else if ((1.0d0 / n) <= (-2d-294)) then
tmp = -(log(x) / n)
else if ((1.0d0 / n) <= 500000.0d0) then
tmp = (1.0d0 / n) / x
else
tmp = (-1.0d0) + exp((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.3333333333333333 / (n * (x * (x * x)));
} else if ((1.0 / n) <= -2e-294) {
tmp = -(Math.log(x) / n);
} else if ((1.0 / n) <= 500000.0) {
tmp = (1.0 / n) / x;
} else {
tmp = -1.0 + Math.exp((x / n));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1.0: tmp = 0.3333333333333333 / (n * (x * (x * x))) elif (1.0 / n) <= -2e-294: tmp = -(math.log(x) / n) elif (1.0 / n) <= 500000.0: tmp = (1.0 / n) / x else: tmp = -1.0 + math.exp((x / n)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1.0) tmp = Float64(0.3333333333333333 / Float64(n * Float64(x * Float64(x * x)))); elseif (Float64(1.0 / n) <= -2e-294) tmp = Float64(-Float64(log(x) / n)); elseif (Float64(1.0 / n) <= 500000.0) tmp = Float64(Float64(1.0 / n) / x); else tmp = Float64(-1.0 + exp(Float64(x / n))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1.0) tmp = 0.3333333333333333 / (n * (x * (x * x))); elseif ((1.0 / n) <= -2e-294) tmp = -(log(x) / n); elseif ((1.0 / n) <= 500000.0) tmp = (1.0 / n) / x; else tmp = -1.0 + exp((x / n)); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.0], N[(0.3333333333333333 / N[(n * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-294], (-N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), If[LessEqual[N[(1.0 / n), $MachinePrecision], 500000.0], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], N[(-1.0 + N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot \left(x \cdot \left(x \cdot x\right)\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-294}:\\
\;\;\;\;-\frac{\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 500000:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;-1 + e^{\frac{x}{n}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1Initial program 100.0%
Taylor expanded in x around inf
Simplified47.7%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6448.6
Simplified48.6%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6482.6
Simplified82.6%
if -1 < (/.f64 #s(literal 1 binary64) n) < -2.00000000000000003e-294Initial program 24.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-/.f6424.1
Simplified24.1%
Taylor expanded in n around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6456.0
Simplified56.0%
if -2.00000000000000003e-294 < (/.f64 #s(literal 1 binary64) n) < 5e5Initial program 38.1%
Taylor expanded in x around inf
Simplified55.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6451.1
Simplified51.1%
Taylor expanded in x around inf
/-lowering-/.f6451.3
Simplified51.3%
if 5e5 < (/.f64 #s(literal 1 binary64) n) Initial program 58.5%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6499.7
Applied egg-rr99.7%
Taylor expanded in x around 0
/-lowering-/.f6499.7
Simplified99.7%
Taylor expanded in n around inf
Simplified46.4%
Final simplification62.5%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -1.0)
(/ 0.3333333333333333 (* n (* x (* x x))))
(if (<= (/ 1.0 n) -2e-294)
(- (/ (log x) n))
(/ (/ (+ (/ 0.3333333333333333 (* x x)) (+ 1.0 (/ -0.5 x))) n) x))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = 0.3333333333333333 / (n * (x * (x * x)));
} else if ((1.0 / n) <= -2e-294) {
tmp = -(log(x) / n);
} else {
tmp = (((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) / 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) <= (-1.0d0)) then
tmp = 0.3333333333333333d0 / (n * (x * (x * x)))
else if ((1.0d0 / n) <= (-2d-294)) then
tmp = -(log(x) / n)
else
tmp = (((0.3333333333333333d0 / (x * x)) + (1.0d0 + ((-0.5d0) / x))) / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = 0.3333333333333333 / (n * (x * (x * x)));
} else if ((1.0 / n) <= -2e-294) {
tmp = -(Math.log(x) / n);
} else {
tmp = (((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1.0: tmp = 0.3333333333333333 / (n * (x * (x * x))) elif (1.0 / n) <= -2e-294: tmp = -(math.log(x) / n) else: tmp = (((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) / n) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1.0) tmp = Float64(0.3333333333333333 / Float64(n * Float64(x * Float64(x * x)))); elseif (Float64(1.0 / n) <= -2e-294) tmp = Float64(-Float64(log(x) / n)); else tmp = Float64(Float64(Float64(Float64(0.3333333333333333 / Float64(x * x)) + Float64(1.0 + Float64(-0.5 / x))) / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1.0) tmp = 0.3333333333333333 / (n * (x * (x * x))); elseif ((1.0 / n) <= -2e-294) tmp = -(log(x) / n); else tmp = (((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.0], N[(0.3333333333333333 / N[(n * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-294], (-N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), N[(N[(N[(N[(0.3333333333333333 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot \left(x \cdot \left(x \cdot x\right)\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-294}:\\
\;\;\;\;-\frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{0.3333333333333333}{x \cdot x} + \left(1 + \frac{-0.5}{x}\right)}{n}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1Initial program 100.0%
Taylor expanded in x around inf
Simplified47.7%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6448.6
Simplified48.6%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6482.6
Simplified82.6%
if -1 < (/.f64 #s(literal 1 binary64) n) < -2.00000000000000003e-294Initial program 24.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-/.f6424.1
Simplified24.1%
Taylor expanded in n around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6456.0
Simplified56.0%
if -2.00000000000000003e-294 < (/.f64 #s(literal 1 binary64) n) Initial program 45.4%
Taylor expanded in x around inf
Simplified35.7%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6441.7
Simplified41.7%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -0.0001) (/ 0.3333333333333333 (* n (* x (* x x)))) (/ (/ (+ (/ 0.3333333333333333 (* x x)) (+ 1.0 (/ -0.5 x))) n) x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.0001) {
tmp = 0.3333333333333333 / (n * (x * (x * x)));
} else {
tmp = (((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) / 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.0001d0)) then
tmp = 0.3333333333333333d0 / (n * (x * (x * x)))
else
tmp = (((0.3333333333333333d0 / (x * x)) + (1.0d0 + ((-0.5d0) / x))) / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.0001) {
tmp = 0.3333333333333333 / (n * (x * (x * x)));
} else {
tmp = (((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -0.0001: tmp = 0.3333333333333333 / (n * (x * (x * x))) else: tmp = (((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) / n) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -0.0001) tmp = Float64(0.3333333333333333 / Float64(n * Float64(x * Float64(x * x)))); else tmp = Float64(Float64(Float64(Float64(0.3333333333333333 / Float64(x * x)) + Float64(1.0 + Float64(-0.5 / x))) / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -0.0001) tmp = 0.3333333333333333 / (n * (x * (x * x))); else tmp = (((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.0001], N[(0.3333333333333333 / N[(n * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.3333333333333333 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -0.0001:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot \left(x \cdot \left(x \cdot x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{0.3333333333333333}{x \cdot x} + \left(1 + \frac{-0.5}{x}\right)}{n}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000005e-4Initial program 99.9%
Taylor expanded in x around inf
Simplified46.7%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6447.6
Simplified47.6%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6480.8
Simplified80.8%
if -1.00000000000000005e-4 < (/.f64 #s(literal 1 binary64) n) Initial program 36.6%
Taylor expanded in x around inf
Simplified39.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6442.5
Simplified42.5%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -0.0001) (/ 0.3333333333333333 (* n (* x (* x x)))) (* (+ (/ 0.3333333333333333 (* x x)) (+ 1.0 (/ -0.5 x))) (/ 1.0 (* n x)))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.0001) {
tmp = 0.3333333333333333 / (n * (x * (x * x)));
} else {
tmp = ((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) * (1.0 / (n * x));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= (-0.0001d0)) then
tmp = 0.3333333333333333d0 / (n * (x * (x * x)))
else
tmp = ((0.3333333333333333d0 / (x * x)) + (1.0d0 + ((-0.5d0) / x))) * (1.0d0 / (n * x))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.0001) {
tmp = 0.3333333333333333 / (n * (x * (x * x)));
} else {
tmp = ((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) * (1.0 / (n * x));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -0.0001: tmp = 0.3333333333333333 / (n * (x * (x * x))) else: tmp = ((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) * (1.0 / (n * x)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -0.0001) tmp = Float64(0.3333333333333333 / Float64(n * Float64(x * Float64(x * x)))); else tmp = Float64(Float64(Float64(0.3333333333333333 / Float64(x * x)) + Float64(1.0 + Float64(-0.5 / x))) * Float64(1.0 / Float64(n * x))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -0.0001) tmp = 0.3333333333333333 / (n * (x * (x * x))); else tmp = ((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) * (1.0 / (n * x)); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.0001], N[(0.3333333333333333 / N[(n * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.3333333333333333 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -0.0001:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot \left(x \cdot \left(x \cdot x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{0.3333333333333333}{x \cdot x} + \left(1 + \frac{-0.5}{x}\right)\right) \cdot \frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000005e-4Initial program 99.9%
Taylor expanded in x around inf
Simplified46.7%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6447.6
Simplified47.6%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6480.8
Simplified80.8%
if -1.00000000000000005e-4 < (/.f64 #s(literal 1 binary64) n) Initial program 36.6%
Taylor expanded in x around inf
Simplified39.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6442.5
Simplified42.5%
clear-numN/A
associate-/r/N/A
*-rgt-identityN/A
times-fracN/A
remove-double-negN/A
metadata-evalN/A
frac-2negN/A
clear-numN/A
metadata-evalN/A
frac-2negN/A
flip-+N/A
clear-numN/A
clear-numN/A
Applied egg-rr42.1%
Final simplification55.7%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -0.0001) (/ 0.3333333333333333 (* n (* x (* x x)))) (/ (+ (/ 0.3333333333333333 (* x x)) (+ 1.0 (/ -0.5 x))) (* n x))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.0001) {
tmp = 0.3333333333333333 / (n * (x * (x * x)));
} else {
tmp = ((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) / (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.0001d0)) then
tmp = 0.3333333333333333d0 / (n * (x * (x * x)))
else
tmp = ((0.3333333333333333d0 / (x * x)) + (1.0d0 + ((-0.5d0) / x))) / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.0001) {
tmp = 0.3333333333333333 / (n * (x * (x * x)));
} else {
tmp = ((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) / (n * x);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -0.0001: tmp = 0.3333333333333333 / (n * (x * (x * x))) else: tmp = ((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) / (n * x) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -0.0001) tmp = Float64(0.3333333333333333 / Float64(n * Float64(x * Float64(x * x)))); else tmp = Float64(Float64(Float64(0.3333333333333333 / Float64(x * x)) + Float64(1.0 + Float64(-0.5 / x))) / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -0.0001) tmp = 0.3333333333333333 / (n * (x * (x * x))); else tmp = ((0.3333333333333333 / (x * x)) + (1.0 + (-0.5 / x))) / (n * x); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.0001], N[(0.3333333333333333 / N[(n * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.3333333333333333 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -0.0001:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot \left(x \cdot \left(x \cdot x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.3333333333333333}{x \cdot x} + \left(1 + \frac{-0.5}{x}\right)}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000005e-4Initial program 99.9%
Taylor expanded in x around inf
Simplified46.7%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6447.6
Simplified47.6%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6480.8
Simplified80.8%
if -1.00000000000000005e-4 < (/.f64 #s(literal 1 binary64) n) Initial program 36.6%
Taylor expanded in x around inf
Simplified39.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6442.1
Simplified42.1%
Final simplification55.7%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -1.0) (/ 0.3333333333333333 (* n (* x (* x x)))) (/ (/ 1.0 n) x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = 0.3333333333333333 / (n * (x * (x * x)));
} 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) <= (-1.0d0)) then
tmp = 0.3333333333333333d0 / (n * (x * (x * x)))
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) <= -1.0) {
tmp = 0.3333333333333333 / (n * (x * (x * x)));
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1.0: tmp = 0.3333333333333333 / (n * (x * (x * x))) else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1.0) tmp = Float64(0.3333333333333333 / Float64(n * Float64(x * Float64(x * x)))); else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1.0) tmp = 0.3333333333333333 / (n * (x * (x * x))); else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.0], N[(0.3333333333333333 / N[(n * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot \left(x \cdot \left(x \cdot x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1Initial program 100.0%
Taylor expanded in x around inf
Simplified47.7%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6448.6
Simplified48.6%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6482.6
Simplified82.6%
if -1 < (/.f64 #s(literal 1 binary64) n) Initial program 37.3%
Taylor expanded in x around inf
Simplified38.8%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6442.0
Simplified42.0%
Taylor expanded in x around inf
/-lowering-/.f6441.5
Simplified41.5%
(FPCore (x n) :precision binary64 (if (<= x 5e+65) (/ (/ 1.0 n) x) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 5e+65) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 5d+65) then
tmp = (1.0d0 / n) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 5e+65) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 5e+65: tmp = (1.0 / n) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 5e+65) tmp = Float64(Float64(1.0 / n) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 5e+65) tmp = (1.0 / n) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 5e+65], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{+65}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 4.99999999999999973e65Initial program 48.4%
Taylor expanded in x around inf
Simplified25.6%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6438.9
Simplified38.9%
Taylor expanded in x around inf
/-lowering-/.f6429.0
Simplified29.0%
if 4.99999999999999973e65 < x Initial program 79.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-/.f6436.6
Simplified36.6%
Taylor expanded in n around inf
Simplified79.2%
metadata-eval79.2
Applied egg-rr79.2%
(FPCore (x n) :precision binary64 (if (<= x 2e+69) (/ 1.0 (* n x)) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 2e+69) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2d+69) then
tmp = 1.0d0 / (n * x)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2e+69) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2e+69: tmp = 1.0 / (n * x) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 2e+69) tmp = Float64(1.0 / Float64(n * x)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2e+69) tmp = 1.0 / (n * x); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2e+69], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+69}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.0000000000000001e69Initial program 48.4%
Taylor expanded in x around inf
Simplified25.6%
Taylor expanded in n around inf
/-lowering-/.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6438.9
Simplified38.9%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6428.9
Simplified28.9%
if 2.0000000000000001e69 < x Initial program 79.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-/.f6436.6
Simplified36.6%
Taylor expanded in n around inf
Simplified79.2%
metadata-eval79.2
Applied egg-rr79.2%
Final simplification46.0%
(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 58.9%
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-/.f6442.5
Simplified42.5%
Taylor expanded in n around inf
Simplified30.8%
metadata-eval30.8
Applied egg-rr30.8%
herbie shell --seed 2024205
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))