
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(if (<= x 13500.0)
(/
(+
(/
(+
(* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0)))
(/ (* 0.16666666666666666 (- (pow (log1p x) 3.0) (pow (log x) 3.0))) n))
n)
(- (log1p x) (log x)))
n)
(/ (exp (/ (log x) n)) (* x n))))
double code(double x, double n) {
double tmp;
if (x <= 13500.0) {
tmp = ((((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) + ((0.16666666666666666 * (pow(log1p(x), 3.0) - pow(log(x), 3.0))) / n)) / n) + (log1p(x) - log(x))) / n;
} else {
tmp = exp((log(x) / n)) / (x * n);
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (x <= 13500.0) {
tmp = ((((0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) + ((0.16666666666666666 * (Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0))) / n)) / n) + (Math.log1p(x) - Math.log(x))) / n;
} else {
tmp = Math.exp((Math.log(x) / n)) / (x * n);
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 13500.0: tmp = ((((0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0))) + ((0.16666666666666666 * (math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0))) / n)) / n) + (math.log1p(x) - math.log(x))) / n else: tmp = math.exp((math.log(x) / n)) / (x * n) return tmp
function code(x, n) tmp = 0.0 if (x <= 13500.0) tmp = Float64(Float64(Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) + Float64(Float64(0.16666666666666666 * Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0))) / n)) / n) + Float64(log1p(x) - log(x))) / n); else tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n)); end return tmp end
code[x_, n_] := If[LessEqual[x, 13500.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[(0.16666666666666666 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 13500:\\
\;\;\;\;\frac{\frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + \frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{n}}{n} + \left(\mathsf{log1p}\left(x\right) - \log x\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\end{array}
\end{array}
if x < 13500Initial program 33.3%
Taylor expanded in n around -inf
Simplified83.5%
if 13500 < x Initial program 61.1%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6461.1%
Applied egg-rr61.1%
Taylor expanded in x around inf
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6499.3%
Simplified99.3%
Final simplification90.2%
(FPCore (x n)
:precision binary64
(if (<= x 700000000.0)
(*
(/ -1.0 n)
(-
(log (/ x (+ x 1.0)))
(/
(+
(* 0.5 (* (log (* x (+ x 1.0))) (log (/ (+ x 1.0) x))))
(* (- (pow (log1p x) 3.0) (pow (log x) 3.0)) (/ 0.16666666666666666 n)))
n)))
(/ (exp (/ (log x) n)) (* x n))))
double code(double x, double n) {
double tmp;
if (x <= 700000000.0) {
tmp = (-1.0 / n) * (log((x / (x + 1.0))) - (((0.5 * (log((x * (x + 1.0))) * log(((x + 1.0) / x)))) + ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) * (0.16666666666666666 / n))) / n));
} else {
tmp = exp((log(x) / n)) / (x * n);
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (x <= 700000000.0) {
tmp = (-1.0 / n) * (Math.log((x / (x + 1.0))) - (((0.5 * (Math.log((x * (x + 1.0))) * Math.log(((x + 1.0) / x)))) + ((Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0)) * (0.16666666666666666 / n))) / n));
} else {
tmp = Math.exp((Math.log(x) / n)) / (x * n);
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 700000000.0: tmp = (-1.0 / n) * (math.log((x / (x + 1.0))) - (((0.5 * (math.log((x * (x + 1.0))) * math.log(((x + 1.0) / x)))) + ((math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0)) * (0.16666666666666666 / n))) / n)) else: tmp = math.exp((math.log(x) / n)) / (x * n) return tmp
function code(x, n) tmp = 0.0 if (x <= 700000000.0) tmp = Float64(Float64(-1.0 / n) * Float64(log(Float64(x / Float64(x + 1.0))) - Float64(Float64(Float64(0.5 * Float64(log(Float64(x * Float64(x + 1.0))) * log(Float64(Float64(x + 1.0) / x)))) + Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) * Float64(0.16666666666666666 / n))) / n))); else tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n)); end return tmp end
code[x_, n_] := If[LessEqual[x, 700000000.0], N[(N[(-1.0 / n), $MachinePrecision] * N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(N[(N[(0.5 * N[(N[Log[N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] * N[(0.16666666666666666 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 700000000:\\
\;\;\;\;\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) \cdot \frac{0.16666666666666666}{n}}{n}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\end{array}
\end{array}
if x < 7e8Initial program 33.1%
Taylor expanded in n around -inf
Simplified83.3%
Applied egg-rr83.3%
if 7e8 < x Initial program 61.7%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6461.7%
Applied egg-rr61.7%
Taylor expanded in x around inf
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6499.6%
Simplified99.6%
Final simplification90.2%
(FPCore (x n)
:precision binary64
(if (<= x 0.36)
(/
(-
(/
(+
(* (pow (log x) 2.0) -0.5)
(/ (* (pow (log x) 3.0) -0.16666666666666666) n))
n)
(log x))
n)
(/ (exp (/ (log x) n)) (* x n))))
double code(double x, double n) {
double tmp;
if (x <= 0.36) {
tmp = ((((pow(log(x), 2.0) * -0.5) + ((pow(log(x), 3.0) * -0.16666666666666666) / n)) / n) - log(x)) / n;
} else {
tmp = exp((log(x) / n)) / (x * n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.36d0) then
tmp = (((((log(x) ** 2.0d0) * (-0.5d0)) + (((log(x) ** 3.0d0) * (-0.16666666666666666d0)) / n)) / n) - log(x)) / n
else
tmp = exp((log(x) / n)) / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.36) {
tmp = ((((Math.pow(Math.log(x), 2.0) * -0.5) + ((Math.pow(Math.log(x), 3.0) * -0.16666666666666666) / n)) / n) - Math.log(x)) / n;
} else {
tmp = Math.exp((Math.log(x) / n)) / (x * n);
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.36: tmp = ((((math.pow(math.log(x), 2.0) * -0.5) + ((math.pow(math.log(x), 3.0) * -0.16666666666666666) / n)) / n) - math.log(x)) / n else: tmp = math.exp((math.log(x) / n)) / (x * n) return tmp
function code(x, n) tmp = 0.0 if (x <= 0.36) tmp = Float64(Float64(Float64(Float64(Float64((log(x) ^ 2.0) * -0.5) + Float64(Float64((log(x) ^ 3.0) * -0.16666666666666666) / n)) / n) - log(x)) / n); else tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.36) tmp = (((((log(x) ^ 2.0) * -0.5) + (((log(x) ^ 3.0) * -0.16666666666666666) / n)) / n) - log(x)) / n; else tmp = exp((log(x) / n)) / (x * n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.36], N[(N[(N[(N[(N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision] + N[(N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.36:\\
\;\;\;\;\frac{\frac{{\log x}^{2} \cdot -0.5 + \frac{{\log x}^{3} \cdot -0.16666666666666666}{n}}{n} - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\end{array}
\end{array}
if x < 0.35999999999999999Initial program 33.3%
Taylor expanded in x around 0
Simplified31.9%
Taylor expanded in n around inf
/-lowering-/.f64N/A
Simplified82.2%
Taylor expanded in n around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
Simplified82.9%
if 0.35999999999999999 < x Initial program 61.1%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f6461.1%
Applied egg-rr61.1%
Taylor expanded in x around inf
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6499.3%
Simplified99.3%
Final simplification89.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (exp (/ (log x) n)) (* x n))))
(if (<= (/ 1.0 n) -4e-103)
t_0
(if (<= (/ 1.0 n) 1e-71)
(/ (log (/ x (+ x 1.0))) (- 0.0 n))
(if (<= (/ 1.0 n) 2e-6)
t_0
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))))))
double code(double x, double n) {
double t_0 = exp((log(x) / n)) / (x * n);
double tmp;
if ((1.0 / n) <= -4e-103) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-71) {
tmp = log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 2e-6) {
tmp = t_0;
} else {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.exp((Math.log(x) / n)) / (x * n);
double tmp;
if ((1.0 / n) <= -4e-103) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-71) {
tmp = Math.log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 2e-6) {
tmp = t_0;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = math.exp((math.log(x) / n)) / (x * n) tmp = 0 if (1.0 / n) <= -4e-103: tmp = t_0 elif (1.0 / n) <= 1e-71: tmp = math.log((x / (x + 1.0))) / (0.0 - n) elif (1.0 / n) <= 2e-6: tmp = t_0 else: tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64(exp(Float64(log(x) / n)) / Float64(x * n)) tmp = 0.0 if (Float64(1.0 / n) <= -4e-103) tmp = t_0; elseif (Float64(1.0 / n) <= 1e-71) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)); elseif (Float64(1.0 / n) <= 2e-6) tmp = t_0; else tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-103], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-71], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-6], t$95$0, N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-103}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-71}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.99999999999999983e-103 or 9.9999999999999992e-72 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999991e-6Initial program 65.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.f6465.2%
Applied egg-rr65.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6484.4%
Simplified84.4%
if -3.99999999999999983e-103 < (/.f64 #s(literal 1 binary64) n) < 9.9999999999999992e-72Initial program 27.2%
Taylor expanded in n around -inf
Simplified84.9%
Applied egg-rr69.3%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6484.9%
Simplified84.9%
if 1.99999999999999991e-6 < (/.f64 #s(literal 1 binary64) n) Initial program 36.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.f64100.0%
Applied egg-rr100.0%
Final simplification86.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (exp (/ (log x) n)) (* x n))))
(if (<= (/ 1.0 n) -4e-103)
t_0
(if (<= (/ 1.0 n) 1e-71)
(/ (log (/ x (+ x 1.0))) (- 0.0 n))
(if (<= (/ 1.0 n) 2e-6)
t_0
(-
(+ (* x (+ (/ 1.0 n) (* x (+ (/ 0.5 (* n n)) (/ -0.5 n))))) 1.0)
(pow x (/ 1.0 n))))))))
double code(double x, double n) {
double t_0 = exp((log(x) / n)) / (x * n);
double tmp;
if ((1.0 / n) <= -4e-103) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-71) {
tmp = log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 2e-6) {
tmp = t_0;
} else {
tmp = ((x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))))) + 1.0) - pow(x, (1.0 / n));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = exp((log(x) / n)) / (x * n)
if ((1.0d0 / n) <= (-4d-103)) then
tmp = t_0
else if ((1.0d0 / n) <= 1d-71) then
tmp = log((x / (x + 1.0d0))) / (0.0d0 - n)
else if ((1.0d0 / n) <= 2d-6) then
tmp = t_0
else
tmp = ((x * ((1.0d0 / n) + (x * ((0.5d0 / (n * n)) + ((-0.5d0) / n))))) + 1.0d0) - (x ** (1.0d0 / n))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.exp((Math.log(x) / n)) / (x * n);
double tmp;
if ((1.0 / n) <= -4e-103) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-71) {
tmp = Math.log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 2e-6) {
tmp = t_0;
} else {
tmp = ((x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))))) + 1.0) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = math.exp((math.log(x) / n)) / (x * n) tmp = 0 if (1.0 / n) <= -4e-103: tmp = t_0 elif (1.0 / n) <= 1e-71: tmp = math.log((x / (x + 1.0))) / (0.0 - n) elif (1.0 / n) <= 2e-6: tmp = t_0 else: tmp = ((x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))))) + 1.0) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64(exp(Float64(log(x) / n)) / Float64(x * n)) tmp = 0.0 if (Float64(1.0 / n) <= -4e-103) tmp = t_0; elseif (Float64(1.0 / n) <= 1e-71) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)); elseif (Float64(1.0 / n) <= 2e-6) tmp = t_0; 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) - (x ^ Float64(1.0 / n))); end return tmp end
function tmp_2 = code(x, n) t_0 = exp((log(x) / n)) / (x * n); tmp = 0.0; if ((1.0 / n) <= -4e-103) tmp = t_0; elseif ((1.0 / n) <= 1e-71) tmp = log((x / (x + 1.0))) / (0.0 - n); elseif ((1.0 / n) <= 2e-6) tmp = t_0; else tmp = ((x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))))) + 1.0) - (x ^ (1.0 / n)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-103], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-71], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-6], t$95$0, 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] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-103}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-71}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\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) - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.99999999999999983e-103 or 9.9999999999999992e-72 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999991e-6Initial program 65.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.f6465.2%
Applied egg-rr65.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6484.4%
Simplified84.4%
if -3.99999999999999983e-103 < (/.f64 #s(literal 1 binary64) n) < 9.9999999999999992e-72Initial program 27.2%
Taylor expanded in n around -inf
Simplified84.9%
Applied egg-rr69.3%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6484.9%
Simplified84.9%
if 1.99999999999999991e-6 < (/.f64 #s(literal 1 binary64) n) Initial program 36.4%
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-/.f6479.0%
Simplified79.0%
Final simplification84.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (/ 1.0 (pow x (/ -1.0 n))) (* x n))))
(if (<= (/ 1.0 n) -4e-103)
t_0
(if (<= (/ 1.0 n) 1e-71)
(/ (log (/ x (+ x 1.0))) (- 0.0 n))
(if (<= (/ 1.0 n) 2e-6)
t_0
(-
(+ (* x (+ (/ 1.0 n) (* x (+ (/ 0.5 (* n n)) (/ -0.5 n))))) 1.0)
(pow x (/ 1.0 n))))))))
double code(double x, double n) {
double t_0 = (1.0 / pow(x, (-1.0 / n))) / (x * n);
double tmp;
if ((1.0 / n) <= -4e-103) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-71) {
tmp = log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 2e-6) {
tmp = t_0;
} else {
tmp = ((x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))))) + 1.0) - pow(x, (1.0 / n));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 / (x ** ((-1.0d0) / n))) / (x * n)
if ((1.0d0 / n) <= (-4d-103)) then
tmp = t_0
else if ((1.0d0 / n) <= 1d-71) then
tmp = log((x / (x + 1.0d0))) / (0.0d0 - n)
else if ((1.0d0 / n) <= 2d-6) then
tmp = t_0
else
tmp = ((x * ((1.0d0 / n) + (x * ((0.5d0 / (n * n)) + ((-0.5d0) / n))))) + 1.0d0) - (x ** (1.0d0 / n))
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))) / (x * n);
double tmp;
if ((1.0 / n) <= -4e-103) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-71) {
tmp = Math.log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 2e-6) {
tmp = t_0;
} else {
tmp = ((x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))))) + 1.0) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = (1.0 / math.pow(x, (-1.0 / n))) / (x * n) tmp = 0 if (1.0 / n) <= -4e-103: tmp = t_0 elif (1.0 / n) <= 1e-71: tmp = math.log((x / (x + 1.0))) / (0.0 - n) elif (1.0 / n) <= 2e-6: tmp = t_0 else: tmp = ((x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))))) + 1.0) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64(Float64(1.0 / (x ^ Float64(-1.0 / n))) / Float64(x * n)) tmp = 0.0 if (Float64(1.0 / n) <= -4e-103) tmp = t_0; elseif (Float64(1.0 / n) <= 1e-71) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)); elseif (Float64(1.0 / n) <= 2e-6) tmp = t_0; 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) - (x ^ Float64(1.0 / n))); end return tmp end
function tmp_2 = code(x, n) t_0 = (1.0 / (x ^ (-1.0 / n))) / (x * n); tmp = 0.0; if ((1.0 / n) <= -4e-103) tmp = t_0; elseif ((1.0 / n) <= 1e-71) tmp = log((x / (x + 1.0))) / (0.0 - n); elseif ((1.0 / n) <= 2e-6) tmp = t_0; else tmp = ((x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))))) + 1.0) - (x ^ (1.0 / n)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(1.0 / N[Power[x, N[(-1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-103], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-71], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-6], t$95$0, 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] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{{x}^{\left(\frac{-1}{n}\right)}}}{x \cdot n}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-103}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-71}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\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) - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.99999999999999983e-103 or 9.9999999999999992e-72 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999991e-6Initial program 65.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
exp-negN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6484.4%
Simplified84.4%
if -3.99999999999999983e-103 < (/.f64 #s(literal 1 binary64) n) < 9.9999999999999992e-72Initial program 27.2%
Taylor expanded in n around -inf
Simplified84.9%
Applied egg-rr69.3%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6484.9%
Simplified84.9%
if 1.99999999999999991e-6 < (/.f64 #s(literal 1 binary64) n) Initial program 36.4%
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-/.f6479.0%
Simplified79.0%
Final simplification83.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (/ 1.0 (pow x (/ -1.0 n))) (* x n))))
(if (<= (/ 1.0 n) -4e-103)
t_0
(if (<= (/ 1.0 n) 1e-71)
(/ (log (/ x (+ x 1.0))) (- 0.0 n))
(if (<= (/ 1.0 n) 2e-6)
t_0
(if (<= (/ 1.0 n) 5e+119)
(- (+ (/ x n) 1.0) (pow x (/ 1.0 n)))
(* x (+ (/ 1.0 n) (* x (+ (/ 0.5 (* n n)) (/ -0.5 n)))))))))))
double code(double x, double n) {
double t_0 = (1.0 / pow(x, (-1.0 / n))) / (x * n);
double tmp;
if ((1.0 / n) <= -4e-103) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-71) {
tmp = log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 2e-6) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+119) {
tmp = ((x / n) + 1.0) - pow(x, (1.0 / n));
} else {
tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / 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 = (1.0d0 / (x ** ((-1.0d0) / n))) / (x * n)
if ((1.0d0 / n) <= (-4d-103)) then
tmp = t_0
else if ((1.0d0 / n) <= 1d-71) then
tmp = log((x / (x + 1.0d0))) / (0.0d0 - n)
else if ((1.0d0 / n) <= 2d-6) then
tmp = t_0
else if ((1.0d0 / n) <= 5d+119) then
tmp = ((x / n) + 1.0d0) - (x ** (1.0d0 / n))
else
tmp = x * ((1.0d0 / n) + (x * ((0.5d0 / (n * n)) + ((-0.5d0) / n))))
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))) / (x * n);
double tmp;
if ((1.0 / n) <= -4e-103) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-71) {
tmp = Math.log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 2e-6) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+119) {
tmp = ((x / n) + 1.0) - Math.pow(x, (1.0 / n));
} else {
tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))));
}
return tmp;
}
def code(x, n): t_0 = (1.0 / math.pow(x, (-1.0 / n))) / (x * n) tmp = 0 if (1.0 / n) <= -4e-103: tmp = t_0 elif (1.0 / n) <= 1e-71: tmp = math.log((x / (x + 1.0))) / (0.0 - n) elif (1.0 / n) <= 2e-6: tmp = t_0 elif (1.0 / n) <= 5e+119: tmp = ((x / n) + 1.0) - math.pow(x, (1.0 / n)) else: tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n)))) return tmp
function code(x, n) t_0 = Float64(Float64(1.0 / (x ^ Float64(-1.0 / n))) / Float64(x * n)) tmp = 0.0 if (Float64(1.0 / n) <= -4e-103) tmp = t_0; elseif (Float64(1.0 / n) <= 1e-71) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)); elseif (Float64(1.0 / n) <= 2e-6) tmp = t_0; elseif (Float64(1.0 / n) <= 5e+119) tmp = Float64(Float64(Float64(x / n) + 1.0) - (x ^ Float64(1.0 / n))); else tmp = Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 / Float64(n * n)) + Float64(-0.5 / n))))); end return tmp end
function tmp_2 = code(x, n) t_0 = (1.0 / (x ^ (-1.0 / n))) / (x * n); tmp = 0.0; if ((1.0 / n) <= -4e-103) tmp = t_0; elseif ((1.0 / n) <= 1e-71) tmp = log((x / (x + 1.0))) / (0.0 - n); elseif ((1.0 / n) <= 2e-6) tmp = t_0; elseif ((1.0 / n) <= 5e+119) tmp = ((x / n) + 1.0) - (x ^ (1.0 / n)); else tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n)))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(1.0 / N[Power[x, N[(-1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-103], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-71], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-6], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+119], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{{x}^{\left(\frac{-1}{n}\right)}}}{x \cdot n}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-103}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-71}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+119}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{1}{n} + x \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.99999999999999983e-103 or 9.9999999999999992e-72 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999991e-6Initial program 65.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
exp-negN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6484.4%
Simplified84.4%
if -3.99999999999999983e-103 < (/.f64 #s(literal 1 binary64) n) < 9.9999999999999992e-72Initial program 27.2%
Taylor expanded in n around -inf
Simplified84.9%
Applied egg-rr69.3%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6484.9%
Simplified84.9%
if 1.99999999999999991e-6 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999999e119Initial program 80.6%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6471.0%
Simplified71.0%
if 4.9999999999999999e119 < (/.f64 #s(literal 1 binary64) n) Initial program 16.3%
Taylor expanded in n around inf
Simplified6.2%
Taylor expanded in x around 0
*-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-/.f6482.6%
Simplified82.6%
Final simplification83.9%
(FPCore (x n)
:precision binary64
(if (<= x 1.6e-162)
(- 0.0 (/ (log x) n))
(if (<= x 7.5e-39)
(*
(* x x)
(+ (/ 1.0 (* x n)) (+ (/ -0.5 n) (/ (log (/ 1.0 x)) (* n (* x x))))))
(/ (/ 1.0 (pow x (/ -1.0 n))) (* x n)))))
double code(double x, double n) {
double tmp;
if (x <= 1.6e-162) {
tmp = 0.0 - (log(x) / n);
} else if (x <= 7.5e-39) {
tmp = (x * x) * ((1.0 / (x * n)) + ((-0.5 / n) + (log((1.0 / x)) / (n * (x * x)))));
} else {
tmp = (1.0 / pow(x, (-1.0 / n))) / (x * n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.6d-162) then
tmp = 0.0d0 - (log(x) / n)
else if (x <= 7.5d-39) then
tmp = (x * x) * ((1.0d0 / (x * n)) + (((-0.5d0) / n) + (log((1.0d0 / x)) / (n * (x * x)))))
else
tmp = (1.0d0 / (x ** ((-1.0d0) / n))) / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.6e-162) {
tmp = 0.0 - (Math.log(x) / n);
} else if (x <= 7.5e-39) {
tmp = (x * x) * ((1.0 / (x * n)) + ((-0.5 / n) + (Math.log((1.0 / x)) / (n * (x * x)))));
} else {
tmp = (1.0 / Math.pow(x, (-1.0 / n))) / (x * n);
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.6e-162: tmp = 0.0 - (math.log(x) / n) elif x <= 7.5e-39: tmp = (x * x) * ((1.0 / (x * n)) + ((-0.5 / n) + (math.log((1.0 / x)) / (n * (x * x))))) else: tmp = (1.0 / math.pow(x, (-1.0 / n))) / (x * n) return tmp
function code(x, n) tmp = 0.0 if (x <= 1.6e-162) tmp = Float64(0.0 - Float64(log(x) / n)); elseif (x <= 7.5e-39) tmp = Float64(Float64(x * x) * Float64(Float64(1.0 / Float64(x * n)) + Float64(Float64(-0.5 / n) + Float64(log(Float64(1.0 / x)) / Float64(n * Float64(x * x)))))); else tmp = Float64(Float64(1.0 / (x ^ Float64(-1.0 / n))) / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.6e-162) tmp = 0.0 - (log(x) / n); elseif (x <= 7.5e-39) tmp = (x * x) * ((1.0 / (x * n)) + ((-0.5 / n) + (log((1.0 / x)) / (n * (x * x))))); else tmp = (1.0 / (x ^ (-1.0 / n))) / (x * n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.6e-162], N[(0.0 - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e-39], N[(N[(x * x), $MachinePrecision] * N[(N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 / n), $MachinePrecision] + N[(N[Log[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] / N[(n * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Power[x, N[(-1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.6 \cdot 10^{-162}:\\
\;\;\;\;0 - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-39}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(\frac{1}{x \cdot n} + \left(\frac{-0.5}{n} + \frac{\log \left(\frac{1}{x}\right)}{n \cdot \left(x \cdot x\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{{x}^{\left(\frac{-1}{n}\right)}}}{x \cdot n}\\
\end{array}
\end{array}
if x < 1.59999999999999988e-162Initial program 34.8%
Taylor expanded in x around 0
Simplified34.8%
Taylor expanded in n around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6463.4%
Simplified63.4%
if 1.59999999999999988e-162 < x < 7.49999999999999971e-39Initial program 21.1%
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.1%
Simplified35.1%
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.f6462.8%
Simplified62.8%
Taylor expanded in x around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
Simplified86.2%
if 7.49999999999999971e-39 < x Initial program 60.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
exp-negN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6490.0%
Simplified90.0%
Final simplification81.2%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) 1.8e-9)
(/ (log (/ x (+ x 1.0))) (- 0.0 n))
(if (<= (/ 1.0 n) 5e+119)
(- (+ (/ x n) 1.0) (pow x (/ 1.0 n)))
(* x (+ (/ 1.0 n) (* x (+ (/ 0.5 (* n n)) (/ -0.5 n))))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 1.8e-9) {
tmp = log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 5e+119) {
tmp = ((x / n) + 1.0) - pow(x, (1.0 / n));
} else {
tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / 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.8d-9) then
tmp = log((x / (x + 1.0d0))) / (0.0d0 - n)
else if ((1.0d0 / n) <= 5d+119) then
tmp = ((x / n) + 1.0d0) - (x ** (1.0d0 / n))
else
tmp = x * ((1.0d0 / n) + (x * ((0.5d0 / (n * n)) + ((-0.5d0) / n))))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 1.8e-9) {
tmp = Math.log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 5e+119) {
tmp = ((x / n) + 1.0) - Math.pow(x, (1.0 / n));
} else {
tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= 1.8e-9: tmp = math.log((x / (x + 1.0))) / (0.0 - n) elif (1.0 / n) <= 5e+119: tmp = ((x / n) + 1.0) - math.pow(x, (1.0 / n)) else: tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n)))) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= 1.8e-9) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)); elseif (Float64(1.0 / n) <= 5e+119) tmp = Float64(Float64(Float64(x / n) + 1.0) - (x ^ Float64(1.0 / n))); else tmp = Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 / Float64(n * n)) + Float64(-0.5 / n))))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= 1.8e-9) tmp = log((x / (x + 1.0))) / (0.0 - n); elseif ((1.0 / n) <= 5e+119) tmp = ((x / n) + 1.0) - (x ^ (1.0 / n)); else tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n)))); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.8e-9], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+119], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq 1.8 \cdot 10^{-9}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+119}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{1}{n} + x \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < 1.8e-9Initial program 46.6%
Taylor expanded in n around -inf
Simplified76.2%
Applied egg-rr60.5%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6468.5%
Simplified68.5%
if 1.8e-9 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999999e119Initial program 68.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-/.f6461.0%
Simplified61.0%
if 4.9999999999999999e119 < (/.f64 #s(literal 1 binary64) n) Initial program 16.3%
Taylor expanded in n around inf
Simplified6.2%
Taylor expanded in x around 0
*-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-/.f6482.6%
Simplified82.6%
Final simplification69.3%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) 2e-9)
(/ (log (/ x (+ x 1.0))) (- 0.0 n))
(if (<= (/ 1.0 n) 5e+119)
(- 1.0 (pow x (/ 1.0 n)))
(* x (+ (/ 1.0 n) (* x (+ (/ 0.5 (* n n)) (/ -0.5 n))))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2e-9) {
tmp = log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 5e+119) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / 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) <= 2d-9) then
tmp = log((x / (x + 1.0d0))) / (0.0d0 - n)
else if ((1.0d0 / n) <= 5d+119) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = x * ((1.0d0 / n) + (x * ((0.5d0 / (n * n)) + ((-0.5d0) / n))))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2e-9) {
tmp = Math.log((x / (x + 1.0))) / (0.0 - n);
} else if ((1.0 / n) <= 5e+119) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= 2e-9: tmp = math.log((x / (x + 1.0))) / (0.0 - n) elif (1.0 / n) <= 5e+119: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n)))) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= 2e-9) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)); elseif (Float64(1.0 / n) <= 5e+119) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 / Float64(n * n)) + Float64(-0.5 / n))))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= 2e-9) tmp = log((x / (x + 1.0))) / (0.0 - n); elseif ((1.0 / n) <= 5e+119) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n)))); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-9], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+119], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq 2 \cdot 10^{-9}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+119}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{1}{n} + x \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < 2.00000000000000012e-9Initial program 46.5%
Taylor expanded in n around -inf
Simplified75.9%
Applied egg-rr60.2%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6468.2%
Simplified68.2%
if 2.00000000000000012e-9 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999999e119Initial program 73.5%
Taylor expanded in x around 0
Simplified65.2%
if 4.9999999999999999e119 < (/.f64 #s(literal 1 binary64) n) Initial program 16.3%
Taylor expanded in n around inf
Simplified6.2%
Taylor expanded in x around 0
*-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-/.f6482.6%
Simplified82.6%
Final simplification69.3%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) 2e-9)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e+119)
(- 1.0 (pow x (/ 1.0 n)))
(* x (+ (/ 1.0 n) (* x (+ (/ 0.5 (* n n)) (/ -0.5 n))))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2e-9) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+119) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / 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) <= 2d-9) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d+119) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = x * ((1.0d0 / n) + (x * ((0.5d0 / (n * n)) + ((-0.5d0) / n))))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2e-9) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+119) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n))));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= 2e-9: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e+119: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n)))) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= 2e-9) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e+119) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 / Float64(n * n)) + Float64(-0.5 / n))))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= 2e-9) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e+119) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = x * ((1.0 / n) + (x * ((0.5 / (n * n)) + (-0.5 / n)))); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-9], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+119], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq 2 \cdot 10^{-9}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+119}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{1}{n} + x \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < 2.00000000000000012e-9Initial program 46.5%
Taylor expanded in n around -inf
Simplified75.9%
Applied egg-rr60.2%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6468.2%
Simplified68.2%
clear-numN/A
log-recN/A
diff-logN/A
frac-2negN/A
/-lowering-/.f64N/A
diff-logN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6468.2%
Applied egg-rr68.2%
if 2.00000000000000012e-9 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999999e119Initial program 73.5%
Taylor expanded in x around 0
Simplified65.2%
if 4.9999999999999999e119 < (/.f64 #s(literal 1 binary64) n) Initial program 16.3%
Taylor expanded in n around inf
Simplified6.2%
Taylor expanded in x around 0
*-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-/.f6482.6%
Simplified82.6%
(FPCore (x n)
:precision binary64
(if (<= x 0.85)
(/ (- x (log x)) n)
(if (<= x 2.4e+219)
(*
0.3333333333333333
(/ (+ (/ 3.0 n) (/ (+ (/ 1.0 (* x n)) (/ -1.5 n)) x)) x))
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.85) {
tmp = (x - log(x)) / n;
} else if (x <= 2.4e+219) {
tmp = 0.3333333333333333 * (((3.0 / n) + (((1.0 / (x * n)) + (-1.5 / n)) / x)) / x);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.85d0) then
tmp = (x - log(x)) / n
else if (x <= 2.4d+219) then
tmp = 0.3333333333333333d0 * (((3.0d0 / n) + (((1.0d0 / (x * n)) + ((-1.5d0) / n)) / x)) / x)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.85) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 2.4e+219) {
tmp = 0.3333333333333333 * (((3.0 / n) + (((1.0 / (x * n)) + (-1.5 / n)) / x)) / x);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.85: tmp = (x - math.log(x)) / n elif x <= 2.4e+219: tmp = 0.3333333333333333 * (((3.0 / n) + (((1.0 / (x * n)) + (-1.5 / n)) / x)) / x) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.85) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 2.4e+219) tmp = Float64(0.3333333333333333 * Float64(Float64(Float64(3.0 / n) + Float64(Float64(Float64(1.0 / Float64(x * n)) + Float64(-1.5 / n)) / x)) / x)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.85) tmp = (x - log(x)) / n; elseif (x <= 2.4e+219) tmp = 0.3333333333333333 * (((3.0 / n) + (((1.0 / (x * n)) + (-1.5 / n)) / x)) / x); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.85], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 2.4e+219], N[(0.3333333333333333 * N[(N[(N[(3.0 / n), $MachinePrecision] + N[(N[(N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(-1.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.85:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+219}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\frac{3}{n} + \frac{\frac{1}{x \cdot n} + \frac{-1.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.849999999999999978Initial program 33.3%
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.7%
Simplified35.7%
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.f6459.0%
Simplified59.0%
Taylor expanded in x around 0
--lowering--.f64N/A
log-lowering-log.f6458.9%
Simplified58.9%
if 0.849999999999999978 < x < 2.4e219Initial program 51.3%
sub-negN/A
flip3-+N/A
div-invN/A
cube-negN/A
sub-negN/A
*-lowering-*.f64N/A
Applied egg-rr19.5%
Taylor expanded in n around inf
*-lowering-*.f64N/A
/-lowering-/.f64N/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
log1p-defineN/A
log1p-lowering-log1p.f64N/A
log-lowering-log.f6452.1%
Simplified52.1%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified67.0%
if 2.4e219 < x Initial program 96.1%
Taylor expanded in x around 0
Simplified55.8%
Taylor expanded in n around inf
Simplified96.1%
metadata-eval96.1%
Applied egg-rr96.1%
(FPCore (x n)
:precision binary64
(if (<= x 0.6)
(- 0.0 (/ (log x) n))
(if (<= x 8e+218)
(*
0.3333333333333333
(/ (+ (/ 3.0 n) (/ (+ (/ 1.0 (* x n)) (/ -1.5 n)) x)) x))
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.6) {
tmp = 0.0 - (log(x) / n);
} else if (x <= 8e+218) {
tmp = 0.3333333333333333 * (((3.0 / n) + (((1.0 / (x * n)) + (-1.5 / n)) / x)) / x);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.6d0) then
tmp = 0.0d0 - (log(x) / n)
else if (x <= 8d+218) then
tmp = 0.3333333333333333d0 * (((3.0d0 / n) + (((1.0d0 / (x * n)) + ((-1.5d0) / n)) / x)) / x)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.6) {
tmp = 0.0 - (Math.log(x) / n);
} else if (x <= 8e+218) {
tmp = 0.3333333333333333 * (((3.0 / n) + (((1.0 / (x * n)) + (-1.5 / n)) / x)) / x);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.6: tmp = 0.0 - (math.log(x) / n) elif x <= 8e+218: tmp = 0.3333333333333333 * (((3.0 / n) + (((1.0 / (x * n)) + (-1.5 / n)) / x)) / x) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.6) tmp = Float64(0.0 - Float64(log(x) / n)); elseif (x <= 8e+218) tmp = Float64(0.3333333333333333 * Float64(Float64(Float64(3.0 / n) + Float64(Float64(Float64(1.0 / Float64(x * n)) + Float64(-1.5 / n)) / x)) / x)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.6) tmp = 0.0 - (log(x) / n); elseif (x <= 8e+218) tmp = 0.3333333333333333 * (((3.0 / n) + (((1.0 / (x * n)) + (-1.5 / n)) / x)) / x); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.6], N[(0.0 - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8e+218], N[(0.3333333333333333 * N[(N[(N[(3.0 / n), $MachinePrecision] + N[(N[(N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(-1.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.6:\\
\;\;\;\;0 - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+218}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\frac{3}{n} + \frac{\frac{1}{x \cdot n} + \frac{-1.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.599999999999999978Initial program 33.3%
Taylor expanded in x around 0
Simplified31.9%
Taylor expanded in n around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6458.8%
Simplified58.8%
if 0.599999999999999978 < x < 8.00000000000000066e218Initial program 51.3%
sub-negN/A
flip3-+N/A
div-invN/A
cube-negN/A
sub-negN/A
*-lowering-*.f64N/A
Applied egg-rr19.5%
Taylor expanded in n around inf
*-lowering-*.f64N/A
/-lowering-/.f64N/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
log1p-defineN/A
log1p-lowering-log1p.f64N/A
log-lowering-log.f6452.1%
Simplified52.1%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified67.0%
if 8.00000000000000066e218 < x Initial program 96.1%
Taylor expanded in x around 0
Simplified55.8%
Taylor expanded in n around inf
Simplified96.1%
metadata-eval96.1%
Applied egg-rr96.1%
Final simplification65.0%
(FPCore (x n)
:precision binary64
(if (<= n -1.05e-6)
(/ (+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ (/ 0.3333333333333333 n) x)) x)) x)
(if (<= n -1.36e-301)
0.0
(*
0.3333333333333333
(/ (+ (/ 3.0 n) (/ (+ (/ 1.0 (* x n)) (/ -1.5 n)) x)) x)))))
double code(double x, double n) {
double tmp;
if (n <= -1.05e-6) {
tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / n) / x)) / x)) / x;
} else if (n <= -1.36e-301) {
tmp = 0.0;
} else {
tmp = 0.3333333333333333 * (((3.0 / n) + (((1.0 / (x * n)) + (-1.5 / n)) / x)) / x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.05d-6)) then
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + ((0.3333333333333333d0 / n) / x)) / x)) / x
else if (n <= (-1.36d-301)) then
tmp = 0.0d0
else
tmp = 0.3333333333333333d0 * (((3.0d0 / n) + (((1.0d0 / (x * n)) + ((-1.5d0) / n)) / x)) / x)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -1.05e-6) {
tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / n) / x)) / x)) / x;
} else if (n <= -1.36e-301) {
tmp = 0.0;
} else {
tmp = 0.3333333333333333 * (((3.0 / n) + (((1.0 / (x * n)) + (-1.5 / n)) / x)) / x);
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -1.05e-6: tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / n) / x)) / x)) / x elif n <= -1.36e-301: tmp = 0.0 else: tmp = 0.3333333333333333 * (((3.0 / n) + (((1.0 / (x * n)) + (-1.5 / n)) / x)) / x) return tmp
function code(x, n) tmp = 0.0 if (n <= -1.05e-6) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(Float64(0.3333333333333333 / n) / x)) / x)) / x); elseif (n <= -1.36e-301) tmp = 0.0; else tmp = Float64(0.3333333333333333 * Float64(Float64(Float64(3.0 / n) + Float64(Float64(Float64(1.0 / Float64(x * n)) + Float64(-1.5 / n)) / x)) / x)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -1.05e-6) tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / n) / x)) / x)) / x; elseif (n <= -1.36e-301) tmp = 0.0; else tmp = 0.3333333333333333 * (((3.0 / n) + (((1.0 / (x * n)) + (-1.5 / n)) / x)) / x); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -1.05e-6], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(N[(0.3333333333333333 / n), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[n, -1.36e-301], 0.0, N[(0.3333333333333333 * N[(N[(N[(3.0 / n), $MachinePrecision] + N[(N[(N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(-1.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.05 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{\frac{0.3333333333333333}{n}}{x}}{x}}{x}\\
\mathbf{elif}\;n \leq -1.36 \cdot 10^{-301}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\frac{3}{n} + \frac{\frac{1}{x \cdot n} + \frac{-1.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if n < -1.0499999999999999e-6Initial program 30.2%
Taylor expanded in n around -inf
Simplified76.9%
Applied egg-rr61.4%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6476.3%
Simplified76.3%
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
Simplified46.9%
if -1.0499999999999999e-6 < n < -1.36e-301Initial program 100.0%
Taylor expanded in x around 0
Simplified44.6%
Taylor expanded in n around inf
Simplified57.8%
metadata-eval57.8%
Applied egg-rr57.8%
if -1.36e-301 < n Initial program 24.9%
sub-negN/A
flip3-+N/A
div-invN/A
cube-negN/A
sub-negN/A
*-lowering-*.f64N/A
Applied egg-rr21.1%
Taylor expanded in n around inf
*-lowering-*.f64N/A
/-lowering-/.f64N/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
log1p-defineN/A
log1p-lowering-log1p.f64N/A
log-lowering-log.f6448.5%
Simplified48.5%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified47.9%
Final simplification50.0%
(FPCore (x n)
:precision binary64
(let* ((t_0
(/
(+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ (/ 0.3333333333333333 n) x)) x))
x)))
(if (<= n -1.05e-6) t_0 (if (<= n -1.36e-301) 0.0 t_0))))
double code(double x, double n) {
double t_0 = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / n) / x)) / x)) / x;
double tmp;
if (n <= -1.05e-6) {
tmp = t_0;
} else if (n <= -1.36e-301) {
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) + ((((-0.5d0) / n) + ((0.3333333333333333d0 / n) / x)) / x)) / x
if (n <= (-1.05d-6)) then
tmp = t_0
else if (n <= (-1.36d-301)) 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) + (((-0.5 / n) + ((0.3333333333333333 / n) / x)) / x)) / x;
double tmp;
if (n <= -1.05e-6) {
tmp = t_0;
} else if (n <= -1.36e-301) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / n) / x)) / x)) / x tmp = 0 if n <= -1.05e-6: tmp = t_0 elif n <= -1.36e-301: tmp = 0.0 else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(Float64(0.3333333333333333 / n) / x)) / x)) / x) tmp = 0.0 if (n <= -1.05e-6) tmp = t_0; elseif (n <= -1.36e-301) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / n) / x)) / x)) / x; tmp = 0.0; if (n <= -1.05e-6) tmp = t_0; elseif (n <= -1.36e-301) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(N[(0.3333333333333333 / n), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[n, -1.05e-6], t$95$0, If[LessEqual[n, -1.36e-301], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{\frac{0.3333333333333333}{n}}{x}}{x}}{x}\\
\mathbf{if}\;n \leq -1.05 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.36 \cdot 10^{-301}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.0499999999999999e-6 or -1.36e-301 < n Initial program 27.2%
Taylor expanded in n around -inf
Simplified71.2%
Applied egg-rr60.5%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6460.9%
Simplified60.9%
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.5%
if -1.0499999999999999e-6 < n < -1.36e-301Initial program 100.0%
Taylor expanded in x around 0
Simplified44.6%
Taylor expanded in n around inf
Simplified57.8%
metadata-eval57.8%
Applied egg-rr57.8%
Final simplification50.0%
(FPCore (x n) :precision binary64 (let* ((t_0 (/ (/ (+ 1.0 (/ (- (/ 0.3333333333333333 x) 0.5) x)) x) n))) (if (<= n -1.15e-6) t_0 (if (<= n -1.22e-301) 0.0 t_0))))
double code(double x, double n) {
double t_0 = ((1.0 + (((0.3333333333333333 / x) - 0.5) / x)) / x) / n;
double tmp;
if (n <= -1.15e-6) {
tmp = t_0;
} else if (n <= -1.22e-301) {
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 + (((0.3333333333333333d0 / x) - 0.5d0) / x)) / x) / n
if (n <= (-1.15d-6)) then
tmp = t_0
else if (n <= (-1.22d-301)) 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 + (((0.3333333333333333 / x) - 0.5) / x)) / x) / n;
double tmp;
if (n <= -1.15e-6) {
tmp = t_0;
} else if (n <= -1.22e-301) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = ((1.0 + (((0.3333333333333333 / x) - 0.5) / x)) / x) / n tmp = 0 if n <= -1.15e-6: tmp = t_0 elif n <= -1.22e-301: tmp = 0.0 else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 / x) - 0.5) / x)) / x) / n) tmp = 0.0 if (n <= -1.15e-6) tmp = t_0; elseif (n <= -1.22e-301) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = ((1.0 + (((0.3333333333333333 / x) - 0.5) / x)) / x) / n; tmp = 0.0; if (n <= -1.15e-6) tmp = t_0; elseif (n <= -1.22e-301) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[n, -1.15e-6], t$95$0, If[LessEqual[n, -1.22e-301], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1 + \frac{\frac{0.3333333333333333}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{if}\;n \leq -1.15 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.22 \cdot 10^{-301}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.15e-6 or -1.2199999999999999e-301 < n Initial program 27.2%
Taylor expanded in n around -inf
Simplified71.2%
Applied egg-rr60.5%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6460.9%
Simplified60.9%
Taylor expanded in x around inf
+-commutativeN/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
unpow2N/A
associate-/r*N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
sub-negN/A
+-commutativeN/A
neg-mul-1N/A
metadata-evalN/A
distribute-lft-inN/A
metadata-evalN/A
sub-negN/A
associate-*r/N/A
Simplified47.4%
if -1.15e-6 < n < -1.2199999999999999e-301Initial program 100.0%
Taylor expanded in x around 0
Simplified44.6%
Taylor expanded in n around inf
Simplified57.8%
metadata-eval57.8%
Applied egg-rr57.8%
Final simplification50.0%
(FPCore (x n) :precision binary64 (if (<= n -1.15e-6) (* 0.3333333333333333 (/ (/ 3.0 x) n)) (if (<= n -1.3e-301) 0.0 (/ 1.0 (* x n)))))
double code(double x, double n) {
double tmp;
if (n <= -1.15e-6) {
tmp = 0.3333333333333333 * ((3.0 / x) / n);
} else if (n <= -1.3e-301) {
tmp = 0.0;
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.15d-6)) then
tmp = 0.3333333333333333d0 * ((3.0d0 / x) / n)
else if (n <= (-1.3d-301)) then
tmp = 0.0d0
else
tmp = 1.0d0 / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -1.15e-6) {
tmp = 0.3333333333333333 * ((3.0 / x) / n);
} else if (n <= -1.3e-301) {
tmp = 0.0;
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -1.15e-6: tmp = 0.3333333333333333 * ((3.0 / x) / n) elif n <= -1.3e-301: tmp = 0.0 else: tmp = 1.0 / (x * n) return tmp
function code(x, n) tmp = 0.0 if (n <= -1.15e-6) tmp = Float64(0.3333333333333333 * Float64(Float64(3.0 / x) / n)); elseif (n <= -1.3e-301) tmp = 0.0; else tmp = Float64(1.0 / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -1.15e-6) tmp = 0.3333333333333333 * ((3.0 / x) / n); elseif (n <= -1.3e-301) tmp = 0.0; else tmp = 1.0 / (x * n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -1.15e-6], N[(0.3333333333333333 * N[(N[(3.0 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.3e-301], 0.0, N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.15 \cdot 10^{-6}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\frac{3}{x}}{n}\\
\mathbf{elif}\;n \leq -1.3 \cdot 10^{-301}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\end{array}
\end{array}
if n < -1.15e-6Initial program 30.2%
sub-negN/A
flip3-+N/A
div-invN/A
cube-negN/A
sub-negN/A
*-lowering-*.f64N/A
Applied egg-rr29.0%
Taylor expanded in n around inf
*-lowering-*.f64N/A
/-lowering-/.f64N/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
log1p-defineN/A
log1p-lowering-log1p.f64N/A
log-lowering-log.f6475.7%
Simplified75.7%
Taylor expanded in x around inf
/-lowering-/.f6446.5%
Simplified46.5%
if -1.15e-6 < n < -1.2999999999999999e-301Initial program 100.0%
Taylor expanded in x around 0
Simplified44.6%
Taylor expanded in n around inf
Simplified57.8%
metadata-eval57.8%
Applied egg-rr57.8%
if -1.2999999999999999e-301 < n Initial program 24.9%
Taylor expanded in n around -inf
Simplified66.7%
Applied egg-rr59.8%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6448.6%
Simplified48.6%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6445.8%
Simplified45.8%
(FPCore (x n) :precision binary64 (if (<= n -1.15e-6) (/ (/ 1.0 x) n) (if (<= n -1.36e-301) 0.0 (/ 1.0 (* x n)))))
double code(double x, double n) {
double tmp;
if (n <= -1.15e-6) {
tmp = (1.0 / x) / n;
} else if (n <= -1.36e-301) {
tmp = 0.0;
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.15d-6)) then
tmp = (1.0d0 / x) / n
else if (n <= (-1.36d-301)) then
tmp = 0.0d0
else
tmp = 1.0d0 / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -1.15e-6) {
tmp = (1.0 / x) / n;
} else if (n <= -1.36e-301) {
tmp = 0.0;
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -1.15e-6: tmp = (1.0 / x) / n elif n <= -1.36e-301: tmp = 0.0 else: tmp = 1.0 / (x * n) return tmp
function code(x, n) tmp = 0.0 if (n <= -1.15e-6) tmp = Float64(Float64(1.0 / x) / n); elseif (n <= -1.36e-301) tmp = 0.0; else tmp = Float64(1.0 / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -1.15e-6) tmp = (1.0 / x) / n; elseif (n <= -1.36e-301) tmp = 0.0; else tmp = 1.0 / (x * n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -1.15e-6], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -1.36e-301], 0.0, N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.15 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;n \leq -1.36 \cdot 10^{-301}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\end{array}
\end{array}
if n < -1.15e-6Initial program 30.2%
Taylor expanded in n around -inf
Simplified76.9%
Applied egg-rr61.4%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6476.3%
Simplified76.3%
Taylor expanded in x around inf
/-lowering-/.f6446.5%
Simplified46.5%
if -1.15e-6 < n < -1.36e-301Initial program 100.0%
Taylor expanded in x around 0
Simplified44.6%
Taylor expanded in n around inf
Simplified57.8%
metadata-eval57.8%
Applied egg-rr57.8%
if -1.36e-301 < n Initial program 24.9%
Taylor expanded in n around -inf
Simplified66.7%
Applied egg-rr59.8%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6448.6%
Simplified48.6%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6445.8%
Simplified45.8%
Final simplification49.0%
(FPCore (x n) :precision binary64 (let* ((t_0 (/ 1.0 (* x n)))) (if (<= n -1.15e-6) t_0 (if (<= n -1.36e-301) 0.0 t_0))))
double code(double x, double n) {
double t_0 = 1.0 / (x * n);
double tmp;
if (n <= -1.15e-6) {
tmp = t_0;
} else if (n <= -1.36e-301) {
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 (n <= (-1.15d-6)) then
tmp = t_0
else if (n <= (-1.36d-301)) 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 (n <= -1.15e-6) {
tmp = t_0;
} else if (n <= -1.36e-301) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = 1.0 / (x * n) tmp = 0 if n <= -1.15e-6: tmp = t_0 elif n <= -1.36e-301: 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 (n <= -1.15e-6) tmp = t_0; elseif (n <= -1.36e-301) 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 (n <= -1.15e-6) tmp = t_0; elseif (n <= -1.36e-301) 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.15e-6], t$95$0, If[LessEqual[n, -1.36e-301], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{x \cdot n}\\
\mathbf{if}\;n \leq -1.15 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.36 \cdot 10^{-301}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.15e-6 or -1.36e-301 < n Initial program 27.2%
Taylor expanded in n around -inf
Simplified71.2%
Applied egg-rr60.5%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6460.9%
Simplified60.9%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6446.1%
Simplified46.1%
if -1.15e-6 < n < -1.36e-301Initial program 100.0%
Taylor expanded in x around 0
Simplified44.6%
Taylor expanded in n around inf
Simplified57.8%
metadata-eval57.8%
Applied egg-rr57.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 45.1%
Taylor expanded in x around 0
Simplified30.3%
Taylor expanded in n around inf
Simplified28.2%
metadata-eval28.2%
Applied egg-rr28.2%
herbie shell --seed 2024155
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))