
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 0.5 (* n n)))
(t_1 (pow x (/ 1.0 n)))
(t_2 (/ (log x) n))
(t_3 (exp t_2)))
(if (<= (/ 1.0 n) -4e-26)
(/ t_1 (* n x))
(if (<= (/ 1.0 n) 2e-92)
(-
(fma 0.5 (/ (pow (log1p x) 2.0) (* n n)) (/ (log1p x) n))
(fma 0.5 (/ (pow (log x) 2.0) (* n n)) t_2))
(if (<= (/ 1.0 n) 2e-8)
(+
(/ t_3 (* n x))
(+
(/ t_3 (/ (* x x) (- t_0 (/ 0.5 n))))
(/
t_3
(/
(pow x 3.0)
(+
(/ 0.16666666666666666 (pow n 3.0))
(- (/ 0.3333333333333333 n) t_0))))))
(- (cbrt (exp (* 3.0 (/ x n)))) t_1))))))
double code(double x, double n) {
double t_0 = 0.5 / (n * n);
double t_1 = pow(x, (1.0 / n));
double t_2 = log(x) / n;
double t_3 = exp(t_2);
double tmp;
if ((1.0 / n) <= -4e-26) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 2e-92) {
tmp = fma(0.5, (pow(log1p(x), 2.0) / (n * n)), (log1p(x) / n)) - fma(0.5, (pow(log(x), 2.0) / (n * n)), t_2);
} else if ((1.0 / n) <= 2e-8) {
tmp = (t_3 / (n * x)) + ((t_3 / ((x * x) / (t_0 - (0.5 / n)))) + (t_3 / (pow(x, 3.0) / ((0.16666666666666666 / pow(n, 3.0)) + ((0.3333333333333333 / n) - t_0)))));
} else {
tmp = cbrt(exp((3.0 * (x / n)))) - t_1;
}
return tmp;
}
function code(x, n) t_0 = Float64(0.5 / Float64(n * n)) t_1 = x ^ Float64(1.0 / n) t_2 = Float64(log(x) / n) t_3 = exp(t_2) tmp = 0.0 if (Float64(1.0 / n) <= -4e-26) tmp = Float64(t_1 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-92) tmp = Float64(fma(0.5, Float64((log1p(x) ^ 2.0) / Float64(n * n)), Float64(log1p(x) / n)) - fma(0.5, Float64((log(x) ^ 2.0) / Float64(n * n)), t_2)); elseif (Float64(1.0 / n) <= 2e-8) tmp = Float64(Float64(t_3 / Float64(n * x)) + Float64(Float64(t_3 / Float64(Float64(x * x) / Float64(t_0 - Float64(0.5 / n)))) + Float64(t_3 / Float64((x ^ 3.0) / Float64(Float64(0.16666666666666666 / (n ^ 3.0)) + Float64(Float64(0.3333333333333333 / n) - t_0)))))); else tmp = Float64(cbrt(exp(Float64(3.0 * Float64(x / n)))) - t_1); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$3 = N[Exp[t$95$2], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-26], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-92], N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], N[(N[(t$95$3 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$3 / N[(N[(x * x), $MachinePrecision] / N[(t$95$0 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 / N[(N[Power[x, 3.0], $MachinePrecision] / N[(N[(0.16666666666666666 / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 / n), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Exp[N[(3.0 * N[(x / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{0.5}{n \cdot n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{\log x}{n}\\
t_3 := e^{t_2}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-26}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-92}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right)}{n}\right) - \mathsf{fma}\left(0.5, \frac{{\log x}^{2}}{n \cdot n}, t_2\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{t_3}{n \cdot x} + \left(\frac{t_3}{\frac{x \cdot x}{t_0 - \frac{0.5}{n}}} + \frac{t_3}{\frac{{x}^{3}}{\frac{0.16666666666666666}{{n}^{3}} + \left(\frac{0.3333333333333333}{n} - t_0\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{3 \cdot \frac{x}{n}}} - t_1\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.0000000000000002e-26Initial program 93.8%
Taylor expanded in x around inf 98.4%
mul-1-neg98.4%
log-rec98.4%
distribute-frac-neg98.4%
remove-double-neg98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in x around 0 98.4%
remove-double-neg98.4%
distribute-frac-neg98.4%
*-commutative98.4%
rem-exp-log45.6%
log-div0.0%
exp-diff0.0%
distribute-frac-neg0.0%
remove-double-neg0.0%
rem-log-exp0.0%
*-rgt-identity0.0%
associate-*r/0.0%
*-commutative0.0%
log-pow0.0%
exp-diff0.0%
Simplified98.4%
if -4.0000000000000002e-26 < (/.f64 1 n) < 1.99999999999999998e-92Initial program 32.5%
Taylor expanded in n around inf 84.0%
fma-def84.0%
log1p-def84.0%
unpow284.0%
log1p-def84.0%
fma-def84.0%
unpow284.0%
Simplified84.0%
if 1.99999999999999998e-92 < (/.f64 1 n) < 2e-8Initial program 7.0%
Taylor expanded in x around inf 68.7%
Simplified68.7%
if 2e-8 < (/.f64 1 n) Initial program 43.5%
add-cbrt-cube43.5%
pow343.5%
pow-to-exp43.5%
pow-exp43.5%
un-div-inv43.5%
+-commutative43.5%
log1p-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification90.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-26)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-92)
(-
(fma 0.5 (/ (pow (log1p x) 2.0) (* n n)) (/ (log1p x) n))
(fma 0.5 (/ (pow (log x) 2.0) (* n n)) (/ (log x) n)))
(if (<= (/ 1.0 n) 2e-8)
(+
(/ (log x) (* x (* n n)))
(+
(/ (+ (/ 1.0 x) (/ 0.3333333333333333 (pow x 3.0))) n)
(/ -0.5 (* n (* x x)))))
(- (cbrt (exp (* 3.0 (/ x n)))) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-26) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-92) {
tmp = fma(0.5, (pow(log1p(x), 2.0) / (n * n)), (log1p(x) / n)) - fma(0.5, (pow(log(x), 2.0) / (n * n)), (log(x) / n));
} else if ((1.0 / n) <= 2e-8) {
tmp = (log(x) / (x * (n * n))) + ((((1.0 / x) + (0.3333333333333333 / pow(x, 3.0))) / n) + (-0.5 / (n * (x * x))));
} else {
tmp = cbrt(exp((3.0 * (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) <= -4e-26) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-92) tmp = Float64(fma(0.5, Float64((log1p(x) ^ 2.0) / Float64(n * n)), Float64(log1p(x) / n)) - fma(0.5, Float64((log(x) ^ 2.0) / Float64(n * n)), Float64(log(x) / n))); elseif (Float64(1.0 / n) <= 2e-8) tmp = Float64(Float64(log(x) / Float64(x * Float64(n * n))) + Float64(Float64(Float64(Float64(1.0 / x) + Float64(0.3333333333333333 / (x ^ 3.0))) / n) + Float64(-0.5 / Float64(n * Float64(x * x))))); else tmp = Float64(cbrt(exp(Float64(3.0 * Float64(x / n)))) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-26], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-92], N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], N[(N[(N[Log[x], $MachinePrecision] / N[(x * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(1.0 / x), $MachinePrecision] + N[(0.3333333333333333 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 / N[(n * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Exp[N[(3.0 * N[(x / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1/3], $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 -4 \cdot 10^{-26}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-92}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right)}{n}\right) - \mathsf{fma}\left(0.5, \frac{{\log x}^{2}}{n \cdot n}, \frac{\log x}{n}\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{\log x}{x \cdot \left(n \cdot n\right)} + \left(\frac{\frac{1}{x} + \frac{0.3333333333333333}{{x}^{3}}}{n} + \frac{-0.5}{n \cdot \left(x \cdot x\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{3 \cdot \frac{x}{n}}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.0000000000000002e-26Initial program 93.8%
Taylor expanded in x around inf 98.4%
mul-1-neg98.4%
log-rec98.4%
distribute-frac-neg98.4%
remove-double-neg98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in x around 0 98.4%
remove-double-neg98.4%
distribute-frac-neg98.4%
*-commutative98.4%
rem-exp-log45.6%
log-div0.0%
exp-diff0.0%
distribute-frac-neg0.0%
remove-double-neg0.0%
rem-log-exp0.0%
*-rgt-identity0.0%
associate-*r/0.0%
*-commutative0.0%
log-pow0.0%
exp-diff0.0%
Simplified98.4%
if -4.0000000000000002e-26 < (/.f64 1 n) < 1.99999999999999998e-92Initial program 32.5%
Taylor expanded in n around inf 84.0%
fma-def84.0%
log1p-def84.0%
unpow284.0%
log1p-def84.0%
fma-def84.0%
unpow284.0%
Simplified84.0%
if 1.99999999999999998e-92 < (/.f64 1 n) < 2e-8Initial program 7.0%
Taylor expanded in n around inf 41.9%
fma-def41.9%
log1p-def41.9%
unpow241.9%
log1p-def41.9%
fma-def41.9%
unpow241.9%
Simplified41.9%
Taylor expanded in x around inf 67.2%
Simplified67.2%
Taylor expanded in n around inf 67.3%
associate-*r/67.3%
metadata-eval67.3%
Simplified67.3%
if 2e-8 < (/.f64 1 n) Initial program 43.5%
add-cbrt-cube43.5%
pow343.5%
pow-to-exp43.5%
pow-exp43.5%
un-div-inv43.5%
+-commutative43.5%
log1p-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification90.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-26)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-92)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 2e-8)
(+
(/ (log x) (* x (* n n)))
(+
(/ (+ (/ 1.0 x) (/ 0.3333333333333333 (pow x 3.0))) n)
(/ -0.5 (* n (* x x)))))
(- (cbrt (exp (* 3.0 (/ x n)))) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-26) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-92) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 2e-8) {
tmp = (log(x) / (x * (n * n))) + ((((1.0 / x) + (0.3333333333333333 / pow(x, 3.0))) / n) + (-0.5 / (n * (x * x))));
} else {
tmp = cbrt(exp((3.0 * (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) <= -4e-26) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-92) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 2e-8) {
tmp = (Math.log(x) / (x * (n * n))) + ((((1.0 / x) + (0.3333333333333333 / Math.pow(x, 3.0))) / n) + (-0.5 / (n * (x * x))));
} else {
tmp = Math.cbrt(Math.exp((3.0 * (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) <= -4e-26) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-92) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 2e-8) tmp = Float64(Float64(log(x) / Float64(x * Float64(n * n))) + Float64(Float64(Float64(Float64(1.0 / x) + Float64(0.3333333333333333 / (x ^ 3.0))) / n) + Float64(-0.5 / Float64(n * Float64(x * x))))); else tmp = Float64(cbrt(exp(Float64(3.0 * Float64(x / n)))) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-26], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-92], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], N[(N[(N[Log[x], $MachinePrecision] / N[(x * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(1.0 / x), $MachinePrecision] + N[(0.3333333333333333 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 / N[(n * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Exp[N[(3.0 * N[(x / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1/3], $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 -4 \cdot 10^{-26}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-92}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{\log x}{x \cdot \left(n \cdot n\right)} + \left(\frac{\frac{1}{x} + \frac{0.3333333333333333}{{x}^{3}}}{n} + \frac{-0.5}{n \cdot \left(x \cdot x\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{3 \cdot \frac{x}{n}}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.0000000000000002e-26Initial program 93.8%
Taylor expanded in x around inf 98.4%
mul-1-neg98.4%
log-rec98.4%
distribute-frac-neg98.4%
remove-double-neg98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in x around 0 98.4%
remove-double-neg98.4%
distribute-frac-neg98.4%
*-commutative98.4%
rem-exp-log45.6%
log-div0.0%
exp-diff0.0%
distribute-frac-neg0.0%
remove-double-neg0.0%
rem-log-exp0.0%
*-rgt-identity0.0%
associate-*r/0.0%
*-commutative0.0%
log-pow0.0%
exp-diff0.0%
Simplified98.4%
if -4.0000000000000002e-26 < (/.f64 1 n) < 1.99999999999999998e-92Initial program 32.5%
Taylor expanded in n around inf 83.9%
+-rgt-identity83.9%
+-rgt-identity83.9%
log1p-def83.9%
Simplified83.9%
if 1.99999999999999998e-92 < (/.f64 1 n) < 2e-8Initial program 7.0%
Taylor expanded in n around inf 41.9%
fma-def41.9%
log1p-def41.9%
unpow241.9%
log1p-def41.9%
fma-def41.9%
unpow241.9%
Simplified41.9%
Taylor expanded in x around inf 67.2%
Simplified67.2%
Taylor expanded in n around inf 67.3%
associate-*r/67.3%
metadata-eval67.3%
Simplified67.3%
if 2e-8 < (/.f64 1 n) Initial program 43.5%
add-cbrt-cube43.5%
pow343.5%
pow-to-exp43.5%
pow-exp43.5%
un-div-inv43.5%
+-commutative43.5%
log1p-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification90.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-26)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-92)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 2e-8)
(+
(/ (log x) (* x (* n n)))
(+
(/ (+ (/ 1.0 x) (/ 0.3333333333333333 (pow x 3.0))) n)
(/ -0.5 (* n (* x x)))))
(- (exp (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-26) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-92) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 2e-8) {
tmp = (log(x) / (x * (n * n))) + ((((1.0 / x) + (0.3333333333333333 / pow(x, 3.0))) / n) + (-0.5 / (n * (x * x))));
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-26) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-92) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 2e-8) {
tmp = (Math.log(x) / (x * (n * n))) + ((((1.0 / x) + (0.3333333333333333 / Math.pow(x, 3.0))) / n) + (-0.5 / (n * (x * x))));
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-26: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-92: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 2e-8: tmp = (math.log(x) / (x * (n * n))) + ((((1.0 / x) + (0.3333333333333333 / math.pow(x, 3.0))) / n) + (-0.5 / (n * (x * x)))) else: tmp = math.exp((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) <= -4e-26) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-92) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 2e-8) tmp = Float64(Float64(log(x) / Float64(x * Float64(n * n))) + Float64(Float64(Float64(Float64(1.0 / x) + Float64(0.3333333333333333 / (x ^ 3.0))) / n) + Float64(-0.5 / Float64(n * Float64(x * x))))); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-26], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-92], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], N[(N[(N[Log[x], $MachinePrecision] / N[(x * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(1.0 / x), $MachinePrecision] + N[(0.3333333333333333 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 / N[(n * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-26}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-92}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{\log x}{x \cdot \left(n \cdot n\right)} + \left(\frac{\frac{1}{x} + \frac{0.3333333333333333}{{x}^{3}}}{n} + \frac{-0.5}{n \cdot \left(x \cdot x\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.0000000000000002e-26Initial program 93.8%
Taylor expanded in x around inf 98.4%
mul-1-neg98.4%
log-rec98.4%
distribute-frac-neg98.4%
remove-double-neg98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in x around 0 98.4%
remove-double-neg98.4%
distribute-frac-neg98.4%
*-commutative98.4%
rem-exp-log45.6%
log-div0.0%
exp-diff0.0%
distribute-frac-neg0.0%
remove-double-neg0.0%
rem-log-exp0.0%
*-rgt-identity0.0%
associate-*r/0.0%
*-commutative0.0%
log-pow0.0%
exp-diff0.0%
Simplified98.4%
if -4.0000000000000002e-26 < (/.f64 1 n) < 1.99999999999999998e-92Initial program 32.5%
Taylor expanded in n around inf 83.9%
+-rgt-identity83.9%
+-rgt-identity83.9%
log1p-def83.9%
Simplified83.9%
if 1.99999999999999998e-92 < (/.f64 1 n) < 2e-8Initial program 7.0%
Taylor expanded in n around inf 41.9%
fma-def41.9%
log1p-def41.9%
unpow241.9%
log1p-def41.9%
fma-def41.9%
unpow241.9%
Simplified41.9%
Taylor expanded in x around inf 67.2%
Simplified67.2%
Taylor expanded in n around inf 67.3%
associate-*r/67.3%
metadata-eval67.3%
Simplified67.3%
if 2e-8 < (/.f64 1 n) Initial program 43.5%
add-cbrt-cube43.5%
pow343.5%
pow-to-exp43.5%
pow-exp43.5%
un-div-inv43.5%
+-commutative43.5%
log1p-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 99.8%
*-commutative99.8%
exp-prod99.7%
unpow1/399.7%
rem-cbrt-cube99.8%
Simplified99.8%
Final simplification90.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-26)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-92)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 2e-8)
(+
(/ (log x) (* x (* n n)))
(/
(+
(/ 1.0 x)
(+ (/ 0.3333333333333333 (pow x 3.0)) (/ -0.5 (* x x))))
n))
(- (exp (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-26) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-92) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 2e-8) {
tmp = (log(x) / (x * (n * n))) + (((1.0 / x) + ((0.3333333333333333 / pow(x, 3.0)) + (-0.5 / (x * x)))) / n);
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-26) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-92) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 2e-8) {
tmp = (Math.log(x) / (x * (n * n))) + (((1.0 / x) + ((0.3333333333333333 / Math.pow(x, 3.0)) + (-0.5 / (x * x)))) / n);
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-26: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-92: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 2e-8: tmp = (math.log(x) / (x * (n * n))) + (((1.0 / x) + ((0.3333333333333333 / math.pow(x, 3.0)) + (-0.5 / (x * x)))) / n) else: tmp = math.exp((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) <= -4e-26) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-92) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 2e-8) tmp = Float64(Float64(log(x) / Float64(x * Float64(n * n))) + Float64(Float64(Float64(1.0 / x) + Float64(Float64(0.3333333333333333 / (x ^ 3.0)) + Float64(-0.5 / Float64(x * x)))) / n)); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-26], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-92], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], N[(N[(N[Log[x], $MachinePrecision] / N[(x * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 / x), $MachinePrecision] + N[(N[(0.3333333333333333 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-26}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-92}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{\log x}{x \cdot \left(n \cdot n\right)} + \frac{\frac{1}{x} + \left(\frac{0.3333333333333333}{{x}^{3}} + \frac{-0.5}{x \cdot x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.0000000000000002e-26Initial program 93.8%
Taylor expanded in x around inf 98.4%
mul-1-neg98.4%
log-rec98.4%
distribute-frac-neg98.4%
remove-double-neg98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in x around 0 98.4%
remove-double-neg98.4%
distribute-frac-neg98.4%
*-commutative98.4%
rem-exp-log45.6%
log-div0.0%
exp-diff0.0%
distribute-frac-neg0.0%
remove-double-neg0.0%
rem-log-exp0.0%
*-rgt-identity0.0%
associate-*r/0.0%
*-commutative0.0%
log-pow0.0%
exp-diff0.0%
Simplified98.4%
if -4.0000000000000002e-26 < (/.f64 1 n) < 1.99999999999999998e-92Initial program 32.5%
Taylor expanded in n around inf 83.9%
+-rgt-identity83.9%
+-rgt-identity83.9%
log1p-def83.9%
Simplified83.9%
if 1.99999999999999998e-92 < (/.f64 1 n) < 2e-8Initial program 7.0%
Taylor expanded in n around inf 41.9%
fma-def41.9%
log1p-def41.9%
unpow241.9%
log1p-def41.9%
fma-def41.9%
unpow241.9%
Simplified41.9%
Taylor expanded in x around inf 67.2%
Simplified67.2%
Taylor expanded in n around inf 67.1%
sub-neg67.1%
+-commutative67.1%
associate-*r/67.1%
metadata-eval67.1%
distribute-neg-frac67.1%
metadata-eval67.1%
associate-+l+67.1%
associate-*r/67.1%
metadata-eval67.1%
unpow267.1%
Simplified67.1%
if 2e-8 < (/.f64 1 n) Initial program 43.5%
add-cbrt-cube43.5%
pow343.5%
pow-to-exp43.5%
pow-exp43.5%
un-div-inv43.5%
+-commutative43.5%
log1p-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 99.8%
*-commutative99.8%
exp-prod99.7%
unpow1/399.7%
rem-cbrt-cube99.8%
Simplified99.8%
Final simplification90.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-26)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-92)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 2e-8)
(+ (/ (exp (/ (log x) n)) (* n x)) (/ -0.5 (* n (* x x))))
(- (exp (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-26) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-92) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 2e-8) {
tmp = (exp((log(x) / n)) / (n * x)) + (-0.5 / (n * (x * x)));
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-26) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-92) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 2e-8) {
tmp = (Math.exp((Math.log(x) / n)) / (n * x)) + (-0.5 / (n * (x * x)));
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-26: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-92: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 2e-8: tmp = (math.exp((math.log(x) / n)) / (n * x)) + (-0.5 / (n * (x * x))) else: tmp = math.exp((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) <= -4e-26) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-92) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 2e-8) tmp = Float64(Float64(exp(Float64(log(x) / n)) / Float64(n * x)) + Float64(-0.5 / Float64(n * Float64(x * x)))); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-26], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-92], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], N[(N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / N[(n * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-26}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-92}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{n \cdot x} + \frac{-0.5}{n \cdot \left(x \cdot x\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.0000000000000002e-26Initial program 93.8%
Taylor expanded in x around inf 98.4%
mul-1-neg98.4%
log-rec98.4%
distribute-frac-neg98.4%
remove-double-neg98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in x around 0 98.4%
remove-double-neg98.4%
distribute-frac-neg98.4%
*-commutative98.4%
rem-exp-log45.6%
log-div0.0%
exp-diff0.0%
distribute-frac-neg0.0%
remove-double-neg0.0%
rem-log-exp0.0%
*-rgt-identity0.0%
associate-*r/0.0%
*-commutative0.0%
log-pow0.0%
exp-diff0.0%
Simplified98.4%
if -4.0000000000000002e-26 < (/.f64 1 n) < 1.99999999999999998e-92Initial program 32.5%
Taylor expanded in n around inf 83.9%
+-rgt-identity83.9%
+-rgt-identity83.9%
log1p-def83.9%
Simplified83.9%
if 1.99999999999999998e-92 < (/.f64 1 n) < 2e-8Initial program 7.0%
Taylor expanded in x around inf 67.1%
mul-1-neg67.1%
log-rec67.1%
*-commutative67.1%
associate-/l*67.1%
mul-1-neg67.1%
log-rec67.1%
unpow267.1%
associate-*r/67.1%
metadata-eval67.1%
unpow267.1%
associate-*r/67.1%
metadata-eval67.1%
Simplified67.1%
Taylor expanded in n around inf 67.1%
unpow267.1%
Simplified67.1%
if 2e-8 < (/.f64 1 n) Initial program 43.5%
add-cbrt-cube43.5%
pow343.5%
pow-to-exp43.5%
pow-exp43.5%
un-div-inv43.5%
+-commutative43.5%
log1p-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 99.8%
*-commutative99.8%
exp-prod99.7%
unpow1/399.7%
rem-cbrt-cube99.8%
Simplified99.8%
Final simplification90.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (- (log1p x) (log x)) n)))
(if (<= (/ 1.0 n) -4e-26)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-92)
t_1
(if (<= (/ 1.0 n) 5e-43)
(* (/ 1.0 n) (/ 1.0 x))
(if (<= (/ 1.0 n) 2e-8)
t_1
(if (<= (/ 1.0 n) 5e+145)
(- (+ 1.0 (/ x n)) t_0)
(log1p (expm1 (/ (/ 1.0 x) n))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (log1p(x) - log(x)) / n;
double tmp;
if ((1.0 / n) <= -4e-26) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-92) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-43) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= 2e-8) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+145) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = log1p(expm1(((1.0 / x) / n)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = (Math.log1p(x) - Math.log(x)) / n;
double tmp;
if ((1.0 / n) <= -4e-26) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-92) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-43) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= 2e-8) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+145) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.log1p(Math.expm1(((1.0 / x) / n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (math.log1p(x) - math.log(x)) / n tmp = 0 if (1.0 / n) <= -4e-26: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-92: tmp = t_1 elif (1.0 / n) <= 5e-43: tmp = (1.0 / n) * (1.0 / x) elif (1.0 / n) <= 2e-8: tmp = t_1 elif (1.0 / n) <= 5e+145: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.log1p(math.expm1(((1.0 / x) / n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(log1p(x) - log(x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-26) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-92) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-43) tmp = Float64(Float64(1.0 / n) * Float64(1.0 / x)); elseif (Float64(1.0 / n) <= 2e-8) tmp = t_1; elseif (Float64(1.0 / n) <= 5e+145) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = log1p(expm1(Float64(Float64(1.0 / x) / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-26], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-92], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-43], N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+145], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[1 + N[(Exp[N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-26}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-92}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-43}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+145}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.0000000000000002e-26Initial program 93.8%
Taylor expanded in x around inf 98.4%
mul-1-neg98.4%
log-rec98.4%
distribute-frac-neg98.4%
remove-double-neg98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in x around 0 98.4%
remove-double-neg98.4%
distribute-frac-neg98.4%
*-commutative98.4%
rem-exp-log45.6%
log-div0.0%
exp-diff0.0%
distribute-frac-neg0.0%
remove-double-neg0.0%
rem-log-exp0.0%
*-rgt-identity0.0%
associate-*r/0.0%
*-commutative0.0%
log-pow0.0%
exp-diff0.0%
Simplified98.4%
if -4.0000000000000002e-26 < (/.f64 1 n) < 1.99999999999999998e-92 or 5.00000000000000019e-43 < (/.f64 1 n) < 2e-8Initial program 31.0%
Taylor expanded in n around inf 82.1%
+-rgt-identity82.1%
+-rgt-identity82.1%
log1p-def82.1%
Simplified82.1%
if 1.99999999999999998e-92 < (/.f64 1 n) < 5.00000000000000019e-43Initial program 5.5%
Taylor expanded in x around inf 80.9%
mul-1-neg80.9%
log-rec80.9%
distribute-frac-neg80.9%
remove-double-neg80.9%
*-commutative80.9%
Simplified80.9%
Taylor expanded in n around inf 80.9%
*-commutative80.9%
Simplified80.9%
associate-/r*81.1%
div-inv81.3%
Applied egg-rr81.3%
if 2e-8 < (/.f64 1 n) < 4.99999999999999967e145Initial program 81.6%
Taylor expanded in x around 0 78.5%
if 4.99999999999999967e145 < (/.f64 1 n) Initial program 16.1%
Taylor expanded in x around inf 0.5%
mul-1-neg0.5%
log-rec0.5%
distribute-frac-neg0.5%
remove-double-neg0.5%
*-commutative0.5%
Simplified0.5%
Taylor expanded in n around inf 58.4%
*-commutative58.4%
Simplified58.4%
log1p-expm1-u84.5%
associate-/r*84.5%
Applied egg-rr84.5%
Final simplification87.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log x)) n))
(t_1 (log1p (expm1 (/ (/ 1.0 x) n))))
(t_2 (/ (/ 1.0 n) x)))
(if (<= x 7.8e-171)
t_0
(if (<= x 5e-118)
(cbrt (* t_2 (* t_2 t_2)))
(if (<= x 7e-91)
t_0
(if (<= x 5.5e-55)
t_1
(if (<= x 1.6e-34)
t_0
(if (<= x 1.0) t_1 (/ (pow x (/ 1.0 n)) (* n x))))))))))
double code(double x, double n) {
double t_0 = -log(x) / n;
double t_1 = log1p(expm1(((1.0 / x) / n)));
double t_2 = (1.0 / n) / x;
double tmp;
if (x <= 7.8e-171) {
tmp = t_0;
} else if (x <= 5e-118) {
tmp = cbrt((t_2 * (t_2 * t_2)));
} else if (x <= 7e-91) {
tmp = t_0;
} else if (x <= 5.5e-55) {
tmp = t_1;
} else if (x <= 1.6e-34) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = t_1;
} else {
tmp = pow(x, (1.0 / n)) / (n * x);
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = -Math.log(x) / n;
double t_1 = Math.log1p(Math.expm1(((1.0 / x) / n)));
double t_2 = (1.0 / n) / x;
double tmp;
if (x <= 7.8e-171) {
tmp = t_0;
} else if (x <= 5e-118) {
tmp = Math.cbrt((t_2 * (t_2 * t_2)));
} else if (x <= 7e-91) {
tmp = t_0;
} else if (x <= 5.5e-55) {
tmp = t_1;
} else if (x <= 1.6e-34) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = t_1;
} else {
tmp = Math.pow(x, (1.0 / n)) / (n * x);
}
return tmp;
}
function code(x, n) t_0 = Float64(Float64(-log(x)) / n) t_1 = log1p(expm1(Float64(Float64(1.0 / x) / n))) t_2 = Float64(Float64(1.0 / n) / x) tmp = 0.0 if (x <= 7.8e-171) tmp = t_0; elseif (x <= 5e-118) tmp = cbrt(Float64(t_2 * Float64(t_2 * t_2))); elseif (x <= 7e-91) tmp = t_0; elseif (x <= 5.5e-55) tmp = t_1; elseif (x <= 1.6e-34) tmp = t_0; elseif (x <= 1.0) tmp = t_1; else tmp = Float64((x ^ Float64(1.0 / n)) / Float64(n * x)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, Block[{t$95$1 = N[Log[1 + N[(Exp[N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, 7.8e-171], t$95$0, If[LessEqual[x, 5e-118], N[Power[N[(t$95$2 * N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], If[LessEqual[x, 7e-91], t$95$0, If[LessEqual[x, 5.5e-55], t$95$1, If[LessEqual[x, 1.6e-34], t$95$0, If[LessEqual[x, 1.0], t$95$1, N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
t_1 := \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\
t_2 := \frac{\frac{1}{n}}{x}\\
\mathbf{if}\;x \leq 7.8 \cdot 10^{-171}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-118}:\\
\;\;\;\;\sqrt[3]{t_2 \cdot \left(t_2 \cdot t_2\right)}\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-91}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-34}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\
\end{array}
\end{array}
if x < 7.7999999999999997e-171 or 5.00000000000000015e-118 < x < 6.9999999999999997e-91 or 5.4999999999999999e-55 < x < 1.60000000000000001e-34Initial program 34.6%
Taylor expanded in x around 0 34.6%
Taylor expanded in n around inf 61.4%
mul-1-neg61.4%
distribute-frac-neg61.4%
Simplified61.4%
if 7.7999999999999997e-171 < x < 5.00000000000000015e-118Initial program 61.5%
Taylor expanded in n around inf 26.3%
fma-def26.3%
log1p-def26.3%
unpow226.3%
log1p-def26.3%
fma-def26.3%
unpow226.3%
Simplified26.3%
Taylor expanded in x around inf 37.2%
+-commutative37.2%
associate-*r/37.2%
neg-mul-137.2%
log-rec37.2%
remove-double-neg37.2%
unpow237.2%
Simplified37.2%
Taylor expanded in n around inf 43.6%
add-cbrt-cube71.3%
Applied egg-rr71.3%
if 6.9999999999999997e-91 < x < 5.4999999999999999e-55 or 1.60000000000000001e-34 < x < 1Initial program 42.5%
Taylor expanded in x around inf 32.6%
mul-1-neg32.6%
log-rec32.6%
distribute-frac-neg32.6%
remove-double-neg32.6%
*-commutative32.6%
Simplified32.6%
Taylor expanded in n around inf 15.1%
*-commutative15.1%
Simplified15.1%
log1p-expm1-u67.5%
associate-/r*67.5%
Applied egg-rr67.5%
if 1 < x Initial program 68.0%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
distribute-frac-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
remove-double-neg96.5%
distribute-frac-neg96.5%
*-commutative96.5%
rem-exp-log82.8%
log-div35.9%
exp-diff35.9%
distribute-frac-neg35.9%
remove-double-neg35.9%
rem-log-exp35.9%
*-rgt-identity35.9%
associate-*r/35.9%
*-commutative35.9%
log-pow35.9%
exp-diff35.9%
Simplified96.5%
Final simplification77.6%
(FPCore (x n) :precision binary64 (if (or (<= n -115000.0) (not (<= n 85000000.0))) (/ (- (log1p x) (log x)) n) (- (exp (/ x n)) (pow x (/ 1.0 n)))))
double code(double x, double n) {
double tmp;
if ((n <= -115000.0) || !(n <= 85000000.0)) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = exp((x / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((n <= -115000.0) || !(n <= 85000000.0)) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): tmp = 0 if (n <= -115000.0) or not (n <= 85000000.0): tmp = (math.log1p(x) - math.log(x)) / n else: tmp = math.exp((x / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) tmp = 0.0 if ((n <= -115000.0) || !(n <= 85000000.0)) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := If[Or[LessEqual[n, -115000.0], N[Not[LessEqual[n, 85000000.0]], $MachinePrecision]], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -115000 \lor \neg \left(n \leq 85000000\right):\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if n < -115000 or 8.5e7 < n Initial program 29.0%
Taylor expanded in n around inf 76.3%
+-rgt-identity76.3%
+-rgt-identity76.3%
log1p-def76.3%
Simplified76.3%
if -115000 < n < 8.5e7Initial program 79.1%
add-cbrt-cube79.1%
pow379.1%
pow-to-exp79.1%
pow-exp79.1%
un-div-inv79.1%
+-commutative79.1%
log1p-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 99.9%
*-commutative99.9%
exp-prod99.9%
unpow1/399.9%
rem-cbrt-cube99.9%
Simplified99.9%
Final simplification87.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log x)) n))
(t_1 (/ (/ 1.0 n) x))
(t_2 (cbrt (* t_1 (* t_1 t_1)))))
(if (<= x 7.8e-171)
t_0
(if (<= x 2.85e-118)
t_2
(if (<= x 7e-91)
t_0
(if (<= x 8.2e-69)
t_2
(if (<= x 0.0145)
(/ (- x (log x)) n)
(/ (pow x (/ 1.0 n)) (* n x)))))))))
double code(double x, double n) {
double t_0 = -log(x) / n;
double t_1 = (1.0 / n) / x;
double t_2 = cbrt((t_1 * (t_1 * t_1)));
double tmp;
if (x <= 7.8e-171) {
tmp = t_0;
} else if (x <= 2.85e-118) {
tmp = t_2;
} else if (x <= 7e-91) {
tmp = t_0;
} else if (x <= 8.2e-69) {
tmp = t_2;
} else if (x <= 0.0145) {
tmp = (x - log(x)) / n;
} else {
tmp = pow(x, (1.0 / n)) / (n * x);
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = -Math.log(x) / n;
double t_1 = (1.0 / n) / x;
double t_2 = Math.cbrt((t_1 * (t_1 * t_1)));
double tmp;
if (x <= 7.8e-171) {
tmp = t_0;
} else if (x <= 2.85e-118) {
tmp = t_2;
} else if (x <= 7e-91) {
tmp = t_0;
} else if (x <= 8.2e-69) {
tmp = t_2;
} else if (x <= 0.0145) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = Math.pow(x, (1.0 / n)) / (n * x);
}
return tmp;
}
function code(x, n) t_0 = Float64(Float64(-log(x)) / n) t_1 = Float64(Float64(1.0 / n) / x) t_2 = cbrt(Float64(t_1 * Float64(t_1 * t_1))) tmp = 0.0 if (x <= 7.8e-171) tmp = t_0; elseif (x <= 2.85e-118) tmp = t_2; elseif (x <= 7e-91) tmp = t_0; elseif (x <= 8.2e-69) tmp = t_2; elseif (x <= 0.0145) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64((x ^ Float64(1.0 / n)) / Float64(n * x)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(t$95$1 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[x, 7.8e-171], t$95$0, If[LessEqual[x, 2.85e-118], t$95$2, If[LessEqual[x, 7e-91], t$95$0, If[LessEqual[x, 8.2e-69], t$95$2, If[LessEqual[x, 0.0145], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
t_1 := \frac{\frac{1}{n}}{x}\\
t_2 := \sqrt[3]{t_1 \cdot \left(t_1 \cdot t_1\right)}\\
\mathbf{if}\;x \leq 7.8 \cdot 10^{-171}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.85 \cdot 10^{-118}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-91}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-69}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 0.0145:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\
\end{array}
\end{array}
if x < 7.7999999999999997e-171 or 2.85000000000000006e-118 < x < 6.9999999999999997e-91Initial program 37.3%
Taylor expanded in x around 0 37.3%
Taylor expanded in n around inf 58.6%
mul-1-neg58.6%
distribute-frac-neg58.6%
Simplified58.6%
if 7.7999999999999997e-171 < x < 2.85000000000000006e-118 or 6.9999999999999997e-91 < x < 8.1999999999999998e-69Initial program 53.4%
Taylor expanded in n around inf 25.5%
fma-def25.5%
log1p-def25.5%
unpow225.5%
log1p-def25.5%
fma-def25.5%
unpow225.5%
Simplified25.5%
Taylor expanded in x around inf 29.5%
+-commutative29.5%
associate-*r/29.5%
neg-mul-129.5%
log-rec29.5%
remove-double-neg29.5%
unpow229.5%
Simplified29.5%
Taylor expanded in n around inf 34.4%
add-cbrt-cube68.4%
Applied egg-rr68.4%
if 8.1999999999999998e-69 < x < 0.0145000000000000007Initial program 33.1%
add-cbrt-cube33.1%
pow333.1%
pow-to-exp33.1%
pow-exp33.1%
un-div-inv33.1%
+-commutative33.1%
log1p-udef52.5%
Applied egg-rr52.5%
Taylor expanded in x around 0 52.5%
*-commutative52.5%
Simplified52.5%
Taylor expanded in n around inf 54.9%
if 0.0145000000000000007 < x Initial program 68.0%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
distribute-frac-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
remove-double-neg96.5%
distribute-frac-neg96.5%
*-commutative96.5%
rem-exp-log82.8%
log-div35.9%
exp-diff35.9%
distribute-frac-neg35.9%
remove-double-neg35.9%
rem-log-exp35.9%
*-rgt-identity35.9%
associate-*r/35.9%
*-commutative35.9%
log-pow35.9%
exp-diff35.9%
Simplified96.5%
Final simplification75.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 1.85e-170)
(/ (- (log x)) n)
(if (<= x 4e-148)
(- 1.0 t_0)
(if (<= x 0.00156) (/ (- x (log x)) n) (/ t_0 (* n x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 1.85e-170) {
tmp = -log(x) / n;
} else if (x <= 4e-148) {
tmp = 1.0 - t_0;
} else if (x <= 0.00156) {
tmp = (x - log(x)) / n;
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= 1.85d-170) then
tmp = -log(x) / n
else if (x <= 4d-148) then
tmp = 1.0d0 - t_0
else if (x <= 0.00156d0) then
tmp = (x - log(x)) / n
else
tmp = t_0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 1.85e-170) {
tmp = -Math.log(x) / n;
} else if (x <= 4e-148) {
tmp = 1.0 - t_0;
} else if (x <= 0.00156) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 1.85e-170: tmp = -math.log(x) / n elif x <= 4e-148: tmp = 1.0 - t_0 elif x <= 0.00156: tmp = (x - math.log(x)) / n else: tmp = t_0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 1.85e-170) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 4e-148) tmp = Float64(1.0 - t_0); elseif (x <= 0.00156) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(t_0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= 1.85e-170) tmp = -log(x) / n; elseif (x <= 4e-148) tmp = 1.0 - t_0; elseif (x <= 0.00156) tmp = (x - log(x)) / n; else tmp = t_0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.85e-170], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 4e-148], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[x, 0.00156], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 1.85 \cdot 10^{-170}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-148}:\\
\;\;\;\;1 - t_0\\
\mathbf{elif}\;x \leq 0.00156:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\end{array}
\end{array}
if x < 1.85e-170Initial program 40.2%
Taylor expanded in x around 0 40.2%
Taylor expanded in n around inf 56.1%
mul-1-neg56.1%
distribute-frac-neg56.1%
Simplified56.1%
if 1.85e-170 < x < 3.99999999999999974e-148Initial program 80.6%
Taylor expanded in x around 0 80.6%
if 3.99999999999999974e-148 < x < 0.00155999999999999997Initial program 33.1%
add-cbrt-cube33.1%
pow333.1%
pow-to-exp33.1%
pow-exp33.1%
un-div-inv33.1%
+-commutative33.1%
log1p-udef55.6%
Applied egg-rr55.6%
Taylor expanded in x around 0 55.6%
*-commutative55.6%
Simplified55.6%
Taylor expanded in n around inf 50.8%
if 0.00155999999999999997 < x Initial program 68.0%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
distribute-frac-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
remove-double-neg96.5%
distribute-frac-neg96.5%
*-commutative96.5%
rem-exp-log82.8%
log-div35.9%
exp-diff35.9%
distribute-frac-neg35.9%
remove-double-neg35.9%
rem-log-exp35.9%
*-rgt-identity35.9%
associate-*r/35.9%
*-commutative35.9%
log-pow35.9%
exp-diff35.9%
Simplified96.5%
Final simplification72.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 4.5e-171)
(/ (- (log x)) n)
(if (<= x 4.4e-148)
(- (+ 1.0 (/ x n)) t_0)
(if (<= x 0.00031) (/ (- x (log x)) n) (/ t_0 (* n x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 4.5e-171) {
tmp = -log(x) / n;
} else if (x <= 4.4e-148) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.00031) {
tmp = (x - log(x)) / n;
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= 4.5d-171) then
tmp = -log(x) / n
else if (x <= 4.4d-148) then
tmp = (1.0d0 + (x / n)) - t_0
else if (x <= 0.00031d0) then
tmp = (x - log(x)) / n
else
tmp = t_0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 4.5e-171) {
tmp = -Math.log(x) / n;
} else if (x <= 4.4e-148) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.00031) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 4.5e-171: tmp = -math.log(x) / n elif x <= 4.4e-148: tmp = (1.0 + (x / n)) - t_0 elif x <= 0.00031: tmp = (x - math.log(x)) / n else: tmp = t_0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 4.5e-171) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 4.4e-148) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); elseif (x <= 0.00031) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(t_0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= 4.5e-171) tmp = -log(x) / n; elseif (x <= 4.4e-148) tmp = (1.0 + (x / n)) - t_0; elseif (x <= 0.00031) tmp = (x - log(x)) / n; else tmp = t_0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 4.5e-171], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 4.4e-148], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 0.00031], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 4.5 \cdot 10^{-171}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{-148}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{elif}\;x \leq 0.00031:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\end{array}
\end{array}
if x < 4.5000000000000004e-171Initial program 40.2%
Taylor expanded in x around 0 40.2%
Taylor expanded in n around inf 56.1%
mul-1-neg56.1%
distribute-frac-neg56.1%
Simplified56.1%
if 4.5000000000000004e-171 < x < 4.40000000000000034e-148Initial program 80.6%
Taylor expanded in x around 0 80.7%
if 4.40000000000000034e-148 < x < 3.1e-4Initial program 33.1%
add-cbrt-cube33.1%
pow333.1%
pow-to-exp33.1%
pow-exp33.1%
un-div-inv33.1%
+-commutative33.1%
log1p-udef55.6%
Applied egg-rr55.6%
Taylor expanded in x around 0 55.6%
*-commutative55.6%
Simplified55.6%
Taylor expanded in n around inf 50.8%
if 3.1e-4 < x Initial program 68.0%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
distribute-frac-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
remove-double-neg96.5%
distribute-frac-neg96.5%
*-commutative96.5%
rem-exp-log82.8%
log-div35.9%
exp-diff35.9%
distribute-frac-neg35.9%
remove-double-neg35.9%
rem-log-exp35.9%
*-rgt-identity35.9%
associate-*r/35.9%
*-commutative35.9%
log-pow35.9%
exp-diff35.9%
Simplified96.5%
Final simplification72.7%
(FPCore (x n)
:precision binary64
(if (<= x 6.5e-170)
(/ (- (log x)) n)
(if (<= x 4e-148)
(/ 1.0 (* n x))
(if (<= x 0.00024) (/ (- x (log x)) n) (/ (/ 1.0 x) n)))))
double code(double x, double n) {
double tmp;
if (x <= 6.5e-170) {
tmp = -log(x) / n;
} else if (x <= 4e-148) {
tmp = 1.0 / (n * x);
} else if (x <= 0.00024) {
tmp = (x - log(x)) / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 6.5d-170) then
tmp = -log(x) / n
else if (x <= 4d-148) then
tmp = 1.0d0 / (n * x)
else if (x <= 0.00024d0) then
tmp = (x - log(x)) / n
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 6.5e-170) {
tmp = -Math.log(x) / n;
} else if (x <= 4e-148) {
tmp = 1.0 / (n * x);
} else if (x <= 0.00024) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 6.5e-170: tmp = -math.log(x) / n elif x <= 4e-148: tmp = 1.0 / (n * x) elif x <= 0.00024: tmp = (x - math.log(x)) / n else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 6.5e-170) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 4e-148) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 0.00024) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 6.5e-170) tmp = -log(x) / n; elseif (x <= 4e-148) tmp = 1.0 / (n * x); elseif (x <= 0.00024) tmp = (x - log(x)) / n; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 6.5e-170], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 4e-148], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.00024], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{-170}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-148}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 0.00024:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 6.50000000000000035e-170Initial program 40.2%
Taylor expanded in x around 0 40.2%
Taylor expanded in n around inf 56.1%
mul-1-neg56.1%
distribute-frac-neg56.1%
Simplified56.1%
if 6.50000000000000035e-170 < x < 3.99999999999999974e-148Initial program 80.6%
Taylor expanded in x around inf 70.3%
mul-1-neg70.3%
log-rec70.3%
distribute-frac-neg70.3%
remove-double-neg70.3%
*-commutative70.3%
Simplified70.3%
Taylor expanded in n around inf 62.6%
*-commutative62.6%
Simplified62.6%
if 3.99999999999999974e-148 < x < 2.40000000000000006e-4Initial program 32.0%
add-cbrt-cube32.0%
pow332.0%
pow-to-exp32.0%
pow-exp32.0%
un-div-inv32.0%
+-commutative32.0%
log1p-udef54.9%
Applied egg-rr54.9%
Taylor expanded in x around 0 54.9%
*-commutative54.9%
Simplified54.9%
Taylor expanded in n around inf 51.6%
if 2.40000000000000006e-4 < x Initial program 68.3%
Taylor expanded in x around inf 95.6%
mul-1-neg95.6%
log-rec95.6%
distribute-frac-neg95.6%
remove-double-neg95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in n around inf 62.2%
*-commutative62.2%
associate-/r*63.6%
Simplified63.6%
Final simplification58.4%
(FPCore (x n)
:precision binary64
(if (<= x 2.35e-170)
(/ (- (log x)) n)
(if (<= x 4.2e-148)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.00024) (/ (- x (log x)) n) (/ (/ 1.0 x) n)))))
double code(double x, double n) {
double tmp;
if (x <= 2.35e-170) {
tmp = -log(x) / n;
} else if (x <= 4.2e-148) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.00024) {
tmp = (x - log(x)) / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2.35d-170) then
tmp = -log(x) / n
else if (x <= 4.2d-148) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.00024d0) then
tmp = (x - log(x)) / n
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.35e-170) {
tmp = -Math.log(x) / n;
} else if (x <= 4.2e-148) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.00024) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.35e-170: tmp = -math.log(x) / n elif x <= 4.2e-148: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.00024: tmp = (x - math.log(x)) / n else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 2.35e-170) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 4.2e-148) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.00024) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.35e-170) tmp = -log(x) / n; elseif (x <= 4.2e-148) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.00024) tmp = (x - log(x)) / n; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.35e-170], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 4.2e-148], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.00024], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.35 \cdot 10^{-170}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-148}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.00024:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 2.3500000000000001e-170Initial program 40.2%
Taylor expanded in x around 0 40.2%
Taylor expanded in n around inf 56.1%
mul-1-neg56.1%
distribute-frac-neg56.1%
Simplified56.1%
if 2.3500000000000001e-170 < x < 4.2e-148Initial program 80.6%
Taylor expanded in x around 0 80.6%
if 4.2e-148 < x < 2.40000000000000006e-4Initial program 32.0%
add-cbrt-cube32.0%
pow332.0%
pow-to-exp32.0%
pow-exp32.0%
un-div-inv32.0%
+-commutative32.0%
log1p-udef54.9%
Applied egg-rr54.9%
Taylor expanded in x around 0 54.9%
*-commutative54.9%
Simplified54.9%
Taylor expanded in n around inf 51.6%
if 2.40000000000000006e-4 < x Initial program 68.3%
Taylor expanded in x around inf 95.6%
mul-1-neg95.6%
log-rec95.6%
distribute-frac-neg95.6%
remove-double-neg95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in n around inf 62.2%
*-commutative62.2%
associate-/r*63.6%
Simplified63.6%
Final simplification59.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log x)) n)))
(if (<= x 7.5e-170)
t_0
(if (<= x 4e-148)
(/ 1.0 (* n x))
(if (<= x 0.00024) t_0 (/ (/ 1.0 x) n))))))
double code(double x, double n) {
double t_0 = -log(x) / n;
double tmp;
if (x <= 7.5e-170) {
tmp = t_0;
} else if (x <= 4e-148) {
tmp = 1.0 / (n * x);
} else if (x <= 0.00024) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = -log(x) / n
if (x <= 7.5d-170) then
tmp = t_0
else if (x <= 4d-148) then
tmp = 1.0d0 / (n * x)
else if (x <= 0.00024d0) then
tmp = t_0
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = -Math.log(x) / n;
double tmp;
if (x <= 7.5e-170) {
tmp = t_0;
} else if (x <= 4e-148) {
tmp = 1.0 / (n * x);
} else if (x <= 0.00024) {
tmp = t_0;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): t_0 = -math.log(x) / n tmp = 0 if x <= 7.5e-170: tmp = t_0 elif x <= 4e-148: tmp = 1.0 / (n * x) elif x <= 0.00024: tmp = t_0 else: tmp = (1.0 / x) / n return tmp
function code(x, n) t_0 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 7.5e-170) tmp = t_0; elseif (x <= 4e-148) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 0.00024) tmp = t_0; else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = -log(x) / n; tmp = 0.0; if (x <= 7.5e-170) tmp = t_0; elseif (x <= 4e-148) tmp = 1.0 / (n * x); elseif (x <= 0.00024) tmp = t_0; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 7.5e-170], t$95$0, If[LessEqual[x, 4e-148], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.00024], t$95$0, N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 7.5 \cdot 10^{-170}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-148}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 0.00024:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 7.4999999999999998e-170 or 3.99999999999999974e-148 < x < 2.40000000000000006e-4Initial program 36.6%
Taylor expanded in x around 0 35.9%
Taylor expanded in n around inf 53.4%
mul-1-neg53.4%
distribute-frac-neg53.4%
Simplified53.4%
if 7.4999999999999998e-170 < x < 3.99999999999999974e-148Initial program 80.6%
Taylor expanded in x around inf 70.3%
mul-1-neg70.3%
log-rec70.3%
distribute-frac-neg70.3%
remove-double-neg70.3%
*-commutative70.3%
Simplified70.3%
Taylor expanded in n around inf 62.6%
*-commutative62.6%
Simplified62.6%
if 2.40000000000000006e-4 < x Initial program 68.3%
Taylor expanded in x around inf 95.6%
mul-1-neg95.6%
log-rec95.6%
distribute-frac-neg95.6%
remove-double-neg95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in n around inf 62.2%
*-commutative62.2%
associate-/r*63.6%
Simplified63.6%
Final simplification58.1%
(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(1.0 / Float64(n * x)) end
function tmp = code(x, n) tmp = 1.0 / (n * x); end
code[x_, n_] := N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n \cdot x}
\end{array}
Initial program 51.7%
Taylor expanded in x around inf 56.4%
mul-1-neg56.4%
log-rec56.4%
distribute-frac-neg56.4%
remove-double-neg56.4%
*-commutative56.4%
Simplified56.4%
Taylor expanded in n around inf 41.5%
*-commutative41.5%
Simplified41.5%
Final simplification41.5%
(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.7%
Taylor expanded in n around inf 49.0%
fma-def49.0%
log1p-def49.0%
unpow249.0%
log1p-def49.0%
fma-def49.0%
unpow249.0%
Simplified49.0%
Taylor expanded in x around inf 39.7%
+-commutative39.7%
associate-*r/39.7%
neg-mul-139.7%
log-rec39.7%
remove-double-neg39.7%
unpow239.7%
Simplified39.7%
Taylor expanded in n around inf 42.1%
Final simplification42.1%
(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(Float64(1.0 / x) / n) end
function tmp = code(x, n) tmp = (1.0 / x) / n; end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{n}
\end{array}
Initial program 51.7%
Taylor expanded in x around inf 56.4%
mul-1-neg56.4%
log-rec56.4%
distribute-frac-neg56.4%
remove-double-neg56.4%
*-commutative56.4%
Simplified56.4%
Taylor expanded in n around inf 41.5%
*-commutative41.5%
associate-/r*42.1%
Simplified42.1%
Final simplification42.1%
(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.7%
Taylor expanded in x around 0 30.8%
Taylor expanded in x around inf 4.4%
Final simplification4.4%
herbie shell --seed 2023293
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))