
(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 16 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 (or (<= n -1500000.0) (not (<= n 4.6e-5)))
(+
(/ (- (log1p x) (log x)) n)
(+
(/
(* 0.16666666666666666 (- (pow (log1p x) 3.0) (pow (log x) 3.0)))
(pow n 3.0))
(*
0.5
(-
(/ (pow (log1p x) 2.0) (pow n 2.0))
(/ (pow (log x) 2.0) (pow n 2.0))))))
(fma
(sqrt (pow (sqrt x) (/ 2.0 n)))
(- (exp (* 0.5 (/ (log x) n))))
(exp (/ (log1p x) n)))))
double code(double x, double n) {
double tmp;
if ((n <= -1500000.0) || !(n <= 4.6e-5)) {
tmp = ((log1p(x) - log(x)) / n) + (((0.16666666666666666 * (pow(log1p(x), 3.0) - pow(log(x), 3.0))) / pow(n, 3.0)) + (0.5 * ((pow(log1p(x), 2.0) / pow(n, 2.0)) - (pow(log(x), 2.0) / pow(n, 2.0)))));
} else {
tmp = fma(sqrt(pow(sqrt(x), (2.0 / n))), -exp((0.5 * (log(x) / n))), exp((log1p(x) / n)));
}
return tmp;
}
function code(x, n) tmp = 0.0 if ((n <= -1500000.0) || !(n <= 4.6e-5)) tmp = Float64(Float64(Float64(log1p(x) - log(x)) / n) + Float64(Float64(Float64(0.16666666666666666 * Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0))) / (n ^ 3.0)) + Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) / (n ^ 2.0)) - Float64((log(x) ^ 2.0) / (n ^ 2.0)))))); else tmp = fma(sqrt((sqrt(x) ^ Float64(2.0 / n))), Float64(-exp(Float64(0.5 * Float64(log(x) / n)))), exp(Float64(log1p(x) / n))); end return tmp end
code[x_, n_] := If[Or[LessEqual[n, -1500000.0], N[Not[LessEqual[n, 4.6e-5]], $MachinePrecision]], N[(N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(N[(N[(0.16666666666666666 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[Power[N[Sqrt[x], $MachinePrecision], N[(2.0 / n), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-N[Exp[N[(0.5 * N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) + N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1500000 \lor \neg \left(n \leq 4.6 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n} + \left(\frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{{n}^{3}} + 0.5 \cdot \left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{{n}^{2}} - \frac{{\log x}^{2}}{{n}^{2}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt{{\left(\sqrt{x}\right)}^{\left(\frac{2}{n}\right)}}, -e^{0.5 \cdot \frac{\log x}{n}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)\\
\end{array}
\end{array}
if n < -1.5e6 or 4.6e-5 < n Initial program 26.4%
Taylor expanded in n around -inf 78.7%
associate--l+78.7%
associate-*r/78.7%
mul-1-neg78.7%
distribute-lft-out--78.7%
mul-1-neg78.7%
remove-double-neg78.7%
log1p-def78.7%
associate--l+78.7%
Simplified78.7%
if -1.5e6 < n < 4.6e-5Initial program 85.7%
sub-neg85.7%
+-commutative85.7%
add-sqr-sqrt85.8%
distribute-rgt-neg-in85.8%
fma-def85.8%
add-exp-log85.8%
log-pow85.8%
+-commutative85.8%
log1p-udef99.2%
*-commutative99.2%
un-div-inv99.2%
Applied egg-rr99.2%
pow1/299.2%
pow-to-exp99.2%
pow-exp99.2%
div-inv99.2%
Applied egg-rr99.2%
add-sqr-sqrt99.2%
unpow-prod-down99.2%
Applied egg-rr99.2%
pow-sqr99.2%
associate-*r/99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification88.5%
(FPCore (x n)
:precision binary64
(if (<= n -25000000.0)
(+
(/ (- (log1p x) (log x)) n)
(*
0.5
(-
(/ (pow (log1p x) 2.0) (pow n 2.0))
(/ (pow (log x) 2.0) (pow n 2.0)))))
(if (<= n 44000000000.0)
(pow (cbrt (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))) 3.0)
(/ (log (/ (+ x 1.0) x)) n))))
double code(double x, double n) {
double tmp;
if (n <= -25000000.0) {
tmp = ((log1p(x) - log(x)) / n) + (0.5 * ((pow(log1p(x), 2.0) / pow(n, 2.0)) - (pow(log(x), 2.0) / pow(n, 2.0))));
} else if (n <= 44000000000.0) {
tmp = pow(cbrt((exp((log1p(x) / n)) - pow(x, (1.0 / n)))), 3.0);
} else {
tmp = log(((x + 1.0) / x)) / n;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (n <= -25000000.0) {
tmp = ((Math.log1p(x) - Math.log(x)) / n) + (0.5 * ((Math.pow(Math.log1p(x), 2.0) / Math.pow(n, 2.0)) - (Math.pow(Math.log(x), 2.0) / Math.pow(n, 2.0))));
} else if (n <= 44000000000.0) {
tmp = Math.pow(Math.cbrt((Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n)))), 3.0);
} else {
tmp = Math.log(((x + 1.0) / x)) / n;
}
return tmp;
}
function code(x, n) tmp = 0.0 if (n <= -25000000.0) tmp = Float64(Float64(Float64(log1p(x) - log(x)) / n) + Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) / (n ^ 2.0)) - Float64((log(x) ^ 2.0) / (n ^ 2.0))))); elseif (n <= 44000000000.0) tmp = cbrt(Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n)))) ^ 3.0; else tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); end return tmp end
code[x_, n_] := If[LessEqual[n, -25000000.0], N[(N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 44000000000.0], N[Power[N[Power[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -25000000:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n} + 0.5 \cdot \left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{{n}^{2}} - \frac{{\log x}^{2}}{{n}^{2}}\right)\\
\mathbf{elif}\;n \leq 44000000000:\\
\;\;\;\;{\left(\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\end{array}
\end{array}
if n < -2.5e7Initial program 32.8%
Taylor expanded in n around inf 81.2%
associate--l+72.0%
+-commutative72.0%
associate--r+81.2%
div-sub81.3%
remove-double-neg81.3%
mul-1-neg81.3%
distribute-lft-out--81.3%
distribute-neg-frac81.3%
mul-1-neg81.3%
Simplified81.3%
if -2.5e7 < n < 4.4e10Initial program 83.7%
add-cube-cbrt83.7%
pow383.7%
add-exp-log83.7%
log-pow83.7%
+-commutative83.7%
log1p-udef96.7%
*-commutative96.7%
un-div-inv96.7%
Applied egg-rr96.7%
if 4.4e10 < n Initial program 19.3%
Taylor expanded in n around inf 78.3%
diff-log78.7%
+-commutative78.7%
Applied egg-rr78.7%
Final simplification88.3%
(FPCore (x n)
:precision binary64
(if (<= n -31500000000.0)
(- (/ (log (/ x (+ x 1.0))) n))
(if (<= n 33000000000.0)
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))
(/ (log (/ (+ x 1.0) x)) n))))
double code(double x, double n) {
double tmp;
if (n <= -31500000000.0) {
tmp = -(log((x / (x + 1.0))) / n);
} else if (n <= 33000000000.0) {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
} else {
tmp = log(((x + 1.0) / x)) / n;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (n <= -31500000000.0) {
tmp = -(Math.log((x / (x + 1.0))) / n);
} else if (n <= 33000000000.0) {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = Math.log(((x + 1.0) / x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -31500000000.0: tmp = -(math.log((x / (x + 1.0))) / n) elif n <= 33000000000.0: tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) else: tmp = math.log(((x + 1.0) / x)) / n return tmp
function code(x, n) tmp = 0.0 if (n <= -31500000000.0) tmp = Float64(-Float64(log(Float64(x / Float64(x + 1.0))) / n)); elseif (n <= 33000000000.0) tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); else tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); end return tmp end
code[x_, n_] := If[LessEqual[n, -31500000000.0], (-N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]), If[LessEqual[n, 33000000000.0], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -31500000000:\\
\;\;\;\;-\frac{\log \left(\frac{x}{x + 1}\right)}{n}\\
\mathbf{elif}\;n \leq 33000000000:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\end{array}
\end{array}
if n < -3.15e10Initial program 31.1%
Taylor expanded in n around inf 80.9%
diff-log81.1%
+-commutative81.1%
Applied egg-rr81.1%
clear-num81.1%
log-rec81.1%
Applied egg-rr81.1%
if -3.15e10 < n < 3.3e10Initial program 83.4%
Taylor expanded in n around 0 83.4%
log1p-def96.1%
Simplified96.1%
if 3.3e10 < n Initial program 19.3%
Taylor expanded in n around inf 78.3%
diff-log78.7%
+-commutative78.7%
Applied egg-rr78.7%
Final simplification88.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-8)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 5e-77)
(- (/ (log (/ x (+ x 1.0))) n))
(if (<= (/ 1.0 n) 2e-70)
(* (/ 1.0 n) (/ 1.0 x))
(if (<= (/ 1.0 n) 2e-7)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 1e+177)
(+ 1.0 t_0)
(sqrt (pow (* n x) -2.0)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-8) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-77) {
tmp = -(log((x / (x + 1.0))) / n);
} else if ((1.0 / n) <= 2e-70) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= 2e-7) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 1e+177) {
tmp = 1.0 + t_0;
} else {
tmp = sqrt(pow((n * x), -2.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) <= (-5d-8)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 5d-77) then
tmp = -(log((x / (x + 1.0d0))) / n)
else if ((1.0d0 / n) <= 2d-70) then
tmp = (1.0d0 / n) * (1.0d0 / x)
else if ((1.0d0 / n) <= 2d-7) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 1d+177) then
tmp = 1.0d0 + t_0
else
tmp = sqrt(((n * x) ** (-2.0d0)))
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) <= -5e-8) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-77) {
tmp = -(Math.log((x / (x + 1.0))) / n);
} else if ((1.0 / n) <= 2e-70) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= 2e-7) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 1e+177) {
tmp = 1.0 + t_0;
} else {
tmp = Math.sqrt(Math.pow((n * x), -2.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-8: tmp = t_0 / (n * x) elif (1.0 / n) <= 5e-77: tmp = -(math.log((x / (x + 1.0))) / n) elif (1.0 / n) <= 2e-70: tmp = (1.0 / n) * (1.0 / x) elif (1.0 / n) <= 2e-7: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 1e+177: tmp = 1.0 + t_0 else: tmp = math.sqrt(math.pow((n * x), -2.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-8) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e-77) tmp = Float64(-Float64(log(Float64(x / Float64(x + 1.0))) / n)); elseif (Float64(1.0 / n) <= 2e-70) tmp = Float64(Float64(1.0 / n) * Float64(1.0 / x)); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 1e+177) tmp = Float64(1.0 + t_0); else tmp = sqrt((Float64(n * x) ^ -2.0)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-8) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 5e-77) tmp = -(log((x / (x + 1.0))) / n); elseif ((1.0 / n) <= 2e-70) tmp = (1.0 / n) * (1.0 / x); elseif ((1.0 / n) <= 2e-7) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 1e+177) tmp = 1.0 + t_0; else tmp = sqrt(((n * x) ^ -2.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], -5e-8], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-77], (-N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]), If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-70], N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+177], N[(1.0 + t$95$0), $MachinePrecision], N[Sqrt[N[Power[N[(n * x), $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-8}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-77}:\\
\;\;\;\;-\frac{\log \left(\frac{x}{x + 1}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-70}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+177}:\\
\;\;\;\;1 + t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{\left(n \cdot x\right)}^{-2}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.9999999999999998e-8Initial program 97.6%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
expm1-log1p-u55.4%
expm1-udef53.1%
div-inv53.1%
exp-to-pow53.1%
Applied egg-rr53.1%
expm1-def55.4%
expm1-log1p98.9%
Simplified98.9%
if -4.9999999999999998e-8 < (/.f64 1 n) < 4.99999999999999963e-77Initial program 29.5%
Taylor expanded in n around inf 82.9%
diff-log83.2%
+-commutative83.2%
Applied egg-rr83.2%
clear-num83.2%
log-rec83.3%
Applied egg-rr83.3%
if 4.99999999999999963e-77 < (/.f64 1 n) < 1.99999999999999999e-70Initial program 6.2%
Taylor expanded in n around inf 6.2%
Taylor expanded in x around inf 99.4%
*-commutative99.4%
Simplified99.4%
associate-/r*99.1%
div-inv99.7%
Applied egg-rr99.7%
if 1.99999999999999999e-70 < (/.f64 1 n) < 1.9999999999999999e-7Initial program 10.0%
Taylor expanded in n around inf 64.3%
diff-log64.3%
+-commutative64.3%
Applied egg-rr64.3%
if 1.9999999999999999e-7 < (/.f64 1 n) < 1e177Initial program 83.7%
Taylor expanded in x around 0 75.7%
sub-neg75.7%
+-commutative75.7%
add-sqr-sqrt75.7%
sqrt-unprod79.8%
sqr-neg79.8%
sqrt-unprod79.8%
add-sqr-sqrt79.8%
Applied egg-rr79.8%
if 1e177 < (/.f64 1 n) Initial program 24.7%
Taylor expanded in n around inf 7.0%
Taylor expanded in x around inf 68.6%
*-commutative68.6%
Simplified68.6%
add-sqr-sqrt68.6%
sqrt-unprod83.9%
inv-pow83.9%
inv-pow83.9%
pow-prod-up83.9%
metadata-eval83.9%
Applied egg-rr83.9%
Final simplification87.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-8)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 5e-77)
(- (/ (log (/ x (+ x 1.0))) n))
(if (<= (/ 1.0 n) 2e-70)
(* (/ 1.0 n) (/ 1.0 x))
(if (<= (/ 1.0 n) 2e-7)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 1e+177)
(+ 1.0 t_0)
(sqrt (pow (* n x) -2.0)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-8) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-77) {
tmp = -(log((x / (x + 1.0))) / n);
} else if ((1.0 / n) <= 2e-70) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= 2e-7) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 1e+177) {
tmp = 1.0 + t_0;
} else {
tmp = sqrt(pow((n * x), -2.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) <= -5e-8) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-77) {
tmp = -(Math.log((x / (x + 1.0))) / n);
} else if ((1.0 / n) <= 2e-70) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= 2e-7) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 1e+177) {
tmp = 1.0 + t_0;
} else {
tmp = Math.sqrt(Math.pow((n * x), -2.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-8: tmp = t_0 / (n * x) elif (1.0 / n) <= 5e-77: tmp = -(math.log((x / (x + 1.0))) / n) elif (1.0 / n) <= 2e-70: tmp = (1.0 / n) * (1.0 / x) elif (1.0 / n) <= 2e-7: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 1e+177: tmp = 1.0 + t_0 else: tmp = math.sqrt(math.pow((n * x), -2.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-8) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e-77) tmp = Float64(-Float64(log(Float64(x / Float64(x + 1.0))) / n)); elseif (Float64(1.0 / n) <= 2e-70) tmp = Float64(Float64(1.0 / n) * Float64(1.0 / x)); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 1e+177) tmp = Float64(1.0 + t_0); else tmp = sqrt((Float64(n * x) ^ -2.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], -5e-8], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-77], (-N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]), If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-70], N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+177], N[(1.0 + t$95$0), $MachinePrecision], N[Sqrt[N[Power[N[(n * x), $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-8}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-77}:\\
\;\;\;\;-\frac{\log \left(\frac{x}{x + 1}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-70}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+177}:\\
\;\;\;\;1 + t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{\left(n \cdot x\right)}^{-2}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.9999999999999998e-8Initial program 97.6%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
expm1-log1p-u55.4%
expm1-udef53.1%
div-inv53.1%
exp-to-pow53.1%
Applied egg-rr53.1%
expm1-def55.4%
expm1-log1p98.9%
Simplified98.9%
if -4.9999999999999998e-8 < (/.f64 1 n) < 4.99999999999999963e-77Initial program 29.5%
Taylor expanded in n around inf 82.9%
diff-log83.2%
+-commutative83.2%
Applied egg-rr83.2%
clear-num83.2%
log-rec83.3%
Applied egg-rr83.3%
if 4.99999999999999963e-77 < (/.f64 1 n) < 1.99999999999999999e-70Initial program 6.2%
Taylor expanded in n around inf 6.2%
Taylor expanded in x around inf 99.4%
*-commutative99.4%
Simplified99.4%
associate-/r*99.1%
div-inv99.7%
Applied egg-rr99.7%
if 1.99999999999999999e-70 < (/.f64 1 n) < 1.9999999999999999e-7Initial program 10.0%
Taylor expanded in n around inf 64.3%
+-rgt-identity64.3%
+-rgt-identity64.3%
log1p-def64.3%
Simplified64.3%
if 1.9999999999999999e-7 < (/.f64 1 n) < 1e177Initial program 83.7%
Taylor expanded in x around 0 75.7%
sub-neg75.7%
+-commutative75.7%
add-sqr-sqrt75.7%
sqrt-unprod79.8%
sqr-neg79.8%
sqrt-unprod79.8%
add-sqr-sqrt79.8%
Applied egg-rr79.8%
if 1e177 < (/.f64 1 n) Initial program 24.7%
Taylor expanded in n around inf 7.0%
Taylor expanded in x around inf 68.6%
*-commutative68.6%
Simplified68.6%
add-sqr-sqrt68.6%
sqrt-unprod83.9%
inv-pow83.9%
inv-pow83.9%
pow-prod-up83.9%
metadata-eval83.9%
Applied egg-rr83.9%
Final simplification87.5%
(FPCore (x n)
:precision binary64
(if (<= n -15200000000.0)
(- (/ (log (/ x (+ x 1.0))) n))
(if (<= n 7200000000.0)
(- (exp (/ x n)) (pow x (/ 1.0 n)))
(/ (log (/ (+ x 1.0) x)) n))))
double code(double x, double n) {
double tmp;
if (n <= -15200000000.0) {
tmp = -(log((x / (x + 1.0))) / n);
} else if (n <= 7200000000.0) {
tmp = exp((x / n)) - pow(x, (1.0 / n));
} else {
tmp = log(((x + 1.0) / x)) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-15200000000.0d0)) then
tmp = -(log((x / (x + 1.0d0))) / n)
else if (n <= 7200000000.0d0) then
tmp = exp((x / n)) - (x ** (1.0d0 / n))
else
tmp = log(((x + 1.0d0) / x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -15200000000.0) {
tmp = -(Math.log((x / (x + 1.0))) / n);
} else if (n <= 7200000000.0) {
tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = Math.log(((x + 1.0) / x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -15200000000.0: tmp = -(math.log((x / (x + 1.0))) / n) elif n <= 7200000000.0: tmp = math.exp((x / n)) - math.pow(x, (1.0 / n)) else: tmp = math.log(((x + 1.0) / x)) / n return tmp
function code(x, n) tmp = 0.0 if (n <= -15200000000.0) tmp = Float64(-Float64(log(Float64(x / Float64(x + 1.0))) / n)); elseif (n <= 7200000000.0) tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -15200000000.0) tmp = -(log((x / (x + 1.0))) / n); elseif (n <= 7200000000.0) tmp = exp((x / n)) - (x ^ (1.0 / n)); else tmp = log(((x + 1.0) / x)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -15200000000.0], (-N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]), If[LessEqual[n, 7200000000.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -15200000000:\\
\;\;\;\;-\frac{\log \left(\frac{x}{x + 1}\right)}{n}\\
\mathbf{elif}\;n \leq 7200000000:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\end{array}
\end{array}
if n < -1.52e10Initial program 31.1%
Taylor expanded in n around inf 80.9%
diff-log81.1%
+-commutative81.1%
Applied egg-rr81.1%
clear-num81.1%
log-rec81.1%
Applied egg-rr81.1%
if -1.52e10 < n < 7.2e9Initial program 83.4%
Taylor expanded in n around 0 83.4%
log1p-def96.1%
Simplified96.1%
Taylor expanded in x around 0 96.1%
if 7.2e9 < n Initial program 19.3%
Taylor expanded in n around inf 78.3%
diff-log78.7%
+-commutative78.7%
Applied egg-rr78.7%
Final simplification88.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-8)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 5e-77)
(- (/ (log (/ x (+ x 1.0))) n))
(if (<= (/ 1.0 n) 2e-70)
(* (/ 1.0 n) (/ 1.0 x))
(if (<= (/ 1.0 n) 2e-7)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 2e+234) (+ 1.0 t_0) (/ 1.0 (* n x)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-8) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-77) {
tmp = -(log((x / (x + 1.0))) / n);
} else if ((1.0 / n) <= 2e-70) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= 2e-7) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e+234) {
tmp = 1.0 + t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-5d-8)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 5d-77) then
tmp = -(log((x / (x + 1.0d0))) / n)
else if ((1.0d0 / n) <= 2d-70) then
tmp = (1.0d0 / n) * (1.0d0 / x)
else if ((1.0d0 / n) <= 2d-7) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 2d+234) then
tmp = 1.0d0 + t_0
else
tmp = 1.0d0 / (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 ((1.0 / n) <= -5e-8) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-77) {
tmp = -(Math.log((x / (x + 1.0))) / n);
} else if ((1.0 / n) <= 2e-70) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= 2e-7) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e+234) {
tmp = 1.0 + t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-8: tmp = t_0 / (n * x) elif (1.0 / n) <= 5e-77: tmp = -(math.log((x / (x + 1.0))) / n) elif (1.0 / n) <= 2e-70: tmp = (1.0 / n) * (1.0 / x) elif (1.0 / n) <= 2e-7: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 2e+234: tmp = 1.0 + t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-8) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e-77) tmp = Float64(-Float64(log(Float64(x / Float64(x + 1.0))) / n)); elseif (Float64(1.0 / n) <= 2e-70) tmp = Float64(Float64(1.0 / n) * Float64(1.0 / x)); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 2e+234) tmp = Float64(1.0 + t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-8) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 5e-77) tmp = -(log((x / (x + 1.0))) / n); elseif ((1.0 / n) <= 2e-70) tmp = (1.0 / n) * (1.0 / x); elseif ((1.0 / n) <= 2e-7) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 2e+234) tmp = 1.0 + t_0; else tmp = 1.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[N[(1.0 / n), $MachinePrecision], -5e-8], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-77], (-N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]), If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-70], N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+234], N[(1.0 + t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-8}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-77}:\\
\;\;\;\;-\frac{\log \left(\frac{x}{x + 1}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-70}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+234}:\\
\;\;\;\;1 + t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.9999999999999998e-8Initial program 97.6%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
expm1-log1p-u55.4%
expm1-udef53.1%
div-inv53.1%
exp-to-pow53.1%
Applied egg-rr53.1%
expm1-def55.4%
expm1-log1p98.9%
Simplified98.9%
if -4.9999999999999998e-8 < (/.f64 1 n) < 4.99999999999999963e-77Initial program 29.5%
Taylor expanded in n around inf 82.9%
diff-log83.2%
+-commutative83.2%
Applied egg-rr83.2%
clear-num83.2%
log-rec83.3%
Applied egg-rr83.3%
if 4.99999999999999963e-77 < (/.f64 1 n) < 1.99999999999999999e-70Initial program 6.2%
Taylor expanded in n around inf 6.2%
Taylor expanded in x around inf 99.4%
*-commutative99.4%
Simplified99.4%
associate-/r*99.1%
div-inv99.7%
Applied egg-rr99.7%
if 1.99999999999999999e-70 < (/.f64 1 n) < 1.9999999999999999e-7Initial program 10.0%
Taylor expanded in n around inf 64.3%
diff-log64.3%
+-commutative64.3%
Applied egg-rr64.3%
if 1.9999999999999999e-7 < (/.f64 1 n) < 2.00000000000000004e234Initial program 78.0%
Taylor expanded in x around 0 68.6%
sub-neg68.6%
+-commutative68.6%
add-sqr-sqrt68.6%
sqrt-unprod71.9%
sqr-neg71.9%
sqrt-unprod71.9%
add-sqr-sqrt71.9%
Applied egg-rr71.9%
if 2.00000000000000004e234 < (/.f64 1 n) Initial program 3.1%
Taylor expanded in n around inf 8.4%
Taylor expanded in x around inf 92.1%
*-commutative92.1%
Simplified92.1%
Final simplification86.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= (/ 1.0 n) 5e-77)
t_0
(if (<= (/ 1.0 n) 2e-70)
(* (/ 1.0 n) (/ 1.0 x))
(if (<= (/ 1.0 n) 2e-7)
t_0
(if (<= (/ 1.0 n) 2e+234)
(+ 1.0 (pow x (/ 1.0 n)))
(/ 1.0 (* n x))))))))
double code(double x, double n) {
double t_0 = log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= 5e-77) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-70) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= 2e-7) {
tmp = t_0;
} else if ((1.0 / n) <= 2e+234) {
tmp = 1.0 + pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = log(((x + 1.0d0) / x)) / n
if ((1.0d0 / n) <= 5d-77) then
tmp = t_0
else if ((1.0d0 / n) <= 2d-70) then
tmp = (1.0d0 / n) * (1.0d0 / x)
else if ((1.0d0 / n) <= 2d-7) then
tmp = t_0
else if ((1.0d0 / n) <= 2d+234) then
tmp = 1.0d0 + (x ** (1.0d0 / n))
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= 5e-77) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-70) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= 2e-7) {
tmp = t_0;
} else if ((1.0 / n) <= 2e+234) {
tmp = 1.0 + Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.log(((x + 1.0) / x)) / n tmp = 0 if (1.0 / n) <= 5e-77: tmp = t_0 elif (1.0 / n) <= 2e-70: tmp = (1.0 / n) * (1.0 / x) elif (1.0 / n) <= 2e-7: tmp = t_0 elif (1.0 / n) <= 2e+234: tmp = 1.0 + math.pow(x, (1.0 / n)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = Float64(log(Float64(Float64(x + 1.0) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= 5e-77) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-70) tmp = Float64(Float64(1.0 / n) * Float64(1.0 / x)); elseif (Float64(1.0 / n) <= 2e-7) tmp = t_0; elseif (Float64(1.0 / n) <= 2e+234) tmp = Float64(1.0 + (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = log(((x + 1.0) / x)) / n; tmp = 0.0; if ((1.0 / n) <= 5e-77) tmp = t_0; elseif ((1.0 / n) <= 2e-70) tmp = (1.0 / n) * (1.0 / x); elseif ((1.0 / n) <= 2e-7) tmp = t_0; elseif ((1.0 / n) <= 2e+234) tmp = 1.0 + (x ^ (1.0 / n)); else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-77], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-70], N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+234], N[(1.0 + N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq 5 \cdot 10^{-77}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-70}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+234}:\\
\;\;\;\;1 + {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < 4.99999999999999963e-77 or 1.99999999999999999e-70 < (/.f64 1 n) < 1.9999999999999999e-7Initial program 55.4%
Taylor expanded in n around inf 70.4%
diff-log70.6%
+-commutative70.6%
Applied egg-rr70.6%
if 4.99999999999999963e-77 < (/.f64 1 n) < 1.99999999999999999e-70Initial program 6.2%
Taylor expanded in n around inf 6.2%
Taylor expanded in x around inf 99.4%
*-commutative99.4%
Simplified99.4%
associate-/r*99.1%
div-inv99.7%
Applied egg-rr99.7%
if 1.9999999999999999e-7 < (/.f64 1 n) < 2.00000000000000004e234Initial program 78.0%
Taylor expanded in x around 0 68.6%
sub-neg68.6%
+-commutative68.6%
add-sqr-sqrt68.6%
sqrt-unprod71.9%
sqr-neg71.9%
sqrt-unprod71.9%
add-sqr-sqrt71.9%
Applied egg-rr71.9%
if 2.00000000000000004e234 < (/.f64 1 n) Initial program 3.1%
Taylor expanded in n around inf 8.4%
Taylor expanded in x around inf 92.1%
*-commutative92.1%
Simplified92.1%
Final simplification72.2%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) 5e-77)
(- (/ (log (/ x (+ x 1.0))) n))
(if (<= (/ 1.0 n) 2e-70)
(* (/ 1.0 n) (/ 1.0 x))
(if (<= (/ 1.0 n) 2e-7)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 2e+234) (+ 1.0 (pow x (/ 1.0 n))) (/ 1.0 (* n x)))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 5e-77) {
tmp = -(log((x / (x + 1.0))) / n);
} else if ((1.0 / n) <= 2e-70) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= 2e-7) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e+234) {
tmp = 1.0 + pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= 5d-77) then
tmp = -(log((x / (x + 1.0d0))) / n)
else if ((1.0d0 / n) <= 2d-70) then
tmp = (1.0d0 / n) * (1.0d0 / x)
else if ((1.0d0 / n) <= 2d-7) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 2d+234) then
tmp = 1.0d0 + (x ** (1.0d0 / n))
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 5e-77) {
tmp = -(Math.log((x / (x + 1.0))) / n);
} else if ((1.0 / n) <= 2e-70) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= 2e-7) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e+234) {
tmp = 1.0 + Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= 5e-77: tmp = -(math.log((x / (x + 1.0))) / n) elif (1.0 / n) <= 2e-70: tmp = (1.0 / n) * (1.0 / x) elif (1.0 / n) <= 2e-7: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 2e+234: tmp = 1.0 + math.pow(x, (1.0 / n)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= 5e-77) tmp = Float64(-Float64(log(Float64(x / Float64(x + 1.0))) / n)); elseif (Float64(1.0 / n) <= 2e-70) tmp = Float64(Float64(1.0 / n) * Float64(1.0 / x)); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 2e+234) tmp = Float64(1.0 + (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= 5e-77) tmp = -(log((x / (x + 1.0))) / n); elseif ((1.0 / n) <= 2e-70) tmp = (1.0 / n) * (1.0 / x); elseif ((1.0 / n) <= 2e-7) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 2e+234) tmp = 1.0 + (x ^ (1.0 / n)); else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-77], (-N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]), If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-70], N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+234], N[(1.0 + N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq 5 \cdot 10^{-77}:\\
\;\;\;\;-\frac{\log \left(\frac{x}{x + 1}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-70}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+234}:\\
\;\;\;\;1 + {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < 4.99999999999999963e-77Initial program 58.2%
Taylor expanded in n around inf 70.8%
diff-log71.0%
+-commutative71.0%
Applied egg-rr71.0%
clear-num71.0%
log-rec71.0%
Applied egg-rr71.0%
if 4.99999999999999963e-77 < (/.f64 1 n) < 1.99999999999999999e-70Initial program 6.2%
Taylor expanded in n around inf 6.2%
Taylor expanded in x around inf 99.4%
*-commutative99.4%
Simplified99.4%
associate-/r*99.1%
div-inv99.7%
Applied egg-rr99.7%
if 1.99999999999999999e-70 < (/.f64 1 n) < 1.9999999999999999e-7Initial program 10.0%
Taylor expanded in n around inf 64.3%
diff-log64.3%
+-commutative64.3%
Applied egg-rr64.3%
if 1.9999999999999999e-7 < (/.f64 1 n) < 2.00000000000000004e234Initial program 78.0%
Taylor expanded in x around 0 68.6%
sub-neg68.6%
+-commutative68.6%
add-sqr-sqrt68.6%
sqrt-unprod71.9%
sqr-neg71.9%
sqrt-unprod71.9%
add-sqr-sqrt71.9%
Applied egg-rr71.9%
if 2.00000000000000004e234 < (/.f64 1 n) Initial program 3.1%
Taylor expanded in n around inf 8.4%
Taylor expanded in x around inf 92.1%
*-commutative92.1%
Simplified92.1%
Final simplification72.2%
(FPCore (x n)
:precision binary64
(if (<= x 5.65e-243)
(/ (- (log x)) n)
(if (<= x 1.7e-224)
(/ 1.0 (* n x))
(if (<= x 1.45) (/ (- x (log x)) n) 0.0))))
double code(double x, double n) {
double tmp;
if (x <= 5.65e-243) {
tmp = -log(x) / n;
} else if (x <= 1.7e-224) {
tmp = 1.0 / (n * x);
} else if (x <= 1.45) {
tmp = (x - log(x)) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 5.65d-243) then
tmp = -log(x) / n
else if (x <= 1.7d-224) then
tmp = 1.0d0 / (n * x)
else if (x <= 1.45d0) then
tmp = (x - log(x)) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 5.65e-243) {
tmp = -Math.log(x) / n;
} else if (x <= 1.7e-224) {
tmp = 1.0 / (n * x);
} else if (x <= 1.45) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 5.65e-243: tmp = -math.log(x) / n elif x <= 1.7e-224: tmp = 1.0 / (n * x) elif x <= 1.45: tmp = (x - math.log(x)) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 5.65e-243) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.7e-224) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 1.45) tmp = Float64(Float64(x - log(x)) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 5.65e-243) tmp = -log(x) / n; elseif (x <= 1.7e-224) tmp = 1.0 / (n * x); elseif (x <= 1.45) tmp = (x - log(x)) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 5.65e-243], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.7e-224], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.45], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.65 \cdot 10^{-243}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-224}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 1.45:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 5.64999999999999979e-243Initial program 42.0%
Taylor expanded in x around 0 42.0%
Taylor expanded in n around inf 59.0%
neg-mul-159.0%
distribute-neg-frac59.0%
Simplified59.0%
if 5.64999999999999979e-243 < x < 1.69999999999999996e-224Initial program 82.4%
Taylor expanded in n around inf 14.2%
Taylor expanded in x around inf 56.1%
*-commutative56.1%
Simplified56.1%
if 1.69999999999999996e-224 < x < 1.44999999999999996Initial program 41.6%
Taylor expanded in n around inf 52.4%
Taylor expanded in x around 0 51.3%
neg-mul-151.3%
unsub-neg51.3%
Simplified51.3%
if 1.44999999999999996 < x Initial program 70.5%
sub-neg70.5%
+-commutative70.5%
add-log-exp70.5%
add-log-exp70.5%
sum-log70.5%
add-exp-log70.5%
log-pow70.5%
+-commutative70.5%
log1p-udef70.5%
*-commutative70.5%
un-div-inv70.5%
Applied egg-rr70.5%
Taylor expanded in x around inf 70.5%
exp-neg70.5%
rgt-mult-inverse70.5%
metadata-eval70.5%
Simplified70.5%
Final simplification60.3%
(FPCore (x n)
:precision binary64
(if (<= x 1.35e-261)
(/ (- (log x)) n)
(if (<= x 5.5e-185)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 1.45) (/ (- x (log x)) n) 0.0))))
double code(double x, double n) {
double tmp;
if (x <= 1.35e-261) {
tmp = -log(x) / n;
} else if (x <= 5.5e-185) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 1.45) {
tmp = (x - log(x)) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.35d-261) then
tmp = -log(x) / n
else if (x <= 5.5d-185) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 1.45d0) then
tmp = (x - log(x)) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.35e-261) {
tmp = -Math.log(x) / n;
} else if (x <= 5.5e-185) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 1.45) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.35e-261: tmp = -math.log(x) / n elif x <= 5.5e-185: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 1.45: tmp = (x - math.log(x)) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1.35e-261) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 5.5e-185) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 1.45) tmp = Float64(Float64(x - log(x)) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.35e-261) tmp = -log(x) / n; elseif (x <= 5.5e-185) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 1.45) tmp = (x - log(x)) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.35e-261], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 5.5e-185], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.45], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{-261}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-185}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 1.45:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.3499999999999999e-261Initial program 32.0%
Taylor expanded in x around 0 32.0%
Taylor expanded in n around inf 67.3%
neg-mul-167.3%
distribute-neg-frac67.3%
Simplified67.3%
if 1.3499999999999999e-261 < x < 5.4999999999999998e-185Initial program 67.5%
Taylor expanded in x around 0 67.5%
if 5.4999999999999998e-185 < x < 1.44999999999999996Initial program 37.6%
Taylor expanded in n around inf 55.1%
Taylor expanded in x around 0 53.7%
neg-mul-153.7%
unsub-neg53.7%
Simplified53.7%
if 1.44999999999999996 < x Initial program 70.5%
sub-neg70.5%
+-commutative70.5%
add-log-exp70.5%
add-log-exp70.5%
sum-log70.5%
add-exp-log70.5%
log-pow70.5%
+-commutative70.5%
log1p-udef70.5%
*-commutative70.5%
un-div-inv70.5%
Applied egg-rr70.5%
Taylor expanded in x around inf 70.5%
exp-neg70.5%
rgt-mult-inverse70.5%
metadata-eval70.5%
Simplified70.5%
Final simplification64.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log x)) n)))
(if (<= x 5.65e-243)
t_0
(if (<= x 1.7e-224) (/ 1.0 (* n x)) (if (<= x 1.0) t_0 0.0)))))
double code(double x, double n) {
double t_0 = -log(x) / n;
double tmp;
if (x <= 5.65e-243) {
tmp = t_0;
} else if (x <= 1.7e-224) {
tmp = 1.0 / (n * x);
} else if (x <= 1.0) {
tmp = t_0;
} else {
tmp = 0.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 = -log(x) / n
if (x <= 5.65d-243) then
tmp = t_0
else if (x <= 1.7d-224) then
tmp = 1.0d0 / (n * x)
else if (x <= 1.0d0) then
tmp = t_0
else
tmp = 0.0d0
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 <= 5.65e-243) {
tmp = t_0;
} else if (x <= 1.7e-224) {
tmp = 1.0 / (n * x);
} else if (x <= 1.0) {
tmp = t_0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = -math.log(x) / n tmp = 0 if x <= 5.65e-243: tmp = t_0 elif x <= 1.7e-224: tmp = 1.0 / (n * x) elif x <= 1.0: tmp = t_0 else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 5.65e-243) tmp = t_0; elseif (x <= 1.7e-224) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 1.0) tmp = t_0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = -log(x) / n; tmp = 0.0; if (x <= 5.65e-243) tmp = t_0; elseif (x <= 1.7e-224) tmp = 1.0 / (n * x); elseif (x <= 1.0) tmp = t_0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 5.65e-243], t$95$0, If[LessEqual[x, 1.7e-224], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.0], t$95$0, 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 5.65 \cdot 10^{-243}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-224}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 5.64999999999999979e-243 or 1.69999999999999996e-224 < x < 1Initial program 42.0%
Taylor expanded in x around 0 39.9%
Taylor expanded in n around inf 53.2%
neg-mul-153.2%
distribute-neg-frac53.2%
Simplified53.2%
if 5.64999999999999979e-243 < x < 1.69999999999999996e-224Initial program 82.4%
Taylor expanded in n around inf 14.2%
Taylor expanded in x around inf 56.1%
*-commutative56.1%
Simplified56.1%
if 1 < x Initial program 69.9%
sub-neg69.9%
+-commutative69.9%
add-log-exp69.9%
add-log-exp69.9%
sum-log69.9%
add-exp-log69.9%
log-pow69.9%
+-commutative69.9%
log1p-udef69.9%
*-commutative69.9%
un-div-inv69.9%
Applied egg-rr69.9%
Taylor expanded in x around inf 69.9%
exp-neg69.8%
rgt-mult-inverse69.9%
metadata-eval69.9%
Simplified69.9%
Final simplification60.0%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -100000.0) 0.0 (* (/ 1.0 n) (/ 1.0 x))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -100000.0) {
tmp = 0.0;
} else {
tmp = (1.0 / n) * (1.0 / 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) <= (-100000.0d0)) then
tmp = 0.0d0
else
tmp = (1.0d0 / n) * (1.0d0 / x)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -100000.0) {
tmp = 0.0;
} else {
tmp = (1.0 / n) * (1.0 / x);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -100000.0: tmp = 0.0 else: tmp = (1.0 / n) * (1.0 / x) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -100000.0) tmp = 0.0; else tmp = Float64(Float64(1.0 / n) * Float64(1.0 / x)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -100000.0) tmp = 0.0; else tmp = (1.0 / n) * (1.0 / x); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -100000.0], 0.0, N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -100000:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1e5Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
add-log-exp100.0%
add-log-exp100.0%
sum-log100.0%
add-exp-log100.0%
log-pow100.0%
+-commutative100.0%
log1p-udef100.0%
*-commutative100.0%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 55.7%
exp-neg55.7%
rgt-mult-inverse56.4%
metadata-eval56.4%
Simplified56.4%
if -1e5 < (/.f64 1 n) Initial program 34.8%
Taylor expanded in n around inf 59.5%
Taylor expanded in x around inf 39.9%
*-commutative39.9%
Simplified39.9%
associate-/r*40.3%
div-inv40.3%
Applied egg-rr40.3%
Final simplification45.3%
(FPCore (x n) :precision binary64 (if (or (<= n -2.8e-5) (not (<= n -1.95e-305))) (/ 1.0 (* n x)) 0.0))
double code(double x, double n) {
double tmp;
if ((n <= -2.8e-5) || !(n <= -1.95e-305)) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2.8d-5)) .or. (.not. (n <= (-1.95d-305)))) then
tmp = 1.0d0 / (n * x)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((n <= -2.8e-5) || !(n <= -1.95e-305)) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if (n <= -2.8e-5) or not (n <= -1.95e-305): tmp = 1.0 / (n * x) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if ((n <= -2.8e-5) || !(n <= -1.95e-305)) tmp = Float64(1.0 / Float64(n * x)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((n <= -2.8e-5) || ~((n <= -1.95e-305))) tmp = 1.0 / (n * x); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[Or[LessEqual[n, -2.8e-5], N[Not[LessEqual[n, -1.95e-305]], $MachinePrecision]], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{-5} \lor \neg \left(n \leq -1.95 \cdot 10^{-305}\right):\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -2.79999999999999996e-5 or -1.95000000000000013e-305 < n Initial program 35.2%
Taylor expanded in n around inf 59.7%
Taylor expanded in x around inf 40.2%
*-commutative40.2%
Simplified40.2%
if -2.79999999999999996e-5 < n < -1.95000000000000013e-305Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
add-log-exp100.0%
add-log-exp100.0%
sum-log100.0%
add-exp-log100.0%
log-pow100.0%
+-commutative100.0%
log1p-udef100.0%
*-commutative100.0%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 56.4%
exp-neg56.4%
rgt-mult-inverse57.1%
metadata-eval57.1%
Simplified57.1%
Final simplification45.4%
(FPCore (x n) :precision binary64 (if (or (<= n -2.8e-5) (not (<= n -1.95e-305))) (/ (/ 1.0 x) n) 0.0))
double code(double x, double n) {
double tmp;
if ((n <= -2.8e-5) || !(n <= -1.95e-305)) {
tmp = (1.0 / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2.8d-5)) .or. (.not. (n <= (-1.95d-305)))) then
tmp = (1.0d0 / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((n <= -2.8e-5) || !(n <= -1.95e-305)) {
tmp = (1.0 / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if (n <= -2.8e-5) or not (n <= -1.95e-305): tmp = (1.0 / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if ((n <= -2.8e-5) || !(n <= -1.95e-305)) tmp = Float64(Float64(1.0 / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((n <= -2.8e-5) || ~((n <= -1.95e-305))) tmp = (1.0 / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[Or[LessEqual[n, -2.8e-5], N[Not[LessEqual[n, -1.95e-305]], $MachinePrecision]], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{-5} \lor \neg \left(n \leq -1.95 \cdot 10^{-305}\right):\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -2.79999999999999996e-5 or -1.95000000000000013e-305 < n Initial program 35.2%
Taylor expanded in n around inf 59.7%
Taylor expanded in x around inf 40.6%
if -2.79999999999999996e-5 < n < -1.95000000000000013e-305Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
add-log-exp100.0%
add-log-exp100.0%
sum-log100.0%
add-exp-log100.0%
log-pow100.0%
+-commutative100.0%
log1p-udef100.0%
*-commutative100.0%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 56.4%
exp-neg56.4%
rgt-mult-inverse57.1%
metadata-eval57.1%
Simplified57.1%
Final simplification45.6%
(FPCore (x n) :precision binary64 0.0)
double code(double x, double n) {
return 0.0;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double x, double n) {
return 0.0;
}
def code(x, n): return 0.0
function code(x, n) return 0.0 end
function tmp = code(x, n) tmp = 0.0; end
code[x_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 54.9%
sub-neg54.9%
+-commutative54.9%
add-log-exp54.6%
add-log-exp54.6%
sum-log54.6%
add-exp-log54.6%
log-pow54.6%
+-commutative54.6%
log1p-udef61.0%
*-commutative61.0%
un-div-inv61.0%
Applied egg-rr61.0%
Taylor expanded in x around inf 30.1%
exp-neg30.1%
rgt-mult-inverse30.4%
metadata-eval30.4%
Simplified30.4%
Final simplification30.4%
herbie shell --seed 2023310
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))