
(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 18 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 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-9)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(if (<= (/ 1.0 n) 2e-50)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 0.02)
(/ (exp (/ (log x) n)) (* x n))
(- (exp (/ (log1p x) n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-9) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 2e-50) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.02) {
tmp = exp((log(x) / n)) / (x * n);
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-9) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 2e-50) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.02) {
tmp = Math.exp((Math.log(x) / n)) / (x * n);
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-9: tmp = math.pow((x + 1.0), (1.0 / n)) - t_0 elif (1.0 / n) <= 2e-50: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 0.02: tmp = math.exp((math.log(x) / n)) / (x * n) else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-9) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); elseif (Float64(1.0 / n) <= 2e-50) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 0.02) tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n)); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-9], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-50], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.02], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-9}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-50}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.02:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000006e-9Initial program 98.6%
if -1.00000000000000006e-9 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000002e-50Initial program 24.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6480.9
Simplified80.9%
/-lowering-/.f64N/A
diff-logN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6481.0
Applied egg-rr81.0%
if 2.00000000000000002e-50 < (/.f64 #s(literal 1 binary64) n) < 0.0200000000000000004Initial program 14.8%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified68.8%
Taylor expanded in x around inf
/-lowering-/.f64N/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
remove-double-negN/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6470.1
Simplified70.1%
if 0.0200000000000000004 < (/.f64 #s(literal 1 binary64) n) Initial program 68.5%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f64100.0
Applied egg-rr100.0%
Final simplification88.1%
(FPCore (x n)
:precision binary64
(if (<= x 20.0)
(/
(-
(/
(fma
0.5
(* (log (* x (+ x 1.0))) (log (/ (+ x 1.0) x)))
(* 0.16666666666666666 (/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n)))
n)
(log (/ x (+ x 1.0))))
n)
(* (/ 1.0 n) (/ (pow x (/ 1.0 n)) x))))
double code(double x, double n) {
double tmp;
if (x <= 20.0) {
tmp = ((fma(0.5, (log((x * (x + 1.0))) * log(((x + 1.0) / x))), (0.16666666666666666 * ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n))) / n) - log((x / (x + 1.0)))) / n;
} else {
tmp = (1.0 / n) * (pow(x, (1.0 / n)) / x);
}
return tmp;
}
function code(x, n) tmp = 0.0 if (x <= 20.0) tmp = Float64(Float64(Float64(fma(0.5, Float64(log(Float64(x * Float64(x + 1.0))) * log(Float64(Float64(x + 1.0) / x))), Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n))) / n) - log(Float64(x / Float64(x + 1.0)))) / n); else tmp = Float64(Float64(1.0 / n) * Float64((x ^ Float64(1.0 / n)) / x)); end return tmp end
code[x_, n_] := If[LessEqual[x, 20.0], N[(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[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] * N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 20:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(0.5, \log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right), 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}\right)}{n} - \log \left(\frac{x}{x + 1}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{{x}^{\left(\frac{1}{n}\right)}}{x}\\
\end{array}
\end{array}
if x < 20Initial program 42.2%
Taylor expanded in n around -inf
Simplified76.4%
Applied egg-rr76.4%
if 20 < x Initial program 64.7%
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.9
Simplified97.9%
associate-/r*N/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6498.7
Applied egg-rr98.7%
Final simplification85.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n)))
(t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0))
(t_2 (- 1.0 t_0)))
(if (<= t_1 -0.1) t_2 (if (<= t_1 5e-13) (/ (log (/ (+ x 1.0) x)) n) t_2))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
double t_2 = 1.0 - t_0;
double tmp;
if (t_1 <= -0.1) {
tmp = t_2;
} else if (t_1 <= 5e-13) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = ((x + 1.0d0) ** (1.0d0 / n)) - t_0
t_2 = 1.0d0 - t_0
if (t_1 <= (-0.1d0)) then
tmp = t_2
else if (t_1 <= 5d-13) then
tmp = log(((x + 1.0d0) / x)) / n
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
double t_2 = 1.0 - t_0;
double tmp;
if (t_1 <= -0.1) {
tmp = t_2;
} else if (t_1 <= 5e-13) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.pow((x + 1.0), (1.0 / n)) - t_0 t_2 = 1.0 - t_0 tmp = 0 if t_1 <= -0.1: tmp = t_2 elif t_1 <= 5e-13: tmp = math.log(((x + 1.0) / x)) / n else: tmp = t_2 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0) t_2 = Float64(1.0 - t_0) tmp = 0.0 if (t_1 <= -0.1) tmp = t_2; elseif (t_1 <= 5e-13) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = t_2; end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = ((x + 1.0) ^ (1.0 / n)) - t_0; t_2 = 1.0 - t_0; tmp = 0.0; if (t_1 <= -0.1) tmp = t_2; elseif (t_1 <= 5e-13) tmp = log(((x + 1.0) / x)) / n; else tmp = t_2; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -0.1], t$95$2, If[LessEqual[t$95$1, 5e-13], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
t_2 := 1 - t\_0\\
\mathbf{if}\;t\_1 \leq -0.1:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -0.10000000000000001 or 4.9999999999999999e-13 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 84.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-/.f6484.7
Simplified84.7%
if -0.10000000000000001 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 4.9999999999999999e-13Initial program 38.7%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6479.4
Simplified79.4%
/-lowering-/.f64N/A
diff-logN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6479.4
Applied egg-rr79.4%
Final simplification80.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-9)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(if (<= (/ 1.0 n) 2e-50)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 0.02)
(/ (exp (/ (log x) n)) (* x n))
(if (<= (/ 1.0 n) 2e+239)
(- (+ 1.0 (/ x n)) t_0)
(/ 0.3333333333333333 (* x (* x (* x n))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-9) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 2e-50) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.02) {
tmp = exp((log(x) / n)) / (x * n);
} else if ((1.0 / n) <= 2e+239) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 0.3333333333333333 / (x * (x * (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) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-9)) then
tmp = ((x + 1.0d0) ** (1.0d0 / n)) - t_0
else if ((1.0d0 / n) <= 2d-50) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 0.02d0) then
tmp = exp((log(x) / n)) / (x * n)
else if ((1.0d0 / n) <= 2d+239) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 0.3333333333333333d0 / (x * (x * (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 tmp;
if ((1.0 / n) <= -1e-9) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 2e-50) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.02) {
tmp = Math.exp((Math.log(x) / n)) / (x * n);
} else if ((1.0 / n) <= 2e+239) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-9: tmp = math.pow((x + 1.0), (1.0 / n)) - t_0 elif (1.0 / n) <= 2e-50: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 0.02: tmp = math.exp((math.log(x) / n)) / (x * n) elif (1.0 / n) <= 2e+239: tmp = (1.0 + (x / n)) - t_0 else: tmp = 0.3333333333333333 / (x * (x * (x * n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-9) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); elseif (Float64(1.0 / n) <= 2e-50) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 0.02) tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n)); elseif (Float64(1.0 / n) <= 2e+239) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-9) tmp = ((x + 1.0) ^ (1.0 / n)) - t_0; elseif ((1.0 / n) <= 2e-50) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 0.02) tmp = exp((log(x) / n)) / (x * n); elseif ((1.0 / n) <= 2e+239) tmp = (1.0 + (x / n)) - t_0; else tmp = 0.3333333333333333 / (x * (x * (x * n))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-9], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-50], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.02], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+239], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-9}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-50}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.02:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+239}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000006e-9Initial program 98.6%
if -1.00000000000000006e-9 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000002e-50Initial program 24.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6480.9
Simplified80.9%
/-lowering-/.f64N/A
diff-logN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6481.0
Applied egg-rr81.0%
if 2.00000000000000002e-50 < (/.f64 #s(literal 1 binary64) n) < 0.0200000000000000004Initial program 14.8%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified68.8%
Taylor expanded in x around inf
/-lowering-/.f64N/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
remove-double-negN/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6470.1
Simplified70.1%
if 0.0200000000000000004 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999998e239Initial program 80.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-/.f6482.8
Simplified82.8%
if 1.99999999999999998e239 < (/.f64 #s(literal 1 binary64) n) Initial program 3.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f649.7
Simplified9.7%
Taylor expanded in x around inf
Simplified100.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0
Simplified100.0%
Final simplification86.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-9)
(* t_0 (/ 1.0 (* x n)))
(if (<= (/ 1.0 n) 2e-50)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 0.02)
(/ (exp (/ (log x) n)) (* x n))
(if (<= (/ 1.0 n) 2e+239)
(- (+ 1.0 (/ x n)) t_0)
(/ 0.3333333333333333 (* x (* x (* x n))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-9) {
tmp = t_0 * (1.0 / (x * n));
} else if ((1.0 / n) <= 2e-50) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.02) {
tmp = exp((log(x) / n)) / (x * n);
} else if ((1.0 / n) <= 2e+239) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 0.3333333333333333 / (x * (x * (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) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-9)) then
tmp = t_0 * (1.0d0 / (x * n))
else if ((1.0d0 / n) <= 2d-50) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 0.02d0) then
tmp = exp((log(x) / n)) / (x * n)
else if ((1.0d0 / n) <= 2d+239) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 0.3333333333333333d0 / (x * (x * (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 tmp;
if ((1.0 / n) <= -1e-9) {
tmp = t_0 * (1.0 / (x * n));
} else if ((1.0 / n) <= 2e-50) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.02) {
tmp = Math.exp((Math.log(x) / n)) / (x * n);
} else if ((1.0 / n) <= 2e+239) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-9: tmp = t_0 * (1.0 / (x * n)) elif (1.0 / n) <= 2e-50: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 0.02: tmp = math.exp((math.log(x) / n)) / (x * n) elif (1.0 / n) <= 2e+239: tmp = (1.0 + (x / n)) - t_0 else: tmp = 0.3333333333333333 / (x * (x * (x * n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-9) tmp = Float64(t_0 * Float64(1.0 / Float64(x * n))); elseif (Float64(1.0 / n) <= 2e-50) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 0.02) tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n)); elseif (Float64(1.0 / n) <= 2e+239) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-9) tmp = t_0 * (1.0 / (x * n)); elseif ((1.0 / n) <= 2e-50) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 0.02) tmp = exp((log(x) / n)) / (x * n); elseif ((1.0 / n) <= 2e+239) tmp = (1.0 + (x / n)) - t_0; else tmp = 0.3333333333333333 / (x * (x * (x * n))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-9], N[(t$95$0 * N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-50], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.02], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+239], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-9}:\\
\;\;\;\;t\_0 \cdot \frac{1}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-50}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.02:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+239}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000006e-9Initial program 98.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.5
Simplified97.5%
div-invN/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6497.5
Applied egg-rr97.5%
if -1.00000000000000006e-9 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000002e-50Initial program 24.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6480.9
Simplified80.9%
/-lowering-/.f64N/A
diff-logN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6481.0
Applied egg-rr81.0%
if 2.00000000000000002e-50 < (/.f64 #s(literal 1 binary64) n) < 0.0200000000000000004Initial program 14.8%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified68.8%
Taylor expanded in x around inf
/-lowering-/.f64N/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
remove-double-negN/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6470.1
Simplified70.1%
if 0.0200000000000000004 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999998e239Initial program 80.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-/.f6482.8
Simplified82.8%
if 1.99999999999999998e239 < (/.f64 #s(literal 1 binary64) n) Initial program 3.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f649.7
Simplified9.7%
Taylor expanded in x around inf
Simplified100.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0
Simplified100.0%
Final simplification85.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-9)
(* t_0 (/ 1.0 (* x n)))
(if (<= (/ 1.0 n) 2e-50)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 0.02)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 2e+239)
(- (+ 1.0 (/ x n)) t_0)
(/ 0.3333333333333333 (* x (* x (* x n))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-9) {
tmp = t_0 * (1.0 / (x * n));
} else if ((1.0 / n) <= 2e-50) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.02) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 2e+239) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 0.3333333333333333 / (x * (x * (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) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-9)) then
tmp = t_0 * (1.0d0 / (x * n))
else if ((1.0d0 / n) <= 2d-50) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 0.02d0) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= 2d+239) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 0.3333333333333333d0 / (x * (x * (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 tmp;
if ((1.0 / n) <= -1e-9) {
tmp = t_0 * (1.0 / (x * n));
} else if ((1.0 / n) <= 2e-50) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.02) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 2e+239) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-9: tmp = t_0 * (1.0 / (x * n)) elif (1.0 / n) <= 2e-50: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 0.02: tmp = t_0 / (x * n) elif (1.0 / n) <= 2e+239: tmp = (1.0 + (x / n)) - t_0 else: tmp = 0.3333333333333333 / (x * (x * (x * n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-9) tmp = Float64(t_0 * Float64(1.0 / Float64(x * n))); elseif (Float64(1.0 / n) <= 2e-50) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 0.02) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 2e+239) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-9) tmp = t_0 * (1.0 / (x * n)); elseif ((1.0 / n) <= 2e-50) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 0.02) tmp = t_0 / (x * n); elseif ((1.0 / n) <= 2e+239) tmp = (1.0 + (x / n)) - t_0; else tmp = 0.3333333333333333 / (x * (x * (x * n))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-9], N[(t$95$0 * N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-50], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.02], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+239], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-9}:\\
\;\;\;\;t\_0 \cdot \frac{1}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-50}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.02:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+239}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000006e-9Initial program 98.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.5
Simplified97.5%
div-invN/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6497.5
Applied egg-rr97.5%
if -1.00000000000000006e-9 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000002e-50Initial program 24.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6480.9
Simplified80.9%
/-lowering-/.f64N/A
diff-logN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6481.0
Applied egg-rr81.0%
if 2.00000000000000002e-50 < (/.f64 #s(literal 1 binary64) n) < 0.0200000000000000004Initial program 14.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-*.f6469.9
Simplified69.9%
if 0.0200000000000000004 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999998e239Initial program 80.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-/.f6482.8
Simplified82.8%
if 1.99999999999999998e239 < (/.f64 #s(literal 1 binary64) n) Initial program 3.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f649.7
Simplified9.7%
Taylor expanded in x around inf
Simplified100.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0
Simplified100.0%
Final simplification85.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* x n))))
(if (<= (/ 1.0 n) -1e-9)
t_1
(if (<= (/ 1.0 n) 2e-50)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 0.02)
t_1
(if (<= (/ 1.0 n) 2e+239)
(- (+ 1.0 (/ x n)) t_0)
(/ 0.3333333333333333 (* x (* x (* x n))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (x * n);
double tmp;
if ((1.0 / n) <= -1e-9) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-50) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.02) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+239) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 0.3333333333333333 / (x * (x * (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 / (x * n)
if ((1.0d0 / n) <= (-1d-9)) then
tmp = t_1
else if ((1.0d0 / n) <= 2d-50) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 0.02d0) then
tmp = t_1
else if ((1.0d0 / n) <= 2d+239) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 0.3333333333333333d0 / (x * (x * (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 / (x * n);
double tmp;
if ((1.0 / n) <= -1e-9) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-50) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.02) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+239) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = t_0 / (x * n) tmp = 0 if (1.0 / n) <= -1e-9: tmp = t_1 elif (1.0 / n) <= 2e-50: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 0.02: tmp = t_1 elif (1.0 / n) <= 2e+239: tmp = (1.0 + (x / n)) - t_0 else: tmp = 0.3333333333333333 / (x * (x * (x * n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(x * n)) tmp = 0.0 if (Float64(1.0 / n) <= -1e-9) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-50) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 0.02) tmp = t_1; elseif (Float64(1.0 / n) <= 2e+239) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = t_0 / (x * n); tmp = 0.0; if ((1.0 / n) <= -1e-9) tmp = t_1; elseif ((1.0 / n) <= 2e-50) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 0.02) tmp = t_1; elseif ((1.0 / n) <= 2e+239) tmp = (1.0 + (x / n)) - t_0; else tmp = 0.3333333333333333 / (x * (x * (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[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-9], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-50], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.02], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+239], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t\_0}{x \cdot n}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-9}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-50}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.02:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+239}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000006e-9 or 2.00000000000000002e-50 < (/.f64 #s(literal 1 binary64) n) < 0.0200000000000000004Initial program 86.2%
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-*.f6493.4
Simplified93.4%
if -1.00000000000000006e-9 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000002e-50Initial program 24.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6480.9
Simplified80.9%
/-lowering-/.f64N/A
diff-logN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6481.0
Applied egg-rr81.0%
if 0.0200000000000000004 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999998e239Initial program 80.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-/.f6482.8
Simplified82.8%
if 1.99999999999999998e239 < (/.f64 #s(literal 1 binary64) n) Initial program 3.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f649.7
Simplified9.7%
Taylor expanded in x around inf
Simplified100.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0
Simplified100.0%
Final simplification85.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* x n))))
(if (<= (/ 1.0 n) -1e-9)
t_1
(if (<= (/ 1.0 n) 2e-50)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 0.02)
t_1
(if (<= (/ 1.0 n) 2e+239)
(- 1.0 t_0)
(/ 0.3333333333333333 (* x (* x (* x n))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (x * n);
double tmp;
if ((1.0 / n) <= -1e-9) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-50) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.02) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+239) {
tmp = 1.0 - t_0;
} else {
tmp = 0.3333333333333333 / (x * (x * (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 / (x * n)
if ((1.0d0 / n) <= (-1d-9)) then
tmp = t_1
else if ((1.0d0 / n) <= 2d-50) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 0.02d0) then
tmp = t_1
else if ((1.0d0 / n) <= 2d+239) then
tmp = 1.0d0 - t_0
else
tmp = 0.3333333333333333d0 / (x * (x * (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 / (x * n);
double tmp;
if ((1.0 / n) <= -1e-9) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-50) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.02) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+239) {
tmp = 1.0 - t_0;
} else {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = t_0 / (x * n) tmp = 0 if (1.0 / n) <= -1e-9: tmp = t_1 elif (1.0 / n) <= 2e-50: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 0.02: tmp = t_1 elif (1.0 / n) <= 2e+239: tmp = 1.0 - t_0 else: tmp = 0.3333333333333333 / (x * (x * (x * n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(x * n)) tmp = 0.0 if (Float64(1.0 / n) <= -1e-9) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-50) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 0.02) tmp = t_1; elseif (Float64(1.0 / n) <= 2e+239) tmp = Float64(1.0 - t_0); else tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = t_0 / (x * n); tmp = 0.0; if ((1.0 / n) <= -1e-9) tmp = t_1; elseif ((1.0 / n) <= 2e-50) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 0.02) tmp = t_1; elseif ((1.0 / n) <= 2e+239) tmp = 1.0 - t_0; else tmp = 0.3333333333333333 / (x * (x * (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[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-9], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-50], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.02], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+239], N[(1.0 - t$95$0), $MachinePrecision], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t\_0}{x \cdot n}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-9}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-50}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.02:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+239}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000006e-9 or 2.00000000000000002e-50 < (/.f64 #s(literal 1 binary64) n) < 0.0200000000000000004Initial program 86.2%
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-*.f6493.4
Simplified93.4%
if -1.00000000000000006e-9 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000002e-50Initial program 24.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6480.9
Simplified80.9%
/-lowering-/.f64N/A
diff-logN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6481.0
Applied egg-rr81.0%
if 0.0200000000000000004 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999998e239Initial program 80.1%
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-/.f6480.1
Simplified80.1%
if 1.99999999999999998e239 < (/.f64 #s(literal 1 binary64) n) Initial program 3.1%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f649.7
Simplified9.7%
Taylor expanded in x around inf
Simplified100.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0
Simplified100.0%
Final simplification85.5%
(FPCore (x n)
:precision binary64
(if (<= x 0.86)
(/ (- x (log x)) n)
(if (<= x 3.4e+159)
(/ (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) n)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.86) {
tmp = (x - log(x)) / n;
} else if (x <= 3.4e+159) {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.86d0) then
tmp = (x - log(x)) / n
else if (x <= 3.4d+159) then
tmp = ((1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.86) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 3.4e+159) {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.86: tmp = (x - math.log(x)) / n elif x <= 3.4e+159: tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.86) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 3.4e+159) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.86) tmp = (x - log(x)) / n; elseif (x <= 3.4e+159) tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.86], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 3.4e+159], N[(N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.86:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{+159}:\\
\;\;\;\;\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.859999999999999987Initial program 42.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6457.7
Simplified57.7%
Taylor expanded in x around 0
--lowering--.f64N/A
log-lowering-log.f6457.3
Simplified57.3%
if 0.859999999999999987 < x < 3.39999999999999991e159Initial program 44.6%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6441.5
Simplified41.5%
Taylor expanded in x around inf
/-lowering-/.f64N/A
associate--l+N/A
unpow2N/A
associate-/r*N/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-subN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6466.0
Simplified66.0%
if 3.39999999999999991e159 < 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-/.f6443.2
Simplified43.2%
Taylor expanded in n around inf
Simplified83.0%
metadata-eval83.0
Applied egg-rr83.0%
(FPCore (x n)
:precision binary64
(if (<= x 0.58)
(- 0.0 (/ (log x) n))
(if (<= x 3e+160)
(/ (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) n)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.58) {
tmp = 0.0 - (log(x) / n);
} else if (x <= 3e+160) {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.58d0) then
tmp = 0.0d0 - (log(x) / n)
else if (x <= 3d+160) then
tmp = ((1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.58) {
tmp = 0.0 - (Math.log(x) / n);
} else if (x <= 3e+160) {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.58: tmp = 0.0 - (math.log(x) / n) elif x <= 3e+160: tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.58) tmp = Float64(0.0 - Float64(log(x) / n)); elseif (x <= 3e+160) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.58) tmp = 0.0 - (log(x) / n); elseif (x <= 3e+160) tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.58], N[(0.0 - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3e+160], N[(N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.58:\\
\;\;\;\;0 - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.57999999999999996Initial program 42.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-/.f6442.2
Simplified42.2%
Taylor expanded in n around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6457.1
Simplified57.1%
if 0.57999999999999996 < x < 2.9999999999999999e160Initial program 44.6%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6441.5
Simplified41.5%
Taylor expanded in x around inf
/-lowering-/.f64N/A
associate--l+N/A
unpow2N/A
associate-/r*N/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-subN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6466.0
Simplified66.0%
if 2.9999999999999999e160 < 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-/.f6443.2
Simplified43.2%
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.32e+24) (/ 0.3333333333333333 (* x (* x (* x n)))) (/ (+ (/ 1.0 n) (/ (+ -0.5 (/ 0.3333333333333333 x)) (* x n))) x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.32e+24) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else {
tmp = ((1.0 / n) + ((-0.5 + (0.3333333333333333 / x)) / (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.32d+24)) then
tmp = 0.3333333333333333d0 / (x * (x * (x * n)))
else
tmp = ((1.0d0 / n) + (((-0.5d0) + (0.3333333333333333d0 / x)) / (x * n))) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.32e+24) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else {
tmp = ((1.0 / n) + ((-0.5 + (0.3333333333333333 / x)) / (x * n))) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1.32e+24: tmp = 0.3333333333333333 / (x * (x * (x * n))) else: tmp = ((1.0 / n) + ((-0.5 + (0.3333333333333333 / x)) / (x * n))) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1.32e+24) tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / Float64(x * n))) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1.32e+24) tmp = 0.3333333333333333 / (x * (x * (x * n))); else tmp = ((1.0 / n) + ((-0.5 + (0.3333333333333333 / x)) / (x * n))) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.32e+24], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1.32 \cdot 10^{+24}:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x \cdot n}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.32000000000000012e24Initial program 100.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6454.1
Simplified54.1%
Taylor expanded in x around inf
Simplified43.5%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6476.7
Simplified76.7%
if -1.32000000000000012e24 < (/.f64 #s(literal 1 binary64) n) Initial program 32.9%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6462.2
Simplified62.2%
Taylor expanded in x around inf
Simplified40.3%
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lft-identityN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6440.3
Applied egg-rr40.3%
Final simplification50.3%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -1.32e+24) (/ 0.3333333333333333 (* x (* x (* x n)))) (/ (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) n)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.32e+24) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / 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.32d+24)) then
tmp = 0.3333333333333333d0 / (x * (x * (x * n)))
else
tmp = ((1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.32e+24) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1.32e+24: tmp = 0.3333333333333333 / (x * (x * (x * n))) else: tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1.32e+24) tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1.32e+24) tmp = 0.3333333333333333 / (x * (x * (x * n))); else tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.32e+24], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1.32 \cdot 10^{+24}:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.32000000000000012e24Initial program 100.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6454.1
Simplified54.1%
Taylor expanded in x around inf
Simplified43.5%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6476.7
Simplified76.7%
if -1.32000000000000012e24 < (/.f64 #s(literal 1 binary64) n) Initial program 32.9%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6462.2
Simplified62.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
associate--l+N/A
unpow2N/A
associate-/r*N/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-subN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6440.3
Simplified40.3%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -1.32e+24) (/ 0.3333333333333333 (* x (* x (* x n)))) (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) (* x n))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.32e+24) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else {
tmp = (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (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.32d+24)) then
tmp = 0.3333333333333333d0 / (x * (x * (x * n)))
else
tmp = (1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.32e+24) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else {
tmp = (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1.32e+24: tmp = 0.3333333333333333 / (x * (x * (x * n))) else: tmp = (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1.32e+24) tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); else tmp = Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1.32e+24) tmp = 0.3333333333333333 / (x * (x * (x * n))); else tmp = (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.32e+24], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1.32 \cdot 10^{+24}:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x \cdot n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.32000000000000012e24Initial program 100.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6454.1
Simplified54.1%
Taylor expanded in x around inf
Simplified43.5%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6476.7
Simplified76.7%
if -1.32000000000000012e24 < (/.f64 #s(literal 1 binary64) n) Initial program 32.9%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6462.2
Simplified62.2%
Taylor expanded in x around inf
Simplified40.3%
Taylor expanded in n around 0
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
Simplified39.9%
(FPCore (x n) :precision binary64 (let* ((t_0 (/ 1.0 (* x n)))) (if (<= (/ 1.0 n) -4e+220) t_0 (if (<= (/ 1.0 n) -1.32e+24) 0.0 t_0))))
double code(double x, double n) {
double t_0 = 1.0 / (x * n);
double tmp;
if ((1.0 / n) <= -4e+220) {
tmp = t_0;
} else if ((1.0 / n) <= -1.32e+24) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 / (x * n)
if ((1.0d0 / n) <= (-4d+220)) then
tmp = t_0
else if ((1.0d0 / n) <= (-1.32d+24)) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 / (x * n);
double tmp;
if ((1.0 / n) <= -4e+220) {
tmp = t_0;
} else if ((1.0 / n) <= -1.32e+24) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = 1.0 / (x * n) tmp = 0 if (1.0 / n) <= -4e+220: tmp = t_0 elif (1.0 / n) <= -1.32e+24: tmp = 0.0 else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(1.0 / Float64(x * n)) tmp = 0.0 if (Float64(1.0 / n) <= -4e+220) tmp = t_0; elseif (Float64(1.0 / n) <= -1.32e+24) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 / (x * n); tmp = 0.0; if ((1.0 / n) <= -4e+220) tmp = t_0; elseif ((1.0 / n) <= -1.32e+24) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e+220], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.32e+24], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{x \cdot n}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{+220}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq -1.32 \cdot 10^{+24}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4e220 or -1.32000000000000012e24 < (/.f64 #s(literal 1 binary64) n) Initial program 39.7%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6460.7
Simplified60.7%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6440.3
Simplified40.3%
if -4e220 < (/.f64 #s(literal 1 binary64) n) < -1.32000000000000012e24Initial 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-/.f6440.7
Simplified40.7%
Taylor expanded in n around inf
Simplified61.8%
metadata-eval61.8
Applied egg-rr61.8%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -5000000.0) (/ 0.3333333333333333 (* x (* x (* x n)))) (/ (/ 1.0 x) n)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5000000.0) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} 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) <= (-5000000.0d0)) then
tmp = 0.3333333333333333d0 / (x * (x * (x * n)))
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) <= -5000000.0) {
tmp = 0.3333333333333333 / (x * (x * (x * n)));
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -5000000.0: tmp = 0.3333333333333333 / (x * (x * (x * n))) else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -5000000.0) tmp = Float64(0.3333333333333333 / Float64(x * Float64(x * Float64(x * n)))); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -5000000.0) tmp = 0.3333333333333333 / (x * (x * (x * n))); else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -5000000.0], N[(0.3333333333333333 / N[(x * N[(x * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -5000000:\\
\;\;\;\;\frac{0.3333333333333333}{x \cdot \left(x \cdot \left(x \cdot n\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5e6Initial program 100.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6452.7
Simplified52.7%
Taylor expanded in x around inf
Simplified43.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6476.0
Simplified76.0%
if -5e6 < (/.f64 #s(literal 1 binary64) n) Initial program 32.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6462.8
Simplified62.8%
Taylor expanded in x around inf
/-lowering-/.f6439.1
Simplified39.1%
(FPCore (x n) :precision binary64 (if (<= n -7.5e-25) (/ (/ 1.0 x) n) (if (<= n -1.18e-217) 0.0 (/ (/ 1.0 n) x))))
double code(double x, double n) {
double tmp;
if (n <= -7.5e-25) {
tmp = (1.0 / x) / n;
} else if (n <= -1.18e-217) {
tmp = 0.0;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-7.5d-25)) then
tmp = (1.0d0 / x) / n
else if (n <= (-1.18d-217)) then
tmp = 0.0d0
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -7.5e-25) {
tmp = (1.0 / x) / n;
} else if (n <= -1.18e-217) {
tmp = 0.0;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -7.5e-25: tmp = (1.0 / x) / n elif n <= -1.18e-217: tmp = 0.0 else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (n <= -7.5e-25) tmp = Float64(Float64(1.0 / x) / n); elseif (n <= -1.18e-217) tmp = 0.0; else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -7.5e-25) tmp = (1.0 / x) / n; elseif (n <= -1.18e-217) tmp = 0.0; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -7.5e-25], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -1.18e-217], 0.0, N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.5 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;n \leq -1.18 \cdot 10^{-217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if n < -7.49999999999999989e-25Initial program 26.8%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6474.9
Simplified74.9%
Taylor expanded in x around inf
/-lowering-/.f6440.5
Simplified40.5%
if -7.49999999999999989e-25 < n < -1.18000000000000001e-217Initial 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-/.f6440.7
Simplified40.7%
Taylor expanded in n around inf
Simplified61.8%
metadata-eval61.8
Applied egg-rr61.8%
if -1.18000000000000001e-217 < n Initial program 46.8%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6452.9
Simplified52.9%
Taylor expanded in x around inf
Simplified42.9%
Taylor expanded in x around inf
/-lowering-/.f6440.8
Simplified40.8%
(FPCore (x n) :precision binary64 (let* ((t_0 (/ (/ 1.0 n) x))) (if (<= n -7.5e-25) t_0 (if (<= n -2.05e-216) 0.0 t_0))))
double code(double x, double n) {
double t_0 = (1.0 / n) / x;
double tmp;
if (n <= -7.5e-25) {
tmp = t_0;
} else if (n <= -2.05e-216) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 / n) / x
if (n <= (-7.5d-25)) then
tmp = t_0
else if (n <= (-2.05d-216)) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (1.0 / n) / x;
double tmp;
if (n <= -7.5e-25) {
tmp = t_0;
} else if (n <= -2.05e-216) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = (1.0 / n) / x tmp = 0 if n <= -7.5e-25: tmp = t_0 elif n <= -2.05e-216: tmp = 0.0 else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(Float64(1.0 / n) / x) tmp = 0.0 if (n <= -7.5e-25) tmp = t_0; elseif (n <= -2.05e-216) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = (1.0 / n) / x; tmp = 0.0; if (n <= -7.5e-25) tmp = t_0; elseif (n <= -2.05e-216) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[n, -7.5e-25], t$95$0, If[LessEqual[n, -2.05e-216], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{n}}{x}\\
\mathbf{if}\;n \leq -7.5 \cdot 10^{-25}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -2.05 \cdot 10^{-216}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -7.49999999999999989e-25 or -2.05000000000000012e-216 < n Initial program 39.7%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
accelerator-lowering-log1p.f64N/A
log-lowering-log.f6460.7
Simplified60.7%
Taylor expanded in x around inf
Simplified42.6%
Taylor expanded in x around inf
/-lowering-/.f6440.7
Simplified40.7%
if -7.49999999999999989e-25 < n < -2.05000000000000012e-216Initial 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-/.f6440.7
Simplified40.7%
Taylor expanded in n around inf
Simplified61.8%
metadata-eval61.8
Applied egg-rr61.8%
(FPCore (x n) :precision binary64 0.0)
double code(double x, double n) {
return 0.0;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double x, double n) {
return 0.0;
}
def code(x, n): return 0.0
function code(x, n) return 0.0 end
function tmp = code(x, n) tmp = 0.0; end
code[x_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 51.3%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--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.8
Simplified36.8%
Taylor expanded in n around inf
Simplified28.4%
metadata-eval28.4
Applied egg-rr28.4%
herbie shell --seed 2024194
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))