
(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 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow (log x) 2.0))
(t_1 (pow x (/ 1.0 n)))
(t_2 (pow (log x) 3.0)))
(if (<= x 1.08e-244)
(/
(- (/ (+ (* -0.16666666666666666 (/ t_2 n)) (* -0.5 t_0)) n) (log x))
n)
(if (<= x 6.8e-223)
(- (exp (/ (log1p x) n)) t_1)
(if (<= x 26500000.0)
(/
(-
(+
(log1p x)
(/
(+
(* 0.5 (- (pow (log1p x) 2.0) t_0))
(* 0.16666666666666666 (/ (- (pow (log1p x) 3.0) t_2) n)))
n))
(log x))
n)
(/ (/ t_1 n) x))))))
double code(double x, double n) {
double t_0 = pow(log(x), 2.0);
double t_1 = pow(x, (1.0 / n));
double t_2 = pow(log(x), 3.0);
double tmp;
if (x <= 1.08e-244) {
tmp = ((((-0.16666666666666666 * (t_2 / n)) + (-0.5 * t_0)) / n) - log(x)) / n;
} else if (x <= 6.8e-223) {
tmp = exp((log1p(x) / n)) - t_1;
} else if (x <= 26500000.0) {
tmp = ((log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - t_0)) + (0.16666666666666666 * ((pow(log1p(x), 3.0) - t_2) / n))) / n)) - log(x)) / n;
} else {
tmp = (t_1 / n) / x;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(Math.log(x), 2.0);
double t_1 = Math.pow(x, (1.0 / n));
double t_2 = Math.pow(Math.log(x), 3.0);
double tmp;
if (x <= 1.08e-244) {
tmp = ((((-0.16666666666666666 * (t_2 / n)) + (-0.5 * t_0)) / n) - Math.log(x)) / n;
} else if (x <= 6.8e-223) {
tmp = Math.exp((Math.log1p(x) / n)) - t_1;
} else if (x <= 26500000.0) {
tmp = ((Math.log1p(x) + (((0.5 * (Math.pow(Math.log1p(x), 2.0) - t_0)) + (0.16666666666666666 * ((Math.pow(Math.log1p(x), 3.0) - t_2) / n))) / n)) - Math.log(x)) / n;
} else {
tmp = (t_1 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(math.log(x), 2.0) t_1 = math.pow(x, (1.0 / n)) t_2 = math.pow(math.log(x), 3.0) tmp = 0 if x <= 1.08e-244: tmp = ((((-0.16666666666666666 * (t_2 / n)) + (-0.5 * t_0)) / n) - math.log(x)) / n elif x <= 6.8e-223: tmp = math.exp((math.log1p(x) / n)) - t_1 elif x <= 26500000.0: tmp = ((math.log1p(x) + (((0.5 * (math.pow(math.log1p(x), 2.0) - t_0)) + (0.16666666666666666 * ((math.pow(math.log1p(x), 3.0) - t_2) / n))) / n)) - math.log(x)) / n else: tmp = (t_1 / n) / x return tmp
function code(x, n) t_0 = log(x) ^ 2.0 t_1 = x ^ Float64(1.0 / n) t_2 = log(x) ^ 3.0 tmp = 0.0 if (x <= 1.08e-244) tmp = Float64(Float64(Float64(Float64(Float64(-0.16666666666666666 * Float64(t_2 / n)) + Float64(-0.5 * t_0)) / n) - log(x)) / n); elseif (x <= 6.8e-223) tmp = Float64(exp(Float64(log1p(x) / n)) - t_1); elseif (x <= 26500000.0) tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - t_0)) + Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - t_2) / n))) / n)) - log(x)) / n); else tmp = Float64(Float64(t_1 / n) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]}, If[LessEqual[x, 1.08e-244], N[(N[(N[(N[(N[(-0.16666666666666666 * N[(t$95$2 / n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * t$95$0), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 6.8e-223], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[x, 26500000.0], N[(N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - t$95$2), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(t$95$1 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\log x}^{2}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := {\log x}^{3}\\
\mathbf{if}\;x \leq 1.08 \cdot 10^{-244}:\\
\;\;\;\;\frac{\frac{-0.16666666666666666 \cdot \frac{t\_2}{n} + -0.5 \cdot t\_0}{n} - \log x}{n}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-223}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_1\\
\mathbf{elif}\;x \leq 26500000:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - t\_0\right) + 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - t\_2}{n}}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_1}{n}}{x}\\
\end{array}
\end{array}
if x < 1.07999999999999996e-244Initial program 39.7%
Taylor expanded in x around 0 39.7%
*-rgt-identity39.7%
associate-*l/39.7%
associate-/l*39.7%
exp-to-pow39.7%
Simplified39.7%
Taylor expanded in n around -inf 72.6%
mul-1-neg72.6%
Simplified72.6%
if 1.07999999999999996e-244 < x < 6.7999999999999996e-223Initial program 73.0%
Taylor expanded in n around 0 73.0%
log1p-define79.2%
*-rgt-identity79.2%
associate-*l/79.2%
associate-/l*79.2%
exp-to-pow79.2%
Simplified79.2%
if 6.7999999999999996e-223 < x < 2.65e7Initial program 36.0%
Taylor expanded in n around -inf 87.7%
Simplified87.7%
if 2.65e7 < x Initial program 67.3%
Taylor expanded in x around inf 98.9%
associate-/r*99.8%
mul-1-neg99.8%
log-rec99.8%
mul-1-neg99.8%
distribute-neg-frac99.8%
mul-1-neg99.8%
remove-double-neg99.8%
*-rgt-identity99.8%
associate-/l*99.7%
exp-to-pow99.8%
Simplified99.8%
Final simplification90.9%
(FPCore (x n)
:precision binary64
(let* ((t_0
(/
(-
(/
(+
(* -0.16666666666666666 (/ (pow (log x) 3.0) n))
(* -0.5 (pow (log x) 2.0)))
n)
(log x))
n))
(t_1 (pow x (/ 1.0 n))))
(if (<= x 1.08e-244)
t_0
(if (<= x 6.8e-223)
(- (exp (/ (log1p x) n)) t_1)
(if (<= x 1.0) t_0 (/ (/ t_1 n) x))))))
double code(double x, double n) {
double t_0 = ((((-0.16666666666666666 * (pow(log(x), 3.0) / n)) + (-0.5 * pow(log(x), 2.0))) / n) - log(x)) / n;
double t_1 = pow(x, (1.0 / n));
double tmp;
if (x <= 1.08e-244) {
tmp = t_0;
} else if (x <= 6.8e-223) {
tmp = exp((log1p(x) / n)) - t_1;
} else if (x <= 1.0) {
tmp = t_0;
} else {
tmp = (t_1 / n) / x;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = ((((-0.16666666666666666 * (Math.pow(Math.log(x), 3.0) / n)) + (-0.5 * Math.pow(Math.log(x), 2.0))) / n) - Math.log(x)) / n;
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 1.08e-244) {
tmp = t_0;
} else if (x <= 6.8e-223) {
tmp = Math.exp((Math.log1p(x) / n)) - t_1;
} else if (x <= 1.0) {
tmp = t_0;
} else {
tmp = (t_1 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = ((((-0.16666666666666666 * (math.pow(math.log(x), 3.0) / n)) + (-0.5 * math.pow(math.log(x), 2.0))) / n) - math.log(x)) / n t_1 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 1.08e-244: tmp = t_0 elif x <= 6.8e-223: tmp = math.exp((math.log1p(x) / n)) - t_1 elif x <= 1.0: tmp = t_0 else: tmp = (t_1 / n) / x return tmp
function code(x, n) t_0 = Float64(Float64(Float64(Float64(Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) / n)) + Float64(-0.5 * (log(x) ^ 2.0))) / n) - log(x)) / n) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 1.08e-244) tmp = t_0; elseif (x <= 6.8e-223) tmp = Float64(exp(Float64(log1p(x) / n)) - t_1); elseif (x <= 1.0) tmp = t_0; else tmp = Float64(Float64(t_1 / n) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.08e-244], t$95$0, If[LessEqual[x, 6.8e-223], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[x, 1.0], t$95$0, N[(N[(t$95$1 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} + -0.5 \cdot {\log x}^{2}}{n} - \log x}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 1.08 \cdot 10^{-244}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-223}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_1\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_1}{n}}{x}\\
\end{array}
\end{array}
if x < 1.07999999999999996e-244 or 6.7999999999999996e-223 < x < 1Initial program 37.1%
Taylor expanded in x around 0 35.6%
*-rgt-identity35.6%
associate-*l/35.6%
associate-/l*35.6%
exp-to-pow35.6%
Simplified35.6%
Taylor expanded in n around -inf 84.3%
mul-1-neg84.3%
Simplified84.3%
if 1.07999999999999996e-244 < x < 6.7999999999999996e-223Initial program 73.0%
Taylor expanded in n around 0 73.0%
log1p-define79.2%
*-rgt-identity79.2%
associate-*l/79.2%
associate-/l*79.2%
exp-to-pow79.2%
Simplified79.2%
if 1 < x Initial program 66.2%
Taylor expanded in x around inf 98.1%
associate-/r*98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-rgt-identity98.9%
associate-/l*98.9%
exp-to-pow98.9%
Simplified98.9%
Final simplification90.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.001)
(/ (pow (cbrt (pow t_0 1.5)) 2.0) (* x n))
(if (<= (/ 1.0 n) 2e-24)
(/ (log (/ (+ x 1.0) x)) n)
(log (exp (- (exp (/ (log1p x) n)) t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = pow(cbrt(pow(t_0, 1.5)), 2.0) / (x * n);
} else if ((1.0 / n) <= 2e-24) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = log(exp((exp((log1p(x) / n)) - t_0)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = Math.pow(Math.cbrt(Math.pow(t_0, 1.5)), 2.0) / (x * n);
} else if ((1.0 / n) <= 2e-24) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = Math.log(Math.exp((Math.exp((Math.log1p(x) / n)) - t_0)));
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.001) tmp = Float64((cbrt((t_0 ^ 1.5)) ^ 2.0) / Float64(x * n)); elseif (Float64(1.0 / n) <= 2e-24) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = log(exp(Float64(exp(Float64(log1p(x) / n)) - t_0))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.001], N[(N[Power[N[Power[N[Power[t$95$0, 1.5], $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-24], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[Log[N[Exp[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.001:\\
\;\;\;\;\frac{{\left(\sqrt[3]{{t\_0}^{1.5}}\right)}^{2}}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0}\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-3Initial program 95.6%
Taylor expanded in x around inf 99.8%
mul-1-neg99.8%
log-rec99.8%
mul-1-neg99.8%
distribute-neg-frac99.8%
mul-1-neg99.8%
remove-double-neg99.8%
*-commutative99.8%
Simplified99.8%
div-inv99.8%
pow-to-exp99.8%
add-sqr-sqrt99.8%
pow299.8%
Applied egg-rr99.8%
add-cbrt-cube99.8%
pow1/399.8%
unpow299.8%
pow199.8%
pow1/299.8%
add-sqr-sqrt99.8%
unpow299.8%
pow-prod-up99.8%
unpow299.8%
add-sqr-sqrt99.8%
metadata-eval99.8%
Applied egg-rr99.8%
unpow1/399.8%
Simplified99.8%
if -1e-3 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999985e-24Initial program 33.2%
Taylor expanded in n around inf 77.3%
log1p-define77.3%
Simplified77.3%
log1p-undefine77.3%
diff-log77.4%
Applied egg-rr77.4%
+-commutative77.4%
Simplified77.4%
if 1.99999999999999985e-24 < (/.f64 #s(literal 1 binary64) n) Initial program 52.3%
add-log-exp52.4%
pow-to-exp52.3%
un-div-inv52.4%
+-commutative52.4%
log1p-define93.4%
Applied egg-rr93.4%
Final simplification85.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.001)
(/ (pow (cbrt (pow t_0 1.5)) 2.0) (* x n))
(if (<= (/ 1.0 n) 2e-24)
(/ (log (/ (+ x 1.0) x)) n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = pow(cbrt(pow(t_0, 1.5)), 2.0) / (x * n);
} else if ((1.0 / n) <= 2e-24) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = Math.pow(Math.cbrt(Math.pow(t_0, 1.5)), 2.0) / (x * n);
} else if ((1.0 / n) <= 2e-24) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.001) tmp = Float64((cbrt((t_0 ^ 1.5)) ^ 2.0) / Float64(x * n)); elseif (Float64(1.0 / n) <= 2e-24) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.001], N[(N[Power[N[Power[N[Power[t$95$0, 1.5], $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-24], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.001:\\
\;\;\;\;\frac{{\left(\sqrt[3]{{t\_0}^{1.5}}\right)}^{2}}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-3Initial program 95.6%
Taylor expanded in x around inf 99.8%
mul-1-neg99.8%
log-rec99.8%
mul-1-neg99.8%
distribute-neg-frac99.8%
mul-1-neg99.8%
remove-double-neg99.8%
*-commutative99.8%
Simplified99.8%
div-inv99.8%
pow-to-exp99.8%
add-sqr-sqrt99.8%
pow299.8%
Applied egg-rr99.8%
add-cbrt-cube99.8%
pow1/399.8%
unpow299.8%
pow199.8%
pow1/299.8%
add-sqr-sqrt99.8%
unpow299.8%
pow-prod-up99.8%
unpow299.8%
add-sqr-sqrt99.8%
metadata-eval99.8%
Applied egg-rr99.8%
unpow1/399.8%
Simplified99.8%
if -1e-3 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999985e-24Initial program 33.2%
Taylor expanded in n around inf 77.3%
log1p-define77.3%
Simplified77.3%
log1p-undefine77.3%
diff-log77.4%
Applied egg-rr77.4%
+-commutative77.4%
Simplified77.4%
if 1.99999999999999985e-24 < (/.f64 #s(literal 1 binary64) n) Initial program 52.3%
Taylor expanded in n around 0 52.3%
log1p-define93.3%
*-rgt-identity93.3%
associate-*l/93.3%
associate-/l*93.3%
exp-to-pow93.3%
Simplified93.3%
Final simplification85.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.001)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 2e-24)
(/ (log (/ (+ x 1.0) x)) n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-24) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-24) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -0.001: tmp = (t_0 / n) / x elif (1.0 / n) <= 2e-24: tmp = math.log(((x + 1.0) / x)) / n else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.001) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 2e-24) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.001], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-24], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.001:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-3Initial program 95.6%
Taylor expanded in x around inf 99.8%
associate-/r*99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.8%
exp-to-pow99.8%
Simplified99.8%
if -1e-3 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999985e-24Initial program 33.2%
Taylor expanded in n around inf 77.3%
log1p-define77.3%
Simplified77.3%
log1p-undefine77.3%
diff-log77.4%
Applied egg-rr77.4%
+-commutative77.4%
Simplified77.4%
if 1.99999999999999985e-24 < (/.f64 #s(literal 1 binary64) n) Initial program 52.3%
Taylor expanded in n around 0 52.3%
log1p-define93.3%
*-rgt-identity93.3%
associate-*l/93.3%
associate-/l*93.3%
exp-to-pow93.3%
Simplified93.3%
Final simplification85.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.001)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 1e-6)
(/ (log (/ (+ x 1.0) x)) n)
(if (or (<= (/ 1.0 n) 2e+114)
(and (not (<= (/ 1.0 n) 1e+170)) (<= (/ 1.0 n) 2e+209)))
(- (+ (/ x n) 1.0) t_0)
(log1p (expm1 (/ x n))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 1e-6) {
tmp = log(((x + 1.0) / x)) / n;
} else if (((1.0 / n) <= 2e+114) || (!((1.0 / n) <= 1e+170) && ((1.0 / n) <= 2e+209))) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = log1p(expm1((x / n)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 1e-6) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if (((1.0 / n) <= 2e+114) || (!((1.0 / n) <= 1e+170) && ((1.0 / n) <= 2e+209))) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = Math.log1p(Math.expm1((x / n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -0.001: tmp = (t_0 / n) / x elif (1.0 / n) <= 1e-6: tmp = math.log(((x + 1.0) / x)) / n elif ((1.0 / n) <= 2e+114) or (not ((1.0 / n) <= 1e+170) and ((1.0 / n) <= 2e+209)): tmp = ((x / n) + 1.0) - t_0 else: tmp = math.log1p(math.expm1((x / n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.001) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 1e-6) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif ((Float64(1.0 / n) <= 2e+114) || (!(Float64(1.0 / n) <= 1e+170) && (Float64(1.0 / n) <= 2e+209))) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); else tmp = log1p(expm1(Float64(x / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.001], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-6], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[Or[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+114], And[N[Not[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+170]], $MachinePrecision], LessEqual[N[(1.0 / n), $MachinePrecision], 2e+209]]], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[1 + N[(Exp[N[(x / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.001:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-6}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+114} \lor \neg \left(\frac{1}{n} \leq 10^{+170}\right) \land \frac{1}{n} \leq 2 \cdot 10^{+209}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-3Initial program 95.6%
Taylor expanded in x around inf 99.8%
associate-/r*99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.8%
exp-to-pow99.8%
Simplified99.8%
if -1e-3 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999955e-7Initial program 32.6%
Taylor expanded in n around inf 75.9%
log1p-define75.9%
Simplified75.9%
log1p-undefine75.9%
diff-log76.0%
Applied egg-rr76.0%
+-commutative76.0%
Simplified76.0%
if 9.99999999999999955e-7 < (/.f64 #s(literal 1 binary64) n) < 2e114 or 1.00000000000000003e170 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e209Initial program 99.4%
Taylor expanded in x around 0 94.9%
if 2e114 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000003e170 or 2.0000000000000001e209 < (/.f64 #s(literal 1 binary64) n) Initial program 9.9%
Taylor expanded in x around inf 0.7%
mul-1-neg0.7%
log-rec0.7%
mul-1-neg0.7%
distribute-neg-frac0.7%
mul-1-neg0.7%
remove-double-neg0.7%
*-commutative0.7%
Simplified0.7%
Taylor expanded in n around inf 58.0%
associate-/r*58.0%
Simplified58.0%
log1p-expm1-u95.2%
associate-/r*95.2%
associate-/l/95.2%
add-exp-log95.2%
rec-exp95.2%
add-sqr-sqrt95.2%
sqrt-unprod95.2%
sqr-neg95.2%
sqrt-prod0.0%
add-sqr-sqrt95.6%
add-exp-log95.6%
Applied egg-rr95.6%
Final simplification85.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.001)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 2e-15)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 2e+114)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(log1p (expm1 (/ x n))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-15) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e+114) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else {
tmp = log1p(expm1((x / n)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-15) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e+114) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - t_0;
} else {
tmp = Math.log1p(Math.expm1((x / n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -0.001: tmp = (t_0 / n) / x elif (1.0 / n) <= 2e-15: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 2e+114: tmp = math.pow((x + 1.0), (1.0 / n)) - t_0 else: tmp = math.log1p(math.expm1((x / n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.001) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 2e-15) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 2e+114) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); else tmp = log1p(expm1(Float64(x / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.001], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-15], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+114], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[1 + N[(Exp[N[(x / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.001:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-15}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+114}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-3Initial program 95.6%
Taylor expanded in x around inf 99.8%
associate-/r*99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.8%
exp-to-pow99.8%
Simplified99.8%
if -1e-3 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000002e-15Initial program 33.0%
Taylor expanded in n around inf 76.9%
log1p-define76.9%
Simplified76.9%
log1p-undefine76.9%
diff-log77.0%
Applied egg-rr77.0%
+-commutative77.0%
Simplified77.0%
if 2.0000000000000002e-15 < (/.f64 #s(literal 1 binary64) n) < 2e114Initial program 88.9%
if 2e114 < (/.f64 #s(literal 1 binary64) n) Initial program 27.8%
Taylor expanded in x around inf 0.6%
mul-1-neg0.6%
log-rec0.6%
mul-1-neg0.6%
distribute-neg-frac0.6%
mul-1-neg0.6%
remove-double-neg0.6%
*-commutative0.6%
Simplified0.6%
Taylor expanded in n around inf 47.0%
associate-/r*47.0%
Simplified47.0%
log1p-expm1-u76.8%
associate-/r*76.8%
associate-/l/76.8%
add-exp-log76.8%
rec-exp76.8%
add-sqr-sqrt76.8%
sqrt-unprod76.8%
sqr-neg76.8%
sqrt-prod0.0%
add-sqr-sqrt78.1%
add-exp-log78.1%
Applied egg-rr78.1%
Final simplification83.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= (/ 1.0 n) -2e+267)
t_1
(if (<= (/ 1.0 n) -1.8e+163)
t_0
(if (<= (/ 1.0 n) 1e-6)
t_1
(if (<= (/ 1.0 n) 2e+209)
t_0
(/ (+ (/ (+ -0.5 (/ 0.3333333333333333 x)) x) 1.0) (* x n))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double t_1 = log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -2e+267) {
tmp = t_1;
} else if ((1.0 / n) <= -1.8e+163) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-6) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+209) {
tmp = t_0;
} else {
tmp = (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
t_1 = log(((x + 1.0d0) / x)) / n
if ((1.0d0 / n) <= (-2d+267)) then
tmp = t_1
else if ((1.0d0 / n) <= (-1.8d+163)) then
tmp = t_0
else if ((1.0d0 / n) <= 1d-6) then
tmp = t_1
else if ((1.0d0 / n) <= 2d+209) then
tmp = t_0
else
tmp = ((((-0.5d0) + (0.3333333333333333d0 / x)) / x) + 1.0d0) / (x * 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));
double t_1 = Math.log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -2e+267) {
tmp = t_1;
} else if ((1.0 / n) <= -1.8e+163) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-6) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+209) {
tmp = t_0;
} else {
tmp = (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n);
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) t_1 = math.log(((x + 1.0) / x)) / n tmp = 0 if (1.0 / n) <= -2e+267: tmp = t_1 elif (1.0 / n) <= -1.8e+163: tmp = t_0 elif (1.0 / n) <= 1e-6: tmp = t_1 elif (1.0 / n) <= 2e+209: tmp = t_0 else: tmp = (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_1 = Float64(log(Float64(Float64(x + 1.0) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e+267) tmp = t_1; elseif (Float64(1.0 / n) <= -1.8e+163) tmp = t_0; elseif (Float64(1.0 / n) <= 1e-6) tmp = t_1; elseif (Float64(1.0 / n) <= 2e+209) tmp = t_0; else tmp = Float64(Float64(Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x) + 1.0) / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); t_1 = log(((x + 1.0) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -2e+267) tmp = t_1; elseif ((1.0 / n) <= -1.8e+163) tmp = t_0; elseif ((1.0 / n) <= 1e-6) tmp = t_1; elseif ((1.0 / n) <= 2e+209) tmp = t_0; else tmp = (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n); 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]}, Block[{t$95$1 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+267], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.8e+163], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-6], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+209], t$95$0, N[(N[(N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{+267}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq -1.8 \cdot 10^{+163}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+209}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-0.5 + \frac{0.3333333333333333}{x}}{x} + 1}{x \cdot n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e267 or -1.79999999999999989e163 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999955e-7Initial program 45.2%
Taylor expanded in n around inf 72.0%
log1p-define72.0%
Simplified72.0%
log1p-undefine72.0%
diff-log72.1%
Applied egg-rr72.1%
+-commutative72.1%
Simplified72.1%
if -1.9999999999999999e267 < (/.f64 #s(literal 1 binary64) n) < -1.79999999999999989e163 or 9.99999999999999955e-7 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e209Initial program 86.7%
Taylor expanded in x around 0 68.1%
*-rgt-identity68.1%
associate-*l/68.1%
associate-/l*68.1%
exp-to-pow68.1%
Simplified68.1%
if 2.0000000000000001e209 < (/.f64 #s(literal 1 binary64) n) Initial program 6.4%
Taylor expanded in n around inf 0.1%
associate--l+0.1%
log1p-define0.1%
+-commutative0.1%
associate--r+0.1%
distribute-lft-out--0.1%
div-sub0.1%
log1p-define0.1%
Simplified0.1%
Taylor expanded in x around inf 0.0%
Taylor expanded in n around inf 91.9%
associate--l+91.9%
associate-*r/91.9%
metadata-eval91.9%
unpow291.9%
associate-/r*91.9%
metadata-eval91.9%
associate-*r/91.9%
associate-*r/91.9%
metadata-eval91.9%
div-sub91.9%
sub-neg91.9%
associate-*r/91.9%
metadata-eval91.9%
metadata-eval91.9%
*-commutative91.9%
Simplified91.9%
Final simplification72.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.001)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 1e-6)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 2e+209)
(- (+ (/ x n) 1.0) t_0)
(/ (+ (/ (+ -0.5 (/ 0.3333333333333333 x)) x) 1.0) (* x n)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 1e-6) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e+209) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-0.001d0)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 1d-6) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 2d+209) then
tmp = ((x / n) + 1.0d0) - t_0
else
tmp = ((((-0.5d0) + (0.3333333333333333d0 / x)) / x) + 1.0d0) / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 1e-6) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e+209) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -0.001: tmp = (t_0 / n) / x elif (1.0 / n) <= 1e-6: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 2e+209: tmp = ((x / n) + 1.0) - t_0 else: tmp = (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.001) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 1e-6) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 2e+209) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); else tmp = Float64(Float64(Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x) + 1.0) / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -0.001) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 1e-6) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 2e+209) tmp = ((x / n) + 1.0) - t_0; else tmp = (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.001], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-6], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+209], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.001:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-6}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+209}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-0.5 + \frac{0.3333333333333333}{x}}{x} + 1}{x \cdot n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-3Initial program 95.6%
Taylor expanded in x around inf 99.8%
associate-/r*99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.8%
exp-to-pow99.8%
Simplified99.8%
if -1e-3 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999955e-7Initial program 32.6%
Taylor expanded in n around inf 75.9%
log1p-define75.9%
Simplified75.9%
log1p-undefine75.9%
diff-log76.0%
Applied egg-rr76.0%
+-commutative76.0%
Simplified76.0%
if 9.99999999999999955e-7 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e209Initial program 76.2%
Taylor expanded in x around 0 69.8%
if 2.0000000000000001e209 < (/.f64 #s(literal 1 binary64) n) Initial program 6.4%
Taylor expanded in n around inf 0.1%
associate--l+0.1%
log1p-define0.1%
+-commutative0.1%
associate--r+0.1%
distribute-lft-out--0.1%
div-sub0.1%
log1p-define0.1%
Simplified0.1%
Taylor expanded in x around inf 0.0%
Taylor expanded in n around inf 91.9%
associate--l+91.9%
associate-*r/91.9%
metadata-eval91.9%
unpow291.9%
associate-/r*91.9%
metadata-eval91.9%
associate-*r/91.9%
associate-*r/91.9%
metadata-eval91.9%
div-sub91.9%
sub-neg91.9%
associate-*r/91.9%
metadata-eval91.9%
metadata-eval91.9%
*-commutative91.9%
Simplified91.9%
Final simplification81.9%
(FPCore (x n)
:precision binary64
(if (<= x 9.5e-245)
(* (log x) (/ -1.0 n))
(if (<= x 6.8e-223)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 1.85e-191)
(/ (log x) (- n))
(if (or (<= x 1.3e-144) (not (<= x 0.00036)))
(/
(+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* x n)) (/ -0.5 n)) x))
x)
(/ (- x (log x)) n))))))
double code(double x, double n) {
double tmp;
if (x <= 9.5e-245) {
tmp = log(x) * (-1.0 / n);
} else if (x <= 6.8e-223) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 1.85e-191) {
tmp = log(x) / -n;
} else if ((x <= 1.3e-144) || !(x <= 0.00036)) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
} else {
tmp = (x - log(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 <= 9.5d-245) then
tmp = log(x) * ((-1.0d0) / n)
else if (x <= 6.8d-223) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 1.85d-191) then
tmp = log(x) / -n
else if ((x <= 1.3d-144) .or. (.not. (x <= 0.00036d0))) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) + ((-0.5d0) / n)) / x)) / x
else
tmp = (x - log(x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 9.5e-245) {
tmp = Math.log(x) * (-1.0 / n);
} else if (x <= 6.8e-223) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 1.85e-191) {
tmp = Math.log(x) / -n;
} else if ((x <= 1.3e-144) || !(x <= 0.00036)) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
} else {
tmp = (x - Math.log(x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 9.5e-245: tmp = math.log(x) * (-1.0 / n) elif x <= 6.8e-223: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 1.85e-191: tmp = math.log(x) / -n elif (x <= 1.3e-144) or not (x <= 0.00036): tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x else: tmp = (x - math.log(x)) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 9.5e-245) tmp = Float64(log(x) * Float64(-1.0 / n)); elseif (x <= 6.8e-223) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 1.85e-191) tmp = Float64(log(x) / Float64(-n)); elseif ((x <= 1.3e-144) || !(x <= 0.00036)) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) + Float64(-0.5 / n)) / x)) / x); else tmp = Float64(Float64(x - log(x)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 9.5e-245) tmp = log(x) * (-1.0 / n); elseif (x <= 6.8e-223) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 1.85e-191) tmp = log(x) / -n; elseif ((x <= 1.3e-144) || ~((x <= 0.00036))) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x; else tmp = (x - log(x)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 9.5e-245], N[(N[Log[x], $MachinePrecision] * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.8e-223], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.85e-191], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[Or[LessEqual[x, 1.3e-144], N[Not[LessEqual[x, 0.00036]], $MachinePrecision]], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.5 \cdot 10^{-245}:\\
\;\;\;\;\log x \cdot \frac{-1}{n}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-223}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-191}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-144} \lor \neg \left(x \leq 0.00036\right):\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\end{array}
\end{array}
if x < 9.5000000000000002e-245Initial program 39.7%
Taylor expanded in n around inf 60.7%
log1p-define60.7%
Simplified60.7%
Taylor expanded in x around 0 60.7%
neg-mul-160.7%
Simplified60.7%
frac-2neg60.7%
div-inv60.7%
remove-double-neg60.7%
distribute-neg-frac260.7%
distribute-neg-frac60.7%
metadata-eval60.7%
Applied egg-rr60.7%
if 9.5000000000000002e-245 < x < 6.7999999999999996e-223Initial program 73.0%
Taylor expanded in x around 0 73.0%
*-rgt-identity73.0%
associate-*l/73.0%
associate-/l*73.0%
exp-to-pow73.0%
Simplified73.0%
if 6.7999999999999996e-223 < x < 1.8499999999999998e-191Initial program 34.3%
Taylor expanded in x around 0 34.3%
*-rgt-identity34.3%
associate-*l/34.3%
associate-/l*34.3%
exp-to-pow34.3%
Simplified34.3%
Taylor expanded in n around inf 63.4%
mul-1-neg63.4%
distribute-neg-frac263.4%
Simplified63.4%
if 1.8499999999999998e-191 < x < 1.3e-144 or 3.60000000000000023e-4 < x Initial program 65.5%
Taylor expanded in n around inf 58.5%
log1p-define58.5%
Simplified58.5%
Taylor expanded in x around inf 57.9%
Simplified66.7%
if 1.3e-144 < x < 3.60000000000000023e-4Initial program 27.0%
Taylor expanded in n around inf 65.9%
log1p-define65.9%
Simplified65.9%
Taylor expanded in x around 0 65.5%
Final simplification66.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.001)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 1e-6)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 2e+209)
(- 1.0 t_0)
(/ (+ (/ (+ -0.5 (/ 0.3333333333333333 x)) x) 1.0) (* x n)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 1e-6) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e+209) {
tmp = 1.0 - t_0;
} else {
tmp = (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-0.001d0)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 1d-6) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 2d+209) then
tmp = 1.0d0 - t_0
else
tmp = ((((-0.5d0) + (0.3333333333333333d0 / x)) / x) + 1.0d0) / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.001) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 1e-6) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e+209) {
tmp = 1.0 - t_0;
} else {
tmp = (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -0.001: tmp = (t_0 / n) / x elif (1.0 / n) <= 1e-6: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 2e+209: tmp = 1.0 - t_0 else: tmp = (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.001) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 1e-6) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 2e+209) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x) + 1.0) / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -0.001) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 1e-6) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 2e+209) tmp = 1.0 - t_0; else tmp = (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.001], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-6], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+209], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.001:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-6}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+209}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-0.5 + \frac{0.3333333333333333}{x}}{x} + 1}{x \cdot n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-3Initial program 95.6%
Taylor expanded in x around inf 99.8%
associate-/r*99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.8%
exp-to-pow99.8%
Simplified99.8%
if -1e-3 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999955e-7Initial program 32.6%
Taylor expanded in n around inf 75.9%
log1p-define75.9%
Simplified75.9%
log1p-undefine75.9%
diff-log76.0%
Applied egg-rr76.0%
+-commutative76.0%
Simplified76.0%
if 9.99999999999999955e-7 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e209Initial program 76.2%
Taylor expanded in x around 0 69.5%
*-rgt-identity69.5%
associate-*l/69.5%
associate-/l*69.5%
exp-to-pow69.5%
Simplified69.5%
if 2.0000000000000001e209 < (/.f64 #s(literal 1 binary64) n) Initial program 6.4%
Taylor expanded in n around inf 0.1%
associate--l+0.1%
log1p-define0.1%
+-commutative0.1%
associate--r+0.1%
distribute-lft-out--0.1%
div-sub0.1%
log1p-define0.1%
Simplified0.1%
Taylor expanded in x around inf 0.0%
Taylor expanded in n around inf 91.9%
associate--l+91.9%
associate-*r/91.9%
metadata-eval91.9%
unpow291.9%
associate-/r*91.9%
metadata-eval91.9%
associate-*r/91.9%
associate-*r/91.9%
metadata-eval91.9%
div-sub91.9%
sub-neg91.9%
associate-*r/91.9%
metadata-eval91.9%
metadata-eval91.9%
*-commutative91.9%
Simplified91.9%
Final simplification81.9%
(FPCore (x n)
:precision binary64
(if (<= x 2.05e-191)
(/ (log x) (- n))
(if (or (<= x 1.3e-144) (not (<= x 0.00036)))
(/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* x n)) (/ -0.5 n)) x)) x)
(* (log x) (/ -1.0 n)))))
double code(double x, double n) {
double tmp;
if (x <= 2.05e-191) {
tmp = log(x) / -n;
} else if ((x <= 1.3e-144) || !(x <= 0.00036)) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
} else {
tmp = log(x) * (-1.0 / n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2.05d-191) then
tmp = log(x) / -n
else if ((x <= 1.3d-144) .or. (.not. (x <= 0.00036d0))) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) + ((-0.5d0) / n)) / x)) / x
else
tmp = log(x) * ((-1.0d0) / n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.05e-191) {
tmp = Math.log(x) / -n;
} else if ((x <= 1.3e-144) || !(x <= 0.00036)) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
} else {
tmp = Math.log(x) * (-1.0 / n);
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.05e-191: tmp = math.log(x) / -n elif (x <= 1.3e-144) or not (x <= 0.00036): tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x else: tmp = math.log(x) * (-1.0 / n) return tmp
function code(x, n) tmp = 0.0 if (x <= 2.05e-191) tmp = Float64(log(x) / Float64(-n)); elseif ((x <= 1.3e-144) || !(x <= 0.00036)) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) + Float64(-0.5 / n)) / x)) / x); else tmp = Float64(log(x) * Float64(-1.0 / n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.05e-191) tmp = log(x) / -n; elseif ((x <= 1.3e-144) || ~((x <= 0.00036))) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x; else tmp = log(x) * (-1.0 / n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.05e-191], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[Or[LessEqual[x, 1.3e-144], N[Not[LessEqual[x, 0.00036]], $MachinePrecision]], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[Log[x], $MachinePrecision] * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.05 \cdot 10^{-191}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-144} \lor \neg \left(x \leq 0.00036\right):\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\log x \cdot \frac{-1}{n}\\
\end{array}
\end{array}
if x < 2.0500000000000001e-191Initial program 48.6%
Taylor expanded in x around 0 48.6%
*-rgt-identity48.6%
associate-*l/48.6%
associate-/l*48.6%
exp-to-pow48.6%
Simplified48.6%
Taylor expanded in n around inf 51.0%
mul-1-neg51.0%
distribute-neg-frac251.0%
Simplified51.0%
if 2.0500000000000001e-191 < x < 1.3e-144 or 3.60000000000000023e-4 < x Initial program 65.5%
Taylor expanded in n around inf 58.5%
log1p-define58.5%
Simplified58.5%
Taylor expanded in x around inf 57.9%
Simplified66.7%
if 1.3e-144 < x < 3.60000000000000023e-4Initial program 27.0%
Taylor expanded in n around inf 65.9%
log1p-define65.9%
Simplified65.9%
Taylor expanded in x around 0 63.8%
neg-mul-163.8%
Simplified63.8%
frac-2neg63.8%
div-inv63.8%
remove-double-neg63.8%
distribute-neg-frac263.8%
distribute-neg-frac63.8%
metadata-eval63.8%
Applied egg-rr63.8%
Final simplification62.8%
(FPCore (x n)
:precision binary64
(if (<= x 2.05e-191)
(/ (log x) (- n))
(if (or (<= x 1.45e-144) (not (<= x 0.00036)))
(/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* x n)) (/ -0.5 n)) x)) x)
(/ (- x (log x)) n))))
double code(double x, double n) {
double tmp;
if (x <= 2.05e-191) {
tmp = log(x) / -n;
} else if ((x <= 1.45e-144) || !(x <= 0.00036)) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
} else {
tmp = (x - log(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 <= 2.05d-191) then
tmp = log(x) / -n
else if ((x <= 1.45d-144) .or. (.not. (x <= 0.00036d0))) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) + ((-0.5d0) / n)) / x)) / x
else
tmp = (x - log(x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.05e-191) {
tmp = Math.log(x) / -n;
} else if ((x <= 1.45e-144) || !(x <= 0.00036)) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
} else {
tmp = (x - Math.log(x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.05e-191: tmp = math.log(x) / -n elif (x <= 1.45e-144) or not (x <= 0.00036): tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x else: tmp = (x - math.log(x)) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 2.05e-191) tmp = Float64(log(x) / Float64(-n)); elseif ((x <= 1.45e-144) || !(x <= 0.00036)) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) + Float64(-0.5 / n)) / x)) / x); else tmp = Float64(Float64(x - log(x)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.05e-191) tmp = log(x) / -n; elseif ((x <= 1.45e-144) || ~((x <= 0.00036))) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x; else tmp = (x - log(x)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.05e-191], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[Or[LessEqual[x, 1.45e-144], N[Not[LessEqual[x, 0.00036]], $MachinePrecision]], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.05 \cdot 10^{-191}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-144} \lor \neg \left(x \leq 0.00036\right):\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\end{array}
\end{array}
if x < 2.0500000000000001e-191Initial program 48.6%
Taylor expanded in x around 0 48.6%
*-rgt-identity48.6%
associate-*l/48.6%
associate-/l*48.6%
exp-to-pow48.6%
Simplified48.6%
Taylor expanded in n around inf 51.0%
mul-1-neg51.0%
distribute-neg-frac251.0%
Simplified51.0%
if 2.0500000000000001e-191 < x < 1.4500000000000001e-144 or 3.60000000000000023e-4 < x Initial program 65.5%
Taylor expanded in n around inf 58.5%
log1p-define58.5%
Simplified58.5%
Taylor expanded in x around inf 57.9%
Simplified66.7%
if 1.4500000000000001e-144 < x < 3.60000000000000023e-4Initial program 27.0%
Taylor expanded in n around inf 65.9%
log1p-define65.9%
Simplified65.9%
Taylor expanded in x around 0 65.5%
Final simplification63.2%
(FPCore (x n) :precision binary64 (if (or (<= x 2.05e-191) (and (not (<= x 1.3e-144)) (<= x 0.00036))) (/ (log x) (- n)) (/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* x n)) (/ -0.5 n)) x)) x)))
double code(double x, double n) {
double tmp;
if ((x <= 2.05e-191) || (!(x <= 1.3e-144) && (x <= 0.00036))) {
tmp = log(x) / -n;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.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 ((x <= 2.05d-191) .or. (.not. (x <= 1.3d-144)) .and. (x <= 0.00036d0)) then
tmp = log(x) / -n
else
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) + ((-0.5d0) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((x <= 2.05e-191) || (!(x <= 1.3e-144) && (x <= 0.00036))) {
tmp = Math.log(x) / -n;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (x <= 2.05e-191) or (not (x <= 1.3e-144) and (x <= 0.00036)): tmp = math.log(x) / -n else: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x return tmp
function code(x, n) tmp = 0.0 if ((x <= 2.05e-191) || (!(x <= 1.3e-144) && (x <= 0.00036))) tmp = Float64(log(x) / Float64(-n)); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) + Float64(-0.5 / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((x <= 2.05e-191) || (~((x <= 1.3e-144)) && (x <= 0.00036))) tmp = log(x) / -n; else tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := If[Or[LessEqual[x, 2.05e-191], And[N[Not[LessEqual[x, 1.3e-144]], $MachinePrecision], LessEqual[x, 0.00036]]], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.05 \cdot 10^{-191} \lor \neg \left(x \leq 1.3 \cdot 10^{-144}\right) \land x \leq 0.00036:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if x < 2.0500000000000001e-191 or 1.3e-144 < x < 3.60000000000000023e-4Initial program 36.4%
Taylor expanded in x around 0 36.4%
*-rgt-identity36.4%
associate-*l/36.4%
associate-/l*36.4%
exp-to-pow36.4%
Simplified36.4%
Taylor expanded in n around inf 58.3%
mul-1-neg58.3%
distribute-neg-frac258.3%
Simplified58.3%
if 2.0500000000000001e-191 < x < 1.3e-144 or 3.60000000000000023e-4 < x Initial program 65.5%
Taylor expanded in n around inf 58.5%
log1p-define58.5%
Simplified58.5%
Taylor expanded in x around inf 57.9%
Simplified66.7%
Final simplification62.8%
(FPCore (x n) :precision binary64 (/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* x n)) (/ -0.5 n)) x)) x))
double code(double x, double n) {
return ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) + ((-0.5d0) / n)) / x)) / x
end function
public static double code(double x, double n) {
return ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
}
def code(x, n): return ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x
function code(x, n) return Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) + Float64(-0.5 / n)) / x)) / x) end
function tmp = code(x, n) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x; end
code[x_, n_] := N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}
\end{array}
Initial program 51.8%
Taylor expanded in n around inf 58.9%
log1p-define58.9%
Simplified58.9%
Taylor expanded in x around inf 35.1%
Simplified46.6%
Final simplification46.6%
(FPCore (x n) :precision binary64 (/ (+ (/ (+ -0.5 (/ 0.3333333333333333 x)) x) 1.0) (* x n)))
double code(double x, double n) {
return (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((((-0.5d0) + (0.3333333333333333d0 / x)) / x) + 1.0d0) / (x * n)
end function
public static double code(double x, double n) {
return (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n);
}
def code(x, n): return (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n)
function code(x, n) return Float64(Float64(Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x) + 1.0) / Float64(x * n)) end
function tmp = code(x, n) tmp = (((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / (x * n); end
code[x_, n_] := N[(N[(N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{-0.5 + \frac{0.3333333333333333}{x}}{x} + 1}{x \cdot n}
\end{array}
Initial program 51.8%
Taylor expanded in n around inf 64.4%
associate--l+52.9%
log1p-define52.9%
+-commutative52.9%
associate--r+64.4%
distribute-lft-out--64.4%
div-sub64.4%
log1p-define64.4%
Simplified64.4%
Taylor expanded in x around inf 34.5%
Taylor expanded in n around inf 46.2%
associate--l+46.2%
associate-*r/46.2%
metadata-eval46.2%
unpow246.2%
associate-/r*46.2%
metadata-eval46.2%
associate-*r/46.2%
associate-*r/46.2%
metadata-eval46.2%
div-sub46.2%
sub-neg46.2%
associate-*r/46.2%
metadata-eval46.2%
metadata-eval46.2%
*-commutative46.2%
Simplified46.2%
Final simplification46.2%
(FPCore (x n) :precision binary64 (/ (/ (+ (/ (+ -0.5 (/ 0.3333333333333333 x)) x) 1.0) x) n))
double code(double x, double n) {
return ((((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (((((-0.5d0) + (0.3333333333333333d0 / x)) / x) + 1.0d0) / x) / n
end function
public static double code(double x, double n) {
return ((((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / x) / n;
}
def code(x, n): return ((((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / x) / n
function code(x, n) return Float64(Float64(Float64(Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x) + 1.0) / x) / n) end
function tmp = code(x, n) tmp = ((((-0.5 + (0.3333333333333333 / x)) / x) + 1.0) / x) / n; end
code[x_, n_] := N[(N[(N[(N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + 1.0), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{-0.5 + \frac{0.3333333333333333}{x}}{x} + 1}{x}}{n}
\end{array}
Initial program 51.8%
Taylor expanded in n around inf 58.9%
log1p-define58.9%
Simplified58.9%
Taylor expanded in x around inf 46.5%
Simplified46.5%
Final simplification46.5%
(FPCore (x n) :precision binary64 (* x (/ 1.0 n)))
double code(double x, double n) {
return x * (1.0 / n);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = x * (1.0d0 / n)
end function
public static double code(double x, double n) {
return x * (1.0 / n);
}
def code(x, n): return x * (1.0 / n)
function code(x, n) return Float64(x * Float64(1.0 / n)) end
function tmp = code(x, n) tmp = x * (1.0 / n); end
code[x_, n_] := N[(x * N[(1.0 / n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{1}{n}
\end{array}
Initial program 51.8%
Taylor expanded in x around inf 55.3%
mul-1-neg55.3%
log-rec55.3%
mul-1-neg55.3%
distribute-neg-frac55.3%
mul-1-neg55.3%
remove-double-neg55.3%
*-commutative55.3%
Simplified55.3%
Taylor expanded in n around inf 42.6%
associate-/r*42.9%
Simplified42.9%
div-inv42.9%
add-exp-log42.0%
rec-exp42.0%
add-sqr-sqrt13.8%
sqrt-unprod15.2%
sqr-neg15.2%
sqrt-prod1.4%
add-sqr-sqrt4.9%
add-exp-log4.9%
Applied egg-rr4.9%
Final simplification4.9%
(FPCore (x n) :precision binary64 (/ 1.0 (* x n)))
double code(double x, double n) {
return 1.0 / (x * n);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (x * n)
end function
public static double code(double x, double n) {
return 1.0 / (x * n);
}
def code(x, n): return 1.0 / (x * n)
function code(x, n) return Float64(1.0 / Float64(x * n)) end
function tmp = code(x, n) tmp = 1.0 / (x * n); end
code[x_, n_] := N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x \cdot n}
\end{array}
Initial program 51.8%
Taylor expanded in x around inf 55.3%
mul-1-neg55.3%
log-rec55.3%
mul-1-neg55.3%
distribute-neg-frac55.3%
mul-1-neg55.3%
remove-double-neg55.3%
*-commutative55.3%
Simplified55.3%
Taylor expanded in n around inf 42.6%
Final simplification42.6%
(FPCore (x n) :precision binary64 (/ (/ 1.0 n) x))
double code(double x, double n) {
return (1.0 / n) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) / x
end function
public static double code(double x, double n) {
return (1.0 / n) / x;
}
def code(x, n): return (1.0 / n) / x
function code(x, n) return Float64(Float64(1.0 / n) / x) end
function tmp = code(x, n) tmp = (1.0 / n) / x; end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n}}{x}
\end{array}
Initial program 51.8%
Taylor expanded in x around inf 55.3%
mul-1-neg55.3%
log-rec55.3%
mul-1-neg55.3%
distribute-neg-frac55.3%
mul-1-neg55.3%
remove-double-neg55.3%
*-commutative55.3%
Simplified55.3%
Taylor expanded in n around inf 42.6%
associate-/r*42.9%
Simplified42.9%
Final simplification42.9%
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
return x / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = x / n
end function
public static double code(double x, double n) {
return x / n;
}
def code(x, n): return x / n
function code(x, n) return Float64(x / n) end
function tmp = code(x, n) tmp = x / n; end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{n}
\end{array}
Initial program 51.8%
Taylor expanded in x around inf 55.3%
mul-1-neg55.3%
log-rec55.3%
mul-1-neg55.3%
distribute-neg-frac55.3%
mul-1-neg55.3%
remove-double-neg55.3%
*-commutative55.3%
Simplified55.3%
Taylor expanded in n around inf 42.6%
associate-/r*42.9%
Simplified42.9%
div-inv42.9%
*-commutative42.9%
add-exp-log42.0%
rec-exp42.0%
add-sqr-sqrt13.8%
sqrt-unprod15.2%
sqr-neg15.2%
sqrt-prod1.4%
add-sqr-sqrt4.9%
add-exp-log4.9%
Applied egg-rr4.9%
associate-*r/4.5%
*-rgt-identity4.5%
Simplified4.5%
Final simplification4.5%
herbie shell --seed 2024080
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))