
(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 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(if (<= n -210000.0)
(/
(+
(/
(+
(* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0)))
(/
(+
(*
(/ 0.041666666666666664 n)
(- (pow (log1p x) 4.0) (pow (log x) 4.0)))
(* -0.16666666666666666 (- (pow (log x) 3.0) (pow (log1p x) 3.0))))
n))
n)
(- (log1p x) (log x)))
n)
(if (<= n 25.0)
(- (exp (/ x n)) (pow x (/ 1.0 n)))
(* (/ -1.0 n) (log (/ x (+ x 1.0)))))))
double code(double x, double n) {
double tmp;
if (n <= -210000.0) {
tmp = ((((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) + ((((0.041666666666666664 / n) * (pow(log1p(x), 4.0) - pow(log(x), 4.0))) + (-0.16666666666666666 * (pow(log(x), 3.0) - pow(log1p(x), 3.0)))) / n)) / n) + (log1p(x) - log(x))) / n;
} else if (n <= 25.0) {
tmp = exp((x / n)) - pow(x, (1.0 / n));
} else {
tmp = (-1.0 / n) * log((x / (x + 1.0)));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (n <= -210000.0) {
tmp = ((((0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) + ((((0.041666666666666664 / n) * (Math.pow(Math.log1p(x), 4.0) - Math.pow(Math.log(x), 4.0))) + (-0.16666666666666666 * (Math.pow(Math.log(x), 3.0) - Math.pow(Math.log1p(x), 3.0)))) / n)) / n) + (Math.log1p(x) - Math.log(x))) / n;
} else if (n <= 25.0) {
tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = (-1.0 / n) * Math.log((x / (x + 1.0)));
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -210000.0: tmp = ((((0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0))) + ((((0.041666666666666664 / n) * (math.pow(math.log1p(x), 4.0) - math.pow(math.log(x), 4.0))) + (-0.16666666666666666 * (math.pow(math.log(x), 3.0) - math.pow(math.log1p(x), 3.0)))) / n)) / n) + (math.log1p(x) - math.log(x))) / n elif n <= 25.0: tmp = math.exp((x / n)) - math.pow(x, (1.0 / n)) else: tmp = (-1.0 / n) * math.log((x / (x + 1.0))) return tmp
function code(x, n) tmp = 0.0 if (n <= -210000.0) tmp = Float64(Float64(Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) + Float64(Float64(Float64(Float64(0.041666666666666664 / n) * Float64((log1p(x) ^ 4.0) - (log(x) ^ 4.0))) + Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) - (log1p(x) ^ 3.0)))) / n)) / n) + Float64(log1p(x) - log(x))) / n); elseif (n <= 25.0) tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(-1.0 / n) * log(Float64(x / Float64(x + 1.0)))); end return tmp end
code[x_, n_] := If[LessEqual[n, -210000.0], N[(N[(N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(0.041666666666666664 / n), $MachinePrecision] * N[(N[Power[N[Log[1 + x], $MachinePrecision], 4.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, 25.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / n), $MachinePrecision] * N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -210000:\\
\;\;\;\;\frac{\frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + \frac{\frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) + -0.16666666666666666 \cdot \left({\log x}^{3} - {\left(\mathsf{log1p}\left(x\right)\right)}^{3}\right)}{n}}{n} + \left(\mathsf{log1p}\left(x\right) - \log x\right)}{n}\\
\mathbf{elif}\;n \leq 25:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{n} \cdot \log \left(\frac{x}{x + 1}\right)\\
\end{array}
\end{array}
if n < -2.1e5Initial program 35.3%
Taylor expanded in n around -inf
Simplified73.4%
if -2.1e5 < n < 25Initial program 81.4%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6499.9%
Applied egg-rr99.9%
Taylor expanded in x around 0
/-lowering-/.f6499.9%
Simplified99.9%
if 25 < n Initial program 25.0%
Taylor expanded in n around -inf
Simplified83.3%
Applied egg-rr67.6%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6483.4%
Simplified83.4%
Final simplification88.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= n -62000000.0)
(*
(/ 1.0 (+ t_0 (pow (+ x 1.0) (/ 1.0 n))))
(/
(-
(* 2.0 (+ (log1p x) (/ (pow (log1p x) 2.0) n)))
(* 2.0 (+ (log x) (/ (pow (log x) 2.0) n))))
n))
(if (<= n 25.0)
(- (exp (/ x n)) t_0)
(* (/ -1.0 n) (log (/ x (+ x 1.0))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (n <= -62000000.0) {
tmp = (1.0 / (t_0 + pow((x + 1.0), (1.0 / n)))) * (((2.0 * (log1p(x) + (pow(log1p(x), 2.0) / n))) - (2.0 * (log(x) + (pow(log(x), 2.0) / n)))) / n);
} else if (n <= 25.0) {
tmp = exp((x / n)) - t_0;
} else {
tmp = (-1.0 / n) * log((x / (x + 1.0)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (n <= -62000000.0) {
tmp = (1.0 / (t_0 + Math.pow((x + 1.0), (1.0 / n)))) * (((2.0 * (Math.log1p(x) + (Math.pow(Math.log1p(x), 2.0) / n))) - (2.0 * (Math.log(x) + (Math.pow(Math.log(x), 2.0) / n)))) / n);
} else if (n <= 25.0) {
tmp = Math.exp((x / n)) - t_0;
} else {
tmp = (-1.0 / n) * Math.log((x / (x + 1.0)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if n <= -62000000.0: tmp = (1.0 / (t_0 + math.pow((x + 1.0), (1.0 / n)))) * (((2.0 * (math.log1p(x) + (math.pow(math.log1p(x), 2.0) / n))) - (2.0 * (math.log(x) + (math.pow(math.log(x), 2.0) / n)))) / n) elif n <= 25.0: tmp = math.exp((x / n)) - t_0 else: tmp = (-1.0 / n) * math.log((x / (x + 1.0))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (n <= -62000000.0) tmp = Float64(Float64(1.0 / Float64(t_0 + (Float64(x + 1.0) ^ Float64(1.0 / n)))) * Float64(Float64(Float64(2.0 * Float64(log1p(x) + Float64((log1p(x) ^ 2.0) / n))) - Float64(2.0 * Float64(log(x) + Float64((log(x) ^ 2.0) / n)))) / n)); elseif (n <= 25.0) tmp = Float64(exp(Float64(x / n)) - t_0); else tmp = Float64(Float64(-1.0 / n) * log(Float64(x / Float64(x + 1.0)))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -62000000.0], N[(N[(1.0 / N[(t$95$0 + N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(2.0 * N[(N[Log[1 + x], $MachinePrecision] + N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(2.0 * N[(N[Log[x], $MachinePrecision] + N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 25.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(-1.0 / n), $MachinePrecision] * N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;n \leq -62000000:\\
\;\;\;\;\frac{1}{t\_0 + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \cdot \frac{2 \cdot \left(\mathsf{log1p}\left(x\right) + \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n}\right) - 2 \cdot \left(\log x + \frac{{\log x}^{2}}{n}\right)}{n}\\
\mathbf{elif}\;n \leq 25:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{n} \cdot \log \left(\frac{x}{x + 1}\right)\\
\end{array}
\end{array}
if n < -6.2e7Initial program 34.5%
flip--N/A
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
Applied egg-rr34.5%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified73.0%
if -6.2e7 < n < 25Initial program 81.4%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6499.8%
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f6499.8%
Simplified99.8%
if 25 < n Initial program 25.0%
Taylor expanded in n around -inf
Simplified83.3%
Applied egg-rr67.6%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6483.4%
Simplified83.4%
Final simplification87.9%
(FPCore (x n)
:precision binary64
(if (<= n -45000000.0)
(/
(+
(log1p x)
(- (/ (* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0))) n) (log x)))
n)
(if (<= n 25.0)
(- (exp (/ x n)) (pow x (/ 1.0 n)))
(* (/ -1.0 n) (log (/ x (+ x 1.0)))))))
double code(double x, double n) {
double tmp;
if (n <= -45000000.0) {
tmp = (log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) / n) - log(x))) / n;
} else if (n <= 25.0) {
tmp = exp((x / n)) - pow(x, (1.0 / n));
} else {
tmp = (-1.0 / n) * log((x / (x + 1.0)));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (n <= -45000000.0) {
tmp = (Math.log1p(x) + (((0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) / n) - Math.log(x))) / n;
} else if (n <= 25.0) {
tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = (-1.0 / n) * Math.log((x / (x + 1.0)));
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -45000000.0: tmp = (math.log1p(x) + (((0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0))) / n) - math.log(x))) / n elif n <= 25.0: tmp = math.exp((x / n)) - math.pow(x, (1.0 / n)) else: tmp = (-1.0 / n) * math.log((x / (x + 1.0))) return tmp
function code(x, n) tmp = 0.0 if (n <= -45000000.0) tmp = Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) / n) - log(x))) / n); elseif (n <= 25.0) tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(-1.0 / n) * log(Float64(x / Float64(x + 1.0)))); end return tmp end
code[x_, n_] := If[LessEqual[n, -45000000.0], N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, 25.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / n), $MachinePrecision] * N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -45000000:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(\frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right)}{n} - \log x\right)}{n}\\
\mathbf{elif}\;n \leq 25:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{n} \cdot \log \left(\frac{x}{x + 1}\right)\\
\end{array}
\end{array}
if n < -4.5e7Initial program 34.5%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified73.0%
if -4.5e7 < n < 25Initial program 81.4%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6499.8%
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f6499.8%
Simplified99.8%
if 25 < n Initial program 25.0%
Taylor expanded in n around -inf
Simplified83.3%
Applied egg-rr67.6%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6483.4%
Simplified83.4%
Final simplification87.9%
(FPCore (x n)
:precision binary64
(if (<= n -22000000000.0)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= n 25.0)
(- (exp (/ x n)) (pow x (/ 1.0 n)))
(* (/ -1.0 n) (log (/ x (+ x 1.0)))))))
double code(double x, double n) {
double tmp;
if (n <= -22000000000.0) {
tmp = log(((x + 1.0) / x)) / n;
} else if (n <= 25.0) {
tmp = exp((x / n)) - pow(x, (1.0 / n));
} else {
tmp = (-1.0 / n) * log((x / (x + 1.0)));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-22000000000.0d0)) then
tmp = log(((x + 1.0d0) / x)) / n
else if (n <= 25.0d0) then
tmp = exp((x / n)) - (x ** (1.0d0 / n))
else
tmp = ((-1.0d0) / n) * log((x / (x + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -22000000000.0) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if (n <= 25.0) {
tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = (-1.0 / n) * Math.log((x / (x + 1.0)));
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -22000000000.0: tmp = math.log(((x + 1.0) / x)) / n elif n <= 25.0: tmp = math.exp((x / n)) - math.pow(x, (1.0 / n)) else: tmp = (-1.0 / n) * math.log((x / (x + 1.0))) return tmp
function code(x, n) tmp = 0.0 if (n <= -22000000000.0) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (n <= 25.0) tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(-1.0 / n) * log(Float64(x / Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -22000000000.0) tmp = log(((x + 1.0) / x)) / n; elseif (n <= 25.0) tmp = exp((x / n)) - (x ^ (1.0 / n)); else tmp = (-1.0 / n) * log((x / (x + 1.0))); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -22000000000.0], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, 25.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / n), $MachinePrecision] * N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -22000000000:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;n \leq 25:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{n} \cdot \log \left(\frac{x}{x + 1}\right)\\
\end{array}
\end{array}
if n < -2.2e10Initial program 34.5%
Taylor expanded in n around -inf
Simplified73.0%
Applied egg-rr48.8%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6472.2%
Simplified72.2%
associate-*l/N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-logN/A
clear-numN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6472.2%
Applied egg-rr72.2%
if -2.2e10 < n < 25Initial program 81.4%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6499.8%
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f6499.8%
Simplified99.8%
if 25 < n Initial program 25.0%
Taylor expanded in n around -inf
Simplified83.3%
Applied egg-rr67.6%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6483.4%
Simplified83.4%
Final simplification87.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 0.05)
(/ (log (/ (+ x 1.0) x)) n)
(-
(+ (* x (+ (/ 1.0 n) (* x (+ (/ 0.5 (* n n)) (/ -0.5 n))))) 1.0)
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.05) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = ((x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))))) + 1.0) - 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 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2d-11)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 0.05d0) then
tmp = log(((x + 1.0d0) / x)) / n
else
tmp = ((x * ((1.0d0 / n) + (x * ((0.5d0 / (n * n)) + ((-0.5d0) / n))))) + 1.0d0) - t_0
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) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.05) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = ((x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))))) + 1.0) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 0.05: tmp = math.log(((x + 1.0) / x)) / n else: tmp = ((x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))))) + 1.0) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 0.05) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(Float64(Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 / Float64(n * n)) + Float64(-0.5 / n))))) + 1.0) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2e-11) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 0.05) tmp = log(((x + 1.0) / x)) / n; else tmp = ((x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))))) + 1.0) - t_0; 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], -2e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.05], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(x * N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.05:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(\frac{1}{n} + x \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right)\right) + 1\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11Initial program 98.4%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6498.4%
Applied egg-rr98.4%
Taylor expanded in x around inf
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6496.0%
Simplified96.0%
div-invN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6496.0%
Applied egg-rr96.0%
if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 0.050000000000000003Initial program 29.4%
Taylor expanded in n around -inf
Simplified79.2%
Applied egg-rr59.6%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6478.8%
Simplified78.8%
associate-*l/N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-logN/A
clear-numN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6478.8%
Applied egg-rr78.8%
if 0.050000000000000003 < (/.f64 #s(literal 1 binary64) n) Initial program 48.6%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6481.0%
Simplified81.0%
Final simplification84.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 0.05)
(/ (log (/ (+ x 1.0) x)) n)
(- (+ (* x (+ (/ 1.0 n) (* 0.5 (/ x (* n n))))) 1.0) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.05) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = ((x * ((1.0 / n) + (0.5 * (x / (n * n))))) + 1.0) - 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 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2d-11)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 0.05d0) then
tmp = log(((x + 1.0d0) / x)) / n
else
tmp = ((x * ((1.0d0 / n) + (0.5d0 * (x / (n * n))))) + 1.0d0) - t_0
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) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.05) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = ((x * ((1.0 / n) + (0.5 * (x / (n * n))))) + 1.0) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 0.05: tmp = math.log(((x + 1.0) / x)) / n else: tmp = ((x * ((1.0 / n) + (0.5 * (x / (n * n))))) + 1.0) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 0.05) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(Float64(Float64(x * Float64(Float64(1.0 / n) + Float64(0.5 * Float64(x / Float64(n * n))))) + 1.0) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2e-11) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 0.05) tmp = log(((x + 1.0) / x)) / n; else tmp = ((x * ((1.0 / n) + (0.5 * (x / (n * n))))) + 1.0) - t_0; 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], -2e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.05], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(0.5 * N[(x / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.05:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(\frac{1}{n} + 0.5 \cdot \frac{x}{n \cdot n}\right) + 1\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11Initial program 98.4%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6498.4%
Applied egg-rr98.4%
Taylor expanded in x around inf
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6496.0%
Simplified96.0%
div-invN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6496.0%
Applied egg-rr96.0%
if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 0.050000000000000003Initial program 29.4%
Taylor expanded in n around -inf
Simplified79.2%
Applied egg-rr59.6%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6478.8%
Simplified78.8%
associate-*l/N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-logN/A
clear-numN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6478.8%
Applied egg-rr78.8%
if 0.050000000000000003 < (/.f64 #s(literal 1 binary64) n) Initial program 48.6%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6481.0%
Simplified81.0%
Taylor expanded in n around 0
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6481.0%
Simplified81.0%
Final simplification84.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e+18)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 2e+178)
(- (+ (/ x n) 1.0) t_0)
(*
(/ 1.0 n)
(/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e+18) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e+178) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2d-11)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 1d+18) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 2d+178) then
tmp = ((x / n) + 1.0d0) - t_0
else
tmp = (1.0d0 / n) * ((1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e+18) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e+178) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 1e+18: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 2e+178: tmp = ((x / n) + 1.0) - t_0 else: tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e+18) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 2e+178) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); else tmp = Float64(Float64(1.0 / n) * Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2e-11) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 1e+18) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 2e+178) tmp = ((x / n) + 1.0) - t_0; else tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+18], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+178], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] * N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+18}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+178}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11Initial program 98.4%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6498.4%
Applied egg-rr98.4%
Taylor expanded in x around inf
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6496.0%
Simplified96.0%
div-invN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6496.0%
Applied egg-rr96.0%
if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 1e18Initial program 29.9%
Taylor expanded in n around -inf
Simplified78.6%
Applied egg-rr59.2%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6478.3%
Simplified78.3%
associate-*l/N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-logN/A
clear-numN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6478.3%
Applied egg-rr78.3%
if 1e18 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e178Initial program 77.9%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6479.5%
Simplified79.5%
if 2.0000000000000001e178 < (/.f64 #s(literal 1 binary64) n) Initial program 3.1%
Taylor expanded in n around -inf
Simplified0.0%
Applied egg-rr0.0%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f647.2%
Simplified7.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified100.0%
Final simplification84.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e+18)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e+163)
(- 1.0 t_0)
(*
(/ 1.0 n)
(/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e+18) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+163) {
tmp = 1.0 - t_0;
} else {
tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2d-11)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 1d+18) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d+163) then
tmp = 1.0d0 - t_0
else
tmp = (1.0d0 / n) * ((1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e+18) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+163) {
tmp = 1.0 - t_0;
} else {
tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 1e+18: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e+163: tmp = 1.0 - t_0 else: tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e+18) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e+163) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(1.0 / n) * Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2e-11) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 1e+18) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e+163) tmp = 1.0 - t_0; else tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+18], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+163], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] * N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+18}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+163}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11Initial program 98.4%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6498.4%
Applied egg-rr98.4%
Taylor expanded in x around inf
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6496.0%
Simplified96.0%
div-invN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6496.0%
Applied egg-rr96.0%
if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 1e18Initial program 29.9%
Taylor expanded in n around -inf
Simplified78.6%
Applied egg-rr59.2%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6478.3%
Simplified78.3%
associate-*l/N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-logN/A
clear-numN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6478.3%
Applied egg-rr78.3%
if 1e18 < (/.f64 #s(literal 1 binary64) n) < 5e163Initial program 80.4%
Taylor expanded in x around 0
Simplified80.4%
if 5e163 < (/.f64 #s(literal 1 binary64) n) Initial program 8.5%
Taylor expanded in n around -inf
Simplified0.0%
Applied egg-rr0.0%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f646.9%
Simplified6.9%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified94.6%
Final simplification84.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-11)
(/ (/ t_0 x) n)
(if (<= (/ 1.0 n) 1e+18)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e+163)
(- 1.0 t_0)
(*
(/ 1.0 n)
(/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = (t_0 / x) / n;
} else if ((1.0 / n) <= 1e+18) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+163) {
tmp = 1.0 - t_0;
} else {
tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2d-11)) then
tmp = (t_0 / x) / n
else if ((1.0d0 / n) <= 1d+18) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d+163) then
tmp = 1.0d0 - t_0
else
tmp = (1.0d0 / n) * ((1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = (t_0 / x) / n;
} else if ((1.0 / n) <= 1e+18) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+163) {
tmp = 1.0 - t_0;
} else {
tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-11: tmp = (t_0 / x) / n elif (1.0 / n) <= 1e+18: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e+163: tmp = 1.0 - t_0 else: tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = Float64(Float64(t_0 / x) / n); elseif (Float64(1.0 / n) <= 1e+18) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e+163) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(1.0 / n) * Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2e-11) tmp = (t_0 / x) / n; elseif ((1.0 / n) <= 1e+18) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e+163) tmp = 1.0 - t_0; else tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], N[(N[(t$95$0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+18], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+163], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] * N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{\frac{t\_0}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+18}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+163}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11Initial program 98.4%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6498.4%
Applied egg-rr98.4%
Taylor expanded in x around inf
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6496.0%
Simplified96.0%
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
div-invN/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6496.0%
Applied egg-rr96.0%
if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 1e18Initial program 29.9%
Taylor expanded in n around -inf
Simplified78.6%
Applied egg-rr59.2%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6478.3%
Simplified78.3%
associate-*l/N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-logN/A
clear-numN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6478.3%
Applied egg-rr78.3%
if 1e18 < (/.f64 #s(literal 1 binary64) n) < 5e163Initial program 80.4%
Taylor expanded in x around 0
Simplified80.4%
if 5e163 < (/.f64 #s(literal 1 binary64) n) Initial program 8.5%
Taylor expanded in n around -inf
Simplified0.0%
Applied egg-rr0.0%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f646.9%
Simplified6.9%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified94.6%
Final simplification84.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -2e-7)
t_0
(if (<= (/ 1.0 n) 1e+18)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e+163)
t_0
(*
(/ 1.0 n)
(/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) x)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-7) {
tmp = t_0;
} else if ((1.0 / n) <= 1e+18) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+163) {
tmp = t_0;
} else {
tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-2d-7)) then
tmp = t_0
else if ((1.0d0 / n) <= 1d+18) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d+163) then
tmp = t_0
else
tmp = (1.0d0 / n) * ((1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-7) {
tmp = t_0;
} else if ((1.0 / n) <= 1e+18) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+163) {
tmp = t_0;
} else {
tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-7: tmp = t_0 elif (1.0 / n) <= 1e+18: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e+163: tmp = t_0 else: tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -2e-7) tmp = t_0; elseif (Float64(1.0 / n) <= 1e+18) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e+163) tmp = t_0; else tmp = Float64(Float64(1.0 / n) * Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / x)); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -2e-7) tmp = t_0; elseif ((1.0 / n) <= 1e+18) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e+163) tmp = t_0; else tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-7], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+18], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+163], t$95$0, N[(N[(1.0 / n), $MachinePrecision] * N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+18}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+163}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-7 or 1e18 < (/.f64 #s(literal 1 binary64) n) < 5e163Initial program 95.4%
Taylor expanded in x around 0
Simplified64.1%
if -1.9999999999999999e-7 < (/.f64 #s(literal 1 binary64) n) < 1e18Initial program 29.8%
Taylor expanded in n around -inf
Simplified78.1%
Applied egg-rr58.7%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6477.8%
Simplified77.8%
associate-*l/N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-logN/A
clear-numN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6477.8%
Applied egg-rr77.8%
if 5e163 < (/.f64 #s(literal 1 binary64) n) Initial program 8.5%
Taylor expanded in n around -inf
Simplified0.0%
Applied egg-rr0.0%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f646.9%
Simplified6.9%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified94.6%
Final simplification74.0%
(FPCore (x n)
:precision binary64
(if (<= x 4e-207)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.0038)
(/ (- x (log x)) n)
(if (<= x 4.8e+231)
(/ (+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* n x))) x)) x)
0.0))))
double code(double x, double n) {
double tmp;
if (x <= 4e-207) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.0038) {
tmp = (x - log(x)) / n;
} else if (x <= 4.8e+231) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 4d-207) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.0038d0) then
tmp = (x - log(x)) / n
else if (x <= 4.8d+231) then
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (n * x))) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 4e-207) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.0038) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 4.8e+231) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 4e-207: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.0038: tmp = (x - math.log(x)) / n elif x <= 4.8e+231: tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 4e-207) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.0038) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 4.8e+231) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(n * x))) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 4e-207) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.0038) tmp = (x - log(x)) / n; elseif (x <= 4.8e+231) tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 4e-207], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.0038], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 4.8e+231], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{-207}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.0038:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+231}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3.9999999999999997e-207Initial program 57.3%
Taylor expanded in x around 0
Simplified57.3%
if 3.9999999999999997e-207 < x < 0.00379999999999999999Initial program 34.6%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6435.6%
Simplified35.6%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6455.7%
Simplified55.7%
Taylor expanded in x around 0
--lowering--.f64N/A
log-lowering-log.f6455.3%
Simplified55.3%
if 0.00379999999999999999 < x < 4.80000000000000013e231Initial program 58.1%
Taylor expanded in n around -inf
Simplified60.2%
Applied egg-rr33.8%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6458.1%
Simplified58.1%
Taylor expanded in x around -inf
associate-*r/N/A
mul-1-negN/A
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
remove-double-negN/A
/-lowering-/.f64N/A
Simplified71.4%
if 4.80000000000000013e231 < x Initial program 95.2%
Taylor expanded in x around 0
Simplified59.1%
Taylor expanded in n around inf
Simplified95.2%
metadata-eval95.2%
Applied egg-rr95.2%
Final simplification64.5%
(FPCore (x n)
:precision binary64
(if (<= x 0.0038)
(/ (- x (log x)) n)
(if (<= x 4.4e+231)
(/ (+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* n x))) x)) x)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.0038) {
tmp = (x - log(x)) / n;
} else if (x <= 4.4e+231) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.0038d0) then
tmp = (x - log(x)) / n
else if (x <= 4.4d+231) then
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (n * x))) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.0038) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 4.4e+231) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.0038: tmp = (x - math.log(x)) / n elif x <= 4.4e+231: tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.0038) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 4.4e+231) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(n * x))) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.0038) tmp = (x - log(x)) / n; elseif (x <= 4.4e+231) tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.0038], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 4.4e+231], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0038:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{+231}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.00379999999999999999Initial program 41.8%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6438.0%
Simplified38.0%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6450.7%
Simplified50.7%
Taylor expanded in x around 0
--lowering--.f64N/A
log-lowering-log.f6450.4%
Simplified50.4%
if 0.00379999999999999999 < x < 4.39999999999999983e231Initial program 58.1%
Taylor expanded in n around -inf
Simplified60.2%
Applied egg-rr33.8%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6458.1%
Simplified58.1%
Taylor expanded in x around -inf
associate-*r/N/A
mul-1-negN/A
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
remove-double-negN/A
/-lowering-/.f64N/A
Simplified71.4%
if 4.39999999999999983e231 < x Initial program 95.2%
Taylor expanded in x around 0
Simplified59.1%
Taylor expanded in n around inf
Simplified95.2%
metadata-eval95.2%
Applied egg-rr95.2%
Final simplification61.1%
(FPCore (x n)
:precision binary64
(if (<= x 0.0038)
(- 0.0 (/ (log x) n))
(if (<= x 4.4e+231)
(/ (+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* n x))) x)) x)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.0038) {
tmp = 0.0 - (log(x) / n);
} else if (x <= 4.4e+231) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.0038d0) then
tmp = 0.0d0 - (log(x) / n)
else if (x <= 4.4d+231) then
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (n * x))) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.0038) {
tmp = 0.0 - (Math.log(x) / n);
} else if (x <= 4.4e+231) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.0038: tmp = 0.0 - (math.log(x) / n) elif x <= 4.4e+231: tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.0038) tmp = Float64(0.0 - Float64(log(x) / n)); elseif (x <= 4.4e+231) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(n * x))) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.0038) tmp = 0.0 - (log(x) / n); elseif (x <= 4.4e+231) tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.0038], N[(0.0 - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.4e+231], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0038:\\
\;\;\;\;0 - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{+231}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.00379999999999999999Initial program 41.8%
Taylor expanded in x around 0
Simplified41.2%
Taylor expanded in n around inf
associate-*r/N/A
mul-1-negN/A
log-recN/A
/-lowering-/.f64N/A
log-recN/A
mul-1-negN/A
*-lowering-*.f64N/A
log-lowering-log.f6449.6%
Simplified49.6%
if 0.00379999999999999999 < x < 4.39999999999999983e231Initial program 58.1%
Taylor expanded in n around -inf
Simplified60.2%
Applied egg-rr33.8%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6458.1%
Simplified58.1%
Taylor expanded in x around -inf
associate-*r/N/A
mul-1-negN/A
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
remove-double-negN/A
/-lowering-/.f64N/A
Simplified71.4%
if 4.39999999999999983e231 < x Initial program 95.2%
Taylor expanded in x around 0
Simplified59.1%
Taylor expanded in n around inf
Simplified95.2%
metadata-eval95.2%
Applied egg-rr95.2%
Final simplification60.6%
(FPCore (x n)
:precision binary64
(if (<= x 0.0038)
(* (log x) (/ -1.0 n))
(if (<= x 4.4e+231)
(/ (+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* n x))) x)) x)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.0038) {
tmp = log(x) * (-1.0 / n);
} else if (x <= 4.4e+231) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.0038d0) then
tmp = log(x) * ((-1.0d0) / n)
else if (x <= 4.4d+231) then
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (n * x))) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.0038) {
tmp = Math.log(x) * (-1.0 / n);
} else if (x <= 4.4e+231) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.0038: tmp = math.log(x) * (-1.0 / n) elif x <= 4.4e+231: tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.0038) tmp = Float64(log(x) * Float64(-1.0 / n)); elseif (x <= 4.4e+231) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(n * x))) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.0038) tmp = log(x) * (-1.0 / n); elseif (x <= 4.4e+231) tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.0038], N[(N[Log[x], $MachinePrecision] * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.4e+231], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0038:\\
\;\;\;\;\log x \cdot \frac{-1}{n}\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{+231}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.00379999999999999999Initial program 41.8%
Taylor expanded in n around -inf
Simplified65.7%
Applied egg-rr65.6%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6450.8%
Simplified50.8%
Taylor expanded in x around 0
log-lowering-log.f6449.5%
Simplified49.5%
if 0.00379999999999999999 < x < 4.39999999999999983e231Initial program 58.1%
Taylor expanded in n around -inf
Simplified60.2%
Applied egg-rr33.8%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6458.1%
Simplified58.1%
Taylor expanded in x around -inf
associate-*r/N/A
mul-1-negN/A
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
remove-double-negN/A
/-lowering-/.f64N/A
Simplified71.4%
if 4.39999999999999983e231 < x Initial program 95.2%
Taylor expanded in x around 0
Simplified59.1%
Taylor expanded in n around inf
Simplified95.2%
metadata-eval95.2%
Applied egg-rr95.2%
Final simplification60.6%
(FPCore (x n) :precision binary64 (if (<= x 2.1e+234) (/ (+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* n x))) x)) x) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 2.1e+234) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2.1d+234) then
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (n * x))) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.1e+234) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.1e+234: tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 2.1e+234) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(n * x))) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.1e+234) tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.1e+234], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.1 \cdot 10^{+234}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.1e234Initial program 47.0%
Taylor expanded in n around -inf
Simplified63.9%
Applied egg-rr55.5%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6453.1%
Simplified53.1%
Taylor expanded in x around -inf
associate-*r/N/A
mul-1-negN/A
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
remove-double-negN/A
/-lowering-/.f64N/A
Simplified47.2%
if 2.1e234 < x Initial program 95.2%
Taylor expanded in x around 0
Simplified59.1%
Taylor expanded in n around inf
Simplified95.2%
metadata-eval95.2%
Applied egg-rr95.2%
Final simplification52.2%
(FPCore (x n) :precision binary64 (if (<= x 9.5e+231) (* (/ 1.0 n) (/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) x)) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 9.5e+231) {
tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 9.5d+231) then
tmp = (1.0d0 / n) * ((1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / x)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 9.5e+231) {
tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 9.5e+231: tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 9.5e+231) tmp = Float64(Float64(1.0 / n) * Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / x)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 9.5e+231) tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 9.5e+231], N[(N[(1.0 / n), $MachinePrecision] * N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.5 \cdot 10^{+231}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 9.5000000000000002e231Initial program 47.0%
Taylor expanded in n around -inf
Simplified63.9%
Applied egg-rr55.5%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6453.1%
Simplified53.1%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified47.1%
if 9.5000000000000002e231 < x Initial program 95.2%
Taylor expanded in x around 0
Simplified59.1%
Taylor expanded in n around inf
Simplified95.2%
metadata-eval95.2%
Applied egg-rr95.2%
Final simplification52.2%
(FPCore (x n) :precision binary64 (if (<= n -3.4e-6) (/ (/ 1.0 n) x) (if (<= n -9.5e-234) 0.0 (/ 1.0 (* n x)))))
double code(double x, double n) {
double tmp;
if (n <= -3.4e-6) {
tmp = (1.0 / n) / x;
} else if (n <= -9.5e-234) {
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 <= (-3.4d-6)) then
tmp = (1.0d0 / n) / x
else if (n <= (-9.5d-234)) 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 <= -3.4e-6) {
tmp = (1.0 / n) / x;
} else if (n <= -9.5e-234) {
tmp = 0.0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -3.4e-6: tmp = (1.0 / n) / x elif n <= -9.5e-234: tmp = 0.0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) tmp = 0.0 if (n <= -3.4e-6) tmp = Float64(Float64(1.0 / n) / x); elseif (n <= -9.5e-234) tmp = 0.0; else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -3.4e-6) tmp = (1.0 / n) / x; elseif (n <= -9.5e-234) tmp = 0.0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -3.4e-6], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[n, -9.5e-234], 0.0, N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.4 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;n \leq -9.5 \cdot 10^{-234}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if n < -3.40000000000000006e-6Initial program 41.4%
Taylor expanded in n around -inf
Simplified68.0%
Applied egg-rr46.5%
Taylor expanded in n around inf
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6465.7%
Simplified65.7%
Taylor expanded in x around inf
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f6453.3%
Simplified53.3%
if -3.40000000000000006e-6 < n < -9.4999999999999999e-234Initial program 100.0%
Taylor expanded in x around 0
Simplified49.4%
Taylor expanded in n around inf
Simplified53.0%
metadata-eval53.0%
Applied egg-rr53.0%
if -9.4999999999999999e-234 < n Initial program 42.5%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6457.3%
Applied egg-rr57.3%
Taylor expanded in x around inf
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6438.6%
Simplified38.6%
Taylor expanded in n around inf
Simplified41.3%
Final simplification46.7%
(FPCore (x n) :precision binary64 (let* ((t_0 (/ 1.0 (* n x)))) (if (<= n -3.3e-6) t_0 (if (<= n -4.8e-234) 0.0 t_0))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double tmp;
if (n <= -3.3e-6) {
tmp = t_0;
} else if (n <= -4.8e-234) {
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 <= (-3.3d-6)) then
tmp = t_0
else if (n <= (-4.8d-234)) 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 <= -3.3e-6) {
tmp = t_0;
} else if (n <= -4.8e-234) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = 1.0 / (n * x) tmp = 0 if n <= -3.3e-6: tmp = t_0 elif n <= -4.8e-234: tmp = 0.0 else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) tmp = 0.0 if (n <= -3.3e-6) tmp = t_0; elseif (n <= -4.8e-234) 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 <= -3.3e-6) tmp = t_0; elseif (n <= -4.8e-234) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -3.3e-6], t$95$0, If[LessEqual[n, -4.8e-234], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
\mathbf{if}\;n \leq -3.3 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -4.8 \cdot 10^{-234}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -3.30000000000000017e-6 or -4.7999999999999998e-234 < n Initial program 42.2%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6451.8%
Applied egg-rr51.8%
Taylor expanded in x around inf
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6445.4%
Simplified45.4%
Taylor expanded in n around inf
Simplified44.9%
if -3.30000000000000017e-6 < n < -4.7999999999999998e-234Initial program 100.0%
Taylor expanded in x around 0
Simplified49.4%
Taylor expanded in n around inf
Simplified53.0%
metadata-eval53.0%
Applied egg-rr53.0%
Final simplification46.3%
(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 52.1%
Taylor expanded in x around 0
Simplified40.3%
Taylor expanded in n around inf
Simplified28.3%
metadata-eval28.3%
Applied egg-rr28.3%
herbie shell --seed 2024161
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))