
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(if (<= x 3.0)
(/
(-
(+
(log1p x)
(/
(+
(* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0)))
(*
0.16666666666666666
(/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n)))
n))
(log x))
n)
(/ (exp (/ (log x) n)) (* x n))))
double code(double x, double n) {
double tmp;
if (x <= 3.0) {
tmp = ((log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) + (0.16666666666666666 * ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n))) / n)) - log(x)) / n;
} else {
tmp = exp((log(x) / n)) / (x * n);
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (x <= 3.0) {
tmp = ((Math.log1p(x) + (((0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) + (0.16666666666666666 * ((Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0)) / n))) / n)) - Math.log(x)) / n;
} else {
tmp = Math.exp((Math.log(x) / n)) / (x * n);
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 3.0: tmp = ((math.log1p(x) + (((0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0))) + (0.16666666666666666 * ((math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0)) / n))) / n)) - math.log(x)) / n else: tmp = math.exp((math.log(x) / n)) / (x * n) return tmp
function code(x, n) tmp = 0.0 if (x <= 3.0) tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) + Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n))) / n)) - log(x)) / n); else tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n)); end return tmp end
code[x_, n_] := If[LessEqual[x, 3.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] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\end{array}
\end{array}
if x < 3Initial program 41.6%
Taylor expanded in n around -inf 78.3%
Simplified78.3%
if 3 < x Initial program 65.0%
Taylor expanded in x around inf 96.8%
mul-1-neg96.8%
log-rec96.8%
mul-1-neg96.8%
distribute-neg-frac96.8%
mul-1-neg96.8%
remove-double-neg96.8%
*-commutative96.8%
Simplified96.8%
Final simplification86.3%
(FPCore (x n)
:precision binary64
(if (<= x 0.68)
(/
(-
(/
(+
(* -0.16666666666666666 (/ (pow (log x) 3.0) n))
(* (pow (log x) 2.0) -0.5))
n)
(log x))
n)
(/ (exp (/ (log x) n)) (* x n))))
double code(double x, double n) {
double tmp;
if (x <= 0.68) {
tmp = ((((-0.16666666666666666 * (pow(log(x), 3.0) / n)) + (pow(log(x), 2.0) * -0.5)) / n) - log(x)) / n;
} else {
tmp = exp((log(x) / n)) / (x * n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.68d0) then
tmp = (((((-0.16666666666666666d0) * ((log(x) ** 3.0d0) / n)) + ((log(x) ** 2.0d0) * (-0.5d0))) / n) - log(x)) / n
else
tmp = exp((log(x) / n)) / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.68) {
tmp = ((((-0.16666666666666666 * (Math.pow(Math.log(x), 3.0) / n)) + (Math.pow(Math.log(x), 2.0) * -0.5)) / n) - Math.log(x)) / n;
} else {
tmp = Math.exp((Math.log(x) / n)) / (x * n);
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.68: tmp = ((((-0.16666666666666666 * (math.pow(math.log(x), 3.0) / n)) + (math.pow(math.log(x), 2.0) * -0.5)) / n) - math.log(x)) / n else: tmp = math.exp((math.log(x) / n)) / (x * n) return tmp
function code(x, n) tmp = 0.0 if (x <= 0.68) tmp = Float64(Float64(Float64(Float64(Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) / n)) + Float64((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n); else tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.68) tmp = ((((-0.16666666666666666 * ((log(x) ^ 3.0) / n)) + ((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n; else tmp = exp((log(x) / n)) / (x * n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.68], N[(N[(N[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.68:\\
\;\;\;\;\frac{\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} + {\log x}^{2} \cdot -0.5}{n} - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\end{array}
\end{array}
if x < 0.680000000000000049Initial program 41.8%
Taylor expanded in x around 0 41.8%
*-rgt-identity41.8%
associate-/l*41.8%
exp-to-pow41.8%
Simplified41.8%
Taylor expanded in n around -inf 77.1%
mul-1-neg77.1%
Simplified77.1%
if 0.680000000000000049 < x Initial program 64.4%
Taylor expanded in x around inf 96.1%
mul-1-neg96.1%
log-rec96.1%
mul-1-neg96.1%
distribute-neg-frac96.1%
mul-1-neg96.1%
remove-double-neg96.1%
*-commutative96.1%
Simplified96.1%
Final simplification85.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1.05e-11)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 5e-12)
(/ (log (+ 1.0 (/ 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) <= -1.05e-11) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 5e-12) {
tmp = log((1.0 + (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) <= -1.05e-11) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 5e-12) {
tmp = Math.log((1.0 + (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) <= -1.05e-11: tmp = t_0 / (x * n) elif (1.0 / n) <= 5e-12: tmp = math.log((1.0 + (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) <= -1.05e-11) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 5e-12) tmp = Float64(log(Float64(1.0 + Float64(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], -1.05e-11], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-12], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $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 -1.05 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(1 + \frac{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) < -1.0499999999999999e-11Initial program 96.2%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.0499999999999999e-11 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999997e-12Initial program 25.5%
Taylor expanded in n around inf 75.5%
log1p-define75.5%
Simplified75.5%
log1p-undefine75.5%
diff-log75.8%
Applied egg-rr75.8%
+-commutative75.8%
Simplified75.8%
Taylor expanded in x around inf 75.8%
if 4.9999999999999997e-12 < (/.f64 #s(literal 1 binary64) n) Initial program 53.7%
Taylor expanded in n around 0 53.7%
log1p-define92.1%
*-rgt-identity92.1%
associate-/l*92.1%
exp-to-pow92.1%
Simplified92.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1.05e-11)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 0.0001)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(-
(+
1.0
(*
x
(+
(/ 1.0 n)
(* x (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))))
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1.05e-11) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 0.0001) {
tmp = log((1.0 + (1.0 / x))) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1.05d-11)) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= 0.0001d0) then
tmp = log((1.0d0 + (1.0d0 / x))) / n
else
tmp = (1.0d0 + (x * ((1.0d0 / n) + (x * ((0.5d0 * (1.0d0 / (n ** 2.0d0))) + (0.5d0 * ((-1.0d0) / n))))))) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1.05e-11) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 0.0001) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1.05e-11: tmp = t_0 / (x * n) elif (1.0 / n) <= 0.0001: tmp = math.log((1.0 + (1.0 / x))) / n else: tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1.05e-11) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 0.0001) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n))))))) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1.05e-11) tmp = t_0 / (x * n); elseif ((1.0 / n) <= 0.0001) tmp = log((1.0 + (1.0 / x))) / n; else tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / (n ^ 2.0))) + (0.5 * (-1.0 / n))))))) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.05e-11], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0001], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(x * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1.05 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0001:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0499999999999999e-11Initial program 96.2%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.0499999999999999e-11 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000005e-4Initial program 25.7%
Taylor expanded in n around inf 74.5%
log1p-define74.5%
Simplified74.5%
log1p-undefine74.5%
diff-log74.8%
Applied egg-rr74.8%
+-commutative74.8%
Simplified74.8%
Taylor expanded in x around inf 74.8%
if 1.00000000000000005e-4 < (/.f64 #s(literal 1 binary64) n) Initial program 54.9%
Taylor expanded in x around 0 72.6%
Final simplification81.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1.05e-11)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 5e-12)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 1e+129)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(/ (log1p (+ x -1.0)) (- n)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1.05e-11) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 5e-12) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 1e+129) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else {
tmp = log1p((x + -1.0)) / -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) <= -1.05e-11) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 5e-12) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 1e+129) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - t_0;
} else {
tmp = Math.log1p((x + -1.0)) / -n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1.05e-11: tmp = t_0 / (x * n) elif (1.0 / n) <= 5e-12: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 1e+129: tmp = math.pow((x + 1.0), (1.0 / n)) - t_0 else: tmp = math.log1p((x + -1.0)) / -n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1.05e-11) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 5e-12) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 1e+129) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); else tmp = Float64(log1p(Float64(x + -1.0)) / Float64(-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], -1.05e-11], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-12], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+129], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[Log[1 + N[(x + -1.0), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1.05 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+129}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x + -1\right)}{-n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0499999999999999e-11Initial program 96.2%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.0499999999999999e-11 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999997e-12Initial program 25.5%
Taylor expanded in n around inf 75.5%
log1p-define75.5%
Simplified75.5%
log1p-undefine75.5%
diff-log75.8%
Applied egg-rr75.8%
+-commutative75.8%
Simplified75.8%
Taylor expanded in x around inf 75.8%
if 4.9999999999999997e-12 < (/.f64 #s(literal 1 binary64) n) < 1e129Initial program 70.9%
if 1e129 < (/.f64 #s(literal 1 binary64) n) Initial program 26.6%
Taylor expanded in n around inf 11.0%
log1p-define11.0%
Simplified11.0%
Taylor expanded in x around 0 11.0%
neg-mul-111.0%
Simplified11.0%
log1p-expm1-u74.5%
expm1-undefine74.5%
add-exp-log74.5%
Applied egg-rr74.5%
Final simplification82.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1.05e-11)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 0.0001)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 5e+158)
(- (+ 1.0 (/ x n)) t_0)
(/ (log1p (+ x -1.0)) (- n)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1.05e-11) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 0.0001) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 5e+158) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = log1p((x + -1.0)) / -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) <= -1.05e-11) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 0.0001) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 5e+158) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.log1p((x + -1.0)) / -n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1.05e-11: tmp = t_0 / (x * n) elif (1.0 / n) <= 0.0001: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 5e+158: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.log1p((x + -1.0)) / -n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1.05e-11) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 0.0001) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 5e+158) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(log1p(Float64(x + -1.0)) / Float64(-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], -1.05e-11], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0001], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+158], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[Log[1 + N[(x + -1.0), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1.05 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0001:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+158}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x + -1\right)}{-n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0499999999999999e-11Initial program 96.2%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.0499999999999999e-11 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000005e-4Initial program 25.7%
Taylor expanded in n around inf 74.5%
log1p-define74.5%
Simplified74.5%
log1p-undefine74.5%
diff-log74.8%
Applied egg-rr74.8%
+-commutative74.8%
Simplified74.8%
Taylor expanded in x around inf 74.8%
if 1.00000000000000005e-4 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999996e158Initial program 70.6%
Taylor expanded in x around 0 70.6%
if 4.9999999999999996e158 < (/.f64 #s(literal 1 binary64) n) Initial program 15.1%
Taylor expanded in n around inf 14.0%
log1p-define14.0%
Simplified14.0%
Taylor expanded in x around 0 14.0%
neg-mul-114.0%
Simplified14.0%
log1p-expm1-u85.1%
expm1-undefine85.1%
add-exp-log85.1%
Applied egg-rr85.1%
Final simplification82.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1.05e-11)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 0.0001)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 1e+129) (- 1.0 t_0) (/ (log1p (+ x -1.0)) (- n)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1.05e-11) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 0.0001) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 1e+129) {
tmp = 1.0 - t_0;
} else {
tmp = log1p((x + -1.0)) / -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) <= -1.05e-11) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 0.0001) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 1e+129) {
tmp = 1.0 - t_0;
} else {
tmp = Math.log1p((x + -1.0)) / -n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1.05e-11: tmp = t_0 / (x * n) elif (1.0 / n) <= 0.0001: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 1e+129: tmp = 1.0 - t_0 else: tmp = math.log1p((x + -1.0)) / -n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1.05e-11) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 0.0001) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 1e+129) tmp = Float64(1.0 - t_0); else tmp = Float64(log1p(Float64(x + -1.0)) / Float64(-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], -1.05e-11], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0001], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+129], N[(1.0 - t$95$0), $MachinePrecision], N[(N[Log[1 + N[(x + -1.0), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1.05 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0001:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+129}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x + -1\right)}{-n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0499999999999999e-11Initial program 96.2%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.0499999999999999e-11 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000005e-4Initial program 25.7%
Taylor expanded in n around inf 74.5%
log1p-define74.5%
Simplified74.5%
log1p-undefine74.5%
diff-log74.8%
Applied egg-rr74.8%
+-commutative74.8%
Simplified74.8%
Taylor expanded in x around inf 74.8%
if 1.00000000000000005e-4 < (/.f64 #s(literal 1 binary64) n) < 1e129Initial program 74.8%
Taylor expanded in x around 0 74.7%
*-rgt-identity74.7%
associate-/l*74.7%
exp-to-pow74.7%
Simplified74.7%
if 1e129 < (/.f64 #s(literal 1 binary64) n) Initial program 26.6%
Taylor expanded in n around inf 11.0%
log1p-define11.0%
Simplified11.0%
Taylor expanded in x around 0 11.0%
neg-mul-111.0%
Simplified11.0%
log1p-expm1-u74.5%
expm1-undefine74.5%
add-exp-log74.5%
Applied egg-rr74.5%
Final simplification82.2%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -2e+174)
(/ (/ (- (* x (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) (* x x)) n)
(if (<= (/ 1.0 n) 0.0001)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 1e+129)
(- 1.0 (pow x (/ 1.0 n)))
(/ (log1p (+ x -1.0)) (- n))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e+174) {
tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n;
} else if ((1.0 / n) <= 0.0001) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 1e+129) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = log1p((x + -1.0)) / -n;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e+174) {
tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n;
} else if ((1.0 / n) <= 0.0001) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 1e+129) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = Math.log1p((x + -1.0)) / -n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -2e+174: tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n elif (1.0 / n) <= 0.0001: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 1e+129: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = math.log1p((x + -1.0)) / -n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -2e+174) tmp = Float64(Float64(Float64(Float64(x * Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) - x) / Float64(x * x)) / n); elseif (Float64(1.0 / n) <= 0.0001) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 1e+129) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(log1p(Float64(x + -1.0)) / Float64(-n)); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+174], N[(N[(N[(N[(x * N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0001], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+129], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Log[1 + N[(x + -1.0), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{+174}:\\
\;\;\;\;\frac{\frac{x \cdot \frac{-0.5 + \frac{0.3333333333333333}{x}}{x} - x}{x \cdot x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0001:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+129}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x + -1\right)}{-n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000014e174Initial program 100.0%
Taylor expanded in n around inf 54.5%
log1p-define54.5%
Simplified54.5%
Taylor expanded in x around -inf 44.7%
add-sqr-sqrt44.7%
sqrt-unprod69.6%
mul-1-neg69.6%
mul-1-neg69.6%
sqr-neg69.6%
sqrt-unprod0.0%
add-sqr-sqrt1.3%
div-sub1.3%
frac-2neg1.3%
metadata-eval1.3%
frac-sub26.3%
Applied egg-rr69.6%
if -2.00000000000000014e174 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000005e-4Initial program 41.1%
Taylor expanded in n around inf 70.5%
log1p-define70.5%
Simplified70.5%
log1p-undefine70.5%
diff-log70.7%
Applied egg-rr70.7%
+-commutative70.7%
Simplified70.7%
Taylor expanded in x around inf 70.7%
if 1.00000000000000005e-4 < (/.f64 #s(literal 1 binary64) n) < 1e129Initial program 74.8%
Taylor expanded in x around 0 74.7%
*-rgt-identity74.7%
associate-/l*74.7%
exp-to-pow74.7%
Simplified74.7%
if 1e129 < (/.f64 #s(literal 1 binary64) n) Initial program 26.6%
Taylor expanded in n around inf 11.0%
log1p-define11.0%
Simplified11.0%
Taylor expanded in x around 0 11.0%
neg-mul-111.0%
Simplified11.0%
log1p-expm1-u74.5%
expm1-undefine74.5%
add-exp-log74.5%
Applied egg-rr74.5%
Final simplification71.3%
(FPCore (x n)
:precision binary64
(if (<= x 3.1e-110)
(/ (log x) (- n))
(if (<= x 0.58)
(/ (log1p (+ x -1.0)) (- n))
(if (<= x 5.7e+162)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x)
(/
(/ (- (* x (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) (* x x))
n)))))
double code(double x, double n) {
double tmp;
if (x <= 3.1e-110) {
tmp = log(x) / -n;
} else if (x <= 0.58) {
tmp = log1p((x + -1.0)) / -n;
} else if (x <= 5.7e+162) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (x <= 3.1e-110) {
tmp = Math.log(x) / -n;
} else if (x <= 0.58) {
tmp = Math.log1p((x + -1.0)) / -n;
} else if (x <= 5.7e+162) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 3.1e-110: tmp = math.log(x) / -n elif x <= 0.58: tmp = math.log1p((x + -1.0)) / -n elif x <= 5.7e+162: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x else: tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 3.1e-110) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 0.58) tmp = Float64(log1p(Float64(x + -1.0)) / Float64(-n)); elseif (x <= 5.7e+162) 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(Float64(Float64(x * Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) - x) / Float64(x * x)) / n); end return tmp end
code[x_, n_] := If[LessEqual[x, 3.1e-110], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 0.58], N[(N[Log[1 + N[(x + -1.0), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 5.7e+162], 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[(N[(N[(x * N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.1 \cdot 10^{-110}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 0.58:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x + -1\right)}{-n}\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{+162}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \frac{-0.5 + \frac{0.3333333333333333}{x}}{x} - x}{x \cdot x}}{n}\\
\end{array}
\end{array}
if x < 3.10000000000000007e-110Initial program 41.6%
Taylor expanded in n around inf 57.7%
log1p-define57.7%
Simplified57.7%
Taylor expanded in x around 0 57.7%
neg-mul-157.7%
Simplified57.7%
if 3.10000000000000007e-110 < x < 0.57999999999999996Initial program 42.2%
Taylor expanded in n around inf 42.6%
log1p-define42.6%
Simplified42.6%
Taylor expanded in x around 0 39.7%
neg-mul-139.7%
Simplified39.7%
log1p-expm1-u52.0%
expm1-undefine52.0%
add-exp-log52.0%
Applied egg-rr52.0%
if 0.57999999999999996 < x < 5.69999999999999997e162Initial program 48.4%
Taylor expanded in n around inf 46.4%
log1p-define46.4%
Simplified46.4%
Taylor expanded in x around -inf 59.2%
mul-1-neg59.2%
mul-1-neg59.2%
associate-*r/59.2%
metadata-eval59.2%
*-commutative59.2%
associate-*r/59.2%
metadata-eval59.2%
Simplified59.2%
if 5.69999999999999997e162 < x Initial program 83.3%
Taylor expanded in n around inf 83.3%
log1p-define83.3%
Simplified83.3%
Taylor expanded in x around -inf 57.0%
add-sqr-sqrt57.0%
sqrt-unprod83.3%
mul-1-neg83.3%
mul-1-neg83.3%
sqr-neg83.3%
sqrt-unprod0.0%
add-sqr-sqrt47.3%
div-sub47.3%
frac-2neg47.3%
metadata-eval47.3%
frac-sub83.3%
Applied egg-rr83.3%
Final simplification62.0%
(FPCore (x n)
:precision binary64
(if (<= x 0.86)
(/ (- x (log x)) n)
(if (<= x 2.9e+160)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x)
(/ (/ (- (* x (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) (* x x)) n))))
double code(double x, double n) {
double tmp;
if (x <= 0.86) {
tmp = (x - log(x)) / n;
} else if (x <= 2.9e+160) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.86d0) then
tmp = (x - log(x)) / n
else if (x <= 2.9d+160) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) - (0.5d0 / n)) / x)) / x
else
tmp = (((x * (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) - x) / (x * x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.86) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 2.9e+160) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.86: tmp = (x - math.log(x)) / n elif x <= 2.9e+160: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x else: tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.86) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 2.9e+160) 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(Float64(Float64(x * Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) - x) / Float64(x * x)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.86) tmp = (x - log(x)) / n; elseif (x <= 2.9e+160) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x; else tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.86], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 2.9e+160], 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[(N[(N[(x * N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.86:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \frac{-0.5 + \frac{0.3333333333333333}{x}}{x} - x}{x \cdot x}}{n}\\
\end{array}
\end{array}
if x < 0.859999999999999987Initial program 41.8%
Taylor expanded in n around inf 52.4%
log1p-define52.4%
Simplified52.4%
Taylor expanded in x around 0 51.4%
if 0.859999999999999987 < x < 2.8999999999999999e160Initial program 48.4%
Taylor expanded in n around inf 46.4%
log1p-define46.4%
Simplified46.4%
Taylor expanded in x around -inf 59.2%
mul-1-neg59.2%
mul-1-neg59.2%
associate-*r/59.2%
metadata-eval59.2%
*-commutative59.2%
associate-*r/59.2%
metadata-eval59.2%
Simplified59.2%
if 2.8999999999999999e160 < x Initial program 83.3%
Taylor expanded in n around inf 83.3%
log1p-define83.3%
Simplified83.3%
Taylor expanded in x around -inf 57.0%
add-sqr-sqrt57.0%
sqrt-unprod83.3%
mul-1-neg83.3%
mul-1-neg83.3%
sqr-neg83.3%
sqrt-unprod0.0%
add-sqr-sqrt47.3%
div-sub47.3%
frac-2neg47.3%
metadata-eval47.3%
frac-sub83.3%
Applied egg-rr83.3%
Final simplification59.6%
(FPCore (x n)
:precision binary64
(if (<= x 0.58)
(/ (log x) (- n))
(if (<= x 2.5e+161)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x)
(/ (/ (- (* x (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) (* x x)) n))))
double code(double x, double n) {
double tmp;
if (x <= 0.58) {
tmp = log(x) / -n;
} else if (x <= 2.5e+161) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.58d0) then
tmp = log(x) / -n
else if (x <= 2.5d+161) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) - (0.5d0 / n)) / x)) / x
else
tmp = (((x * (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) - x) / (x * x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.58) {
tmp = Math.log(x) / -n;
} else if (x <= 2.5e+161) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.58: tmp = math.log(x) / -n elif x <= 2.5e+161: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x else: tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.58) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 2.5e+161) 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(Float64(Float64(x * Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) - x) / Float64(x * x)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.58) tmp = log(x) / -n; elseif (x <= 2.5e+161) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x; else tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.58], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 2.5e+161], 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[(N[(N[(x * N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.58:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+161}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \frac{-0.5 + \frac{0.3333333333333333}{x}}{x} - x}{x \cdot x}}{n}\\
\end{array}
\end{array}
if x < 0.57999999999999996Initial program 41.8%
Taylor expanded in n around inf 52.4%
log1p-define52.4%
Simplified52.4%
Taylor expanded in x around 0 51.3%
neg-mul-151.3%
Simplified51.3%
if 0.57999999999999996 < x < 2.4999999999999998e161Initial program 48.4%
Taylor expanded in n around inf 46.4%
log1p-define46.4%
Simplified46.4%
Taylor expanded in x around -inf 59.2%
mul-1-neg59.2%
mul-1-neg59.2%
associate-*r/59.2%
metadata-eval59.2%
*-commutative59.2%
associate-*r/59.2%
metadata-eval59.2%
Simplified59.2%
if 2.4999999999999998e161 < x Initial program 83.3%
Taylor expanded in n around inf 83.3%
log1p-define83.3%
Simplified83.3%
Taylor expanded in x around -inf 57.0%
add-sqr-sqrt57.0%
sqrt-unprod83.3%
mul-1-neg83.3%
mul-1-neg83.3%
sqr-neg83.3%
sqrt-unprod0.0%
add-sqr-sqrt47.3%
div-sub47.3%
frac-2neg47.3%
metadata-eval47.3%
frac-sub83.3%
Applied egg-rr83.3%
Final simplification59.5%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -2e+118)
(/ (/ (- (* x (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) (* x x)) n)
(if (<= (/ 1.0 n) -1000000.0)
(/ 0.0 n)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e+118) {
tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n;
} else if ((1.0 / n) <= -1000000.0) {
tmp = 0.0 / 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 ((1.0d0 / n) <= (-2d+118)) then
tmp = (((x * (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) - x) / (x * x)) / n
else if ((1.0d0 / n) <= (-1000000.0d0)) then
tmp = 0.0d0 / 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 ((1.0 / n) <= -2e+118) {
tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n;
} else if ((1.0 / n) <= -1000000.0) {
tmp = 0.0 / n;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -2e+118: tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n elif (1.0 / n) <= -1000000.0: tmp = 0.0 / 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 (Float64(1.0 / n) <= -2e+118) tmp = Float64(Float64(Float64(Float64(x * Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) - x) / Float64(x * x)) / n); elseif (Float64(1.0 / n) <= -1000000.0) tmp = Float64(0.0 / 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 ((1.0 / n) <= -2e+118) tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * x)) / n; elseif ((1.0 / n) <= -1000000.0) tmp = 0.0 / n; else tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+118], N[(N[(N[(N[(x * N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1000000.0], N[(0.0 / 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}\;\frac{1}{n} \leq -2 \cdot 10^{+118}:\\
\;\;\;\;\frac{\frac{x \cdot \frac{-0.5 + \frac{0.3333333333333333}{x}}{x} - x}{x \cdot x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -1000000:\\
\;\;\;\;\frac{0}{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 (/.f64 #s(literal 1 binary64) n) < -1.99999999999999993e118Initial program 100.0%
Taylor expanded in n around inf 52.9%
log1p-define52.9%
Simplified52.9%
Taylor expanded in x around -inf 43.6%
add-sqr-sqrt43.6%
sqrt-unprod63.9%
mul-1-neg63.9%
mul-1-neg63.9%
sqr-neg63.9%
sqrt-unprod0.0%
add-sqr-sqrt1.3%
div-sub1.3%
frac-2neg1.3%
metadata-eval1.3%
frac-sub21.5%
Applied egg-rr63.9%
if -1.99999999999999993e118 < (/.f64 #s(literal 1 binary64) n) < -1e6Initial program 100.0%
Taylor expanded in n around inf 70.6%
log1p-define70.6%
Simplified70.6%
log1p-undefine70.6%
diff-log70.6%
Applied egg-rr70.6%
+-commutative70.6%
Simplified70.6%
Taylor expanded in x around inf 78.6%
if -1e6 < (/.f64 #s(literal 1 binary64) n) Initial program 33.0%
Taylor expanded in n around inf 56.5%
log1p-define56.5%
Simplified56.5%
Taylor expanded in x around -inf 43.7%
mul-1-neg43.7%
mul-1-neg43.7%
associate-*r/43.7%
metadata-eval43.7%
*-commutative43.7%
associate-*r/43.7%
metadata-eval43.7%
Simplified43.7%
Final simplification50.6%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -1000000.0) (/ (/ (- (* x (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) (* x x)) n) (/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1000000.0) {
tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * 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 ((1.0d0 / n) <= (-1000000.0d0)) then
tmp = (((x * (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) - x) / (x * 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 ((1.0 / n) <= -1000000.0) {
tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * 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 (1.0 / n) <= -1000000.0: tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * 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 (Float64(1.0 / n) <= -1000000.0) tmp = Float64(Float64(Float64(Float64(x * Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) - x) / Float64(x * x)) / 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 ((1.0 / n) <= -1000000.0) tmp = (((x * ((-0.5 + (0.3333333333333333 / x)) / x)) - x) / (x * 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[LessEqual[N[(1.0 / n), $MachinePrecision], -1000000.0], N[(N[(N[(N[(x * N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $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}\;\frac{1}{n} \leq -1000000:\\
\;\;\;\;\frac{\frac{x \cdot \frac{-0.5 + \frac{0.3333333333333333}{x}}{x} - x}{x \cdot 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 (/.f64 #s(literal 1 binary64) n) < -1e6Initial program 100.0%
Taylor expanded in n around inf 58.6%
log1p-define58.6%
Simplified58.6%
Taylor expanded in x around -inf 36.3%
add-sqr-sqrt36.3%
sqrt-unprod61.9%
mul-1-neg61.9%
mul-1-neg61.9%
sqr-neg61.9%
sqrt-unprod0.0%
add-sqr-sqrt2.0%
div-sub2.0%
frac-2neg2.0%
metadata-eval2.0%
frac-sub27.6%
Applied egg-rr61.9%
if -1e6 < (/.f64 #s(literal 1 binary64) n) Initial program 33.0%
Taylor expanded in n around inf 56.5%
log1p-define56.5%
Simplified56.5%
Taylor expanded in x around -inf 43.7%
mul-1-neg43.7%
mul-1-neg43.7%
associate-*r/43.7%
metadata-eval43.7%
*-commutative43.7%
associate-*r/43.7%
metadata-eval43.7%
Simplified43.7%
Final simplification48.7%
(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.6%
Taylor expanded in n around inf 57.1%
log1p-define57.1%
Simplified57.1%
Taylor expanded in x around -inf 41.6%
mul-1-neg41.6%
mul-1-neg41.6%
associate-*r/41.6%
metadata-eval41.6%
*-commutative41.6%
associate-*r/41.6%
metadata-eval41.6%
Simplified41.6%
Final simplification41.6%
(FPCore (x n) :precision binary64 (/ (/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) x) n))
double code(double x, double n) {
return ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / x) / n
end function
public static double code(double x, double n) {
return ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x) / n;
}
def code(x, n): return ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x) / n
function code(x, n) return Float64(Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / x) / n) end
function tmp = code(x, n) tmp = ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x) / n; end
code[x_, n_] := N[(N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}}{n}
\end{array}
Initial program 51.6%
Taylor expanded in n around inf 57.1%
log1p-define57.1%
Simplified57.1%
log1p-undefine57.1%
diff-log57.3%
Applied egg-rr57.3%
+-commutative57.3%
Simplified57.3%
Taylor expanded in x around -inf 41.6%
Simplified41.6%
(FPCore (x n) :precision binary64 (/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) (* x n)))
double code(double x, double n) {
return (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / (x * n)
end function
public static double code(double x, double n) {
return (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
}
def code(x, n): return (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n)
function code(x, n) return Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / Float64(x * n)) end
function tmp = code(x, n) tmp = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n); end
code[x_, n_] := N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x \cdot n}
\end{array}
Initial program 51.6%
Taylor expanded in n around inf 57.1%
log1p-define57.1%
Simplified57.1%
Taylor expanded in x around -inf 41.6%
Taylor expanded in n around 0 40.7%
Simplified40.7%
(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.6%
Taylor expanded in n around inf 57.1%
log1p-define57.1%
Simplified57.1%
Taylor expanded in x around inf 34.9%
associate-/r*35.8%
Simplified35.8%
(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.6%
Taylor expanded in n around inf 57.1%
log1p-define57.1%
Simplified57.1%
Taylor expanded in x around inf 34.9%
Final simplification34.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.6%
Taylor expanded in n around inf 57.1%
log1p-define57.1%
Simplified57.1%
Taylor expanded in x around inf 34.9%
inv-pow34.9%
*-commutative34.9%
unpow-prod-down35.8%
inv-pow35.8%
rem-exp-log35.1%
neg-log35.1%
add-sqr-sqrt10.9%
sqrt-unprod12.3%
sqr-neg12.3%
sqrt-unprod1.4%
add-sqr-sqrt4.6%
add-exp-log4.6%
inv-pow4.6%
Applied egg-rr4.6%
associate-*r/4.6%
*-rgt-identity4.6%
Simplified4.6%
herbie shell --seed 2024113
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))