
(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 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow (pow (cbrt x) 2.0) (/ 1.0 n)))
(t_1 (pow (cbrt x) (/ 1.0 n)))
(t_2 (* t_1 t_0)))
(if (<= (/ 1.0 n) -5e-6)
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n)))
(if (<= (/ 1.0 n) 1e-14)
(/
(-
(+
(log1p x)
(/
(+
(* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0)))
(/
(+
(*
-0.16666666666666666
(- (pow (log x) 3.0) (pow (log1p x) 3.0)))
(/
(*
-0.041666666666666664
(- (pow (log x) 4.0) (pow (log1p x) 4.0)))
n))
n))
n))
(log x))
n)
(+ (fma (- t_1) t_0 t_2) (- (exp (/ (log1p x) n)) t_2))))))
double code(double x, double n) {
double t_0 = pow(pow(cbrt(x), 2.0), (1.0 / n));
double t_1 = pow(cbrt(x), (1.0 / n));
double t_2 = t_1 * t_0;
double tmp;
if ((1.0 / n) <= -5e-6) {
tmp = pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
} else if ((1.0 / n) <= 1e-14) {
tmp = ((log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) + (((-0.16666666666666666 * (pow(log(x), 3.0) - pow(log1p(x), 3.0))) + ((-0.041666666666666664 * (pow(log(x), 4.0) - pow(log1p(x), 4.0))) / n)) / n)) / n)) - log(x)) / n;
} else {
tmp = fma(-t_1, t_0, t_2) + (exp((log1p(x) / n)) - t_2);
}
return tmp;
}
function code(x, n) t_0 = (cbrt(x) ^ 2.0) ^ Float64(1.0 / n) t_1 = cbrt(x) ^ Float64(1.0 / n) t_2 = Float64(t_1 * t_0) tmp = 0.0 if (Float64(1.0 / n) <= -5e-6) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))); elseif (Float64(1.0 / n) <= 1e-14) tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) + Float64(Float64(Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) - (log1p(x) ^ 3.0))) + Float64(Float64(-0.041666666666666664 * Float64((log(x) ^ 4.0) - (log1p(x) ^ 4.0))) / n)) / n)) / n)) - log(x)) / n); else tmp = Float64(fma(Float64(-t_1), t_0, t_2) + Float64(exp(Float64(log1p(x) / n)) - t_2)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Power[x, 1/3], $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * t$95$0), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-6], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-14], 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[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.041666666666666664 * N[(N[Power[N[Log[x], $MachinePrecision], 4.0], $MachinePrecision] - N[Power[N[Log[1 + x], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[((-t$95$1) * t$95$0 + t$95$2), $MachinePrecision] + N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left({\left(\sqrt[3]{x}\right)}^{2}\right)}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(\sqrt[3]{x}\right)}^{\left(\frac{1}{n}\right)}\\
t_2 := t\_1 \cdot t\_0\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-6}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-14}:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + \frac{-0.16666666666666666 \cdot \left({\log x}^{3} - {\left(\mathsf{log1p}\left(x\right)\right)}^{3}\right) + \frac{-0.041666666666666664 \cdot \left({\log x}^{4} - {\left(\mathsf{log1p}\left(x\right)\right)}^{4}\right)}{n}}{n}}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-t\_1, t\_0, t\_2\right) + \left(e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_2\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5.00000000000000041e-6Initial program 98.7%
if -5.00000000000000041e-6 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999999e-15Initial program 25.0%
Taylor expanded in n around -inf 79.7%
Simplified79.7%
if 9.99999999999999999e-15 < (/.f64 #s(literal 1 binary64) n) Initial program 47.3%
*-un-lft-identity47.3%
add-cube-cbrt47.3%
unpow-prod-down47.3%
prod-diff47.3%
Applied egg-rr96.7%
+-commutative96.7%
fma-undefine96.7%
*-lft-identity96.7%
distribute-rgt-neg-in96.7%
Simplified96.7%
Final simplification90.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-6)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(if (<= (/ 1.0 n) 4e-9)
(/
(-
(+
(log1p x)
(/
(+
(* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0)))
(/
(+
(*
-0.16666666666666666
(- (pow (log x) 3.0) (pow (log1p x) 3.0)))
(/
(*
-0.041666666666666664
(- (pow (log x) 4.0) (pow (log1p x) 4.0)))
n))
n))
n))
(log 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) <= -5e-6) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 4e-9) {
tmp = ((log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) + (((-0.16666666666666666 * (pow(log(x), 3.0) - pow(log1p(x), 3.0))) + ((-0.041666666666666664 * (pow(log(x), 4.0) - pow(log1p(x), 4.0))) / n)) / n)) / n)) - log(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) <= -5e-6) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 4e-9) {
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.log(x), 3.0) - Math.pow(Math.log1p(x), 3.0))) + ((-0.041666666666666664 * (Math.pow(Math.log(x), 4.0) - Math.pow(Math.log1p(x), 4.0))) / n)) / n)) / n)) - Math.log(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) <= -5e-6: tmp = math.pow((x + 1.0), (1.0 / n)) - t_0 elif (1.0 / n) <= 4e-9: 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.log(x), 3.0) - math.pow(math.log1p(x), 3.0))) + ((-0.041666666666666664 * (math.pow(math.log(x), 4.0) - math.pow(math.log1p(x), 4.0))) / n)) / n)) / n)) - math.log(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) <= -5e-6) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); elseif (Float64(1.0 / n) <= 4e-9) tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) + Float64(Float64(Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) - (log1p(x) ^ 3.0))) + Float64(Float64(-0.041666666666666664 * Float64((log(x) ^ 4.0) - (log1p(x) ^ 4.0))) / n)) / n)) / n)) - log(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], -5e-6], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-9], 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[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.041666666666666664 * N[(N[Power[N[Log[x], $MachinePrecision], 4.0], $MachinePrecision] - N[Power[N[Log[1 + x], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-6}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-9}:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + \frac{-0.16666666666666666 \cdot \left({\log x}^{3} - {\left(\mathsf{log1p}\left(x\right)\right)}^{3}\right) + \frac{-0.041666666666666664 \cdot \left({\log x}^{4} - {\left(\mathsf{log1p}\left(x\right)\right)}^{4}\right)}{n}}{n}}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5.00000000000000041e-6Initial program 98.7%
if -5.00000000000000041e-6 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000025e-9Initial program 24.8%
Taylor expanded in n around -inf 79.0%
Simplified79.0%
if 4.00000000000000025e-9 < (/.f64 #s(literal 1 binary64) n) Initial program 48.0%
Taylor expanded in n around 0 28.6%
log1p-define58.6%
*-rgt-identity58.6%
associate-*l/58.6%
associate-/l*58.6%
exp-to-pow98.3%
Simplified98.3%
Final simplification90.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-6)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(if (<= (/ 1.0 n) 5e-16)
(/
(-
(log1p x)
(- (log x) (* 0.5 (/ (- (pow (log1p x) 2.0) (pow (log x) 2.0)) n))))
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) <= -2e-6) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 5e-16) {
tmp = (log1p(x) - (log(x) - (0.5 * ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) / n)))) / 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) <= -2e-6) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 5e-16) {
tmp = (Math.log1p(x) - (Math.log(x) - (0.5 * ((Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)) / n)))) / 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) <= -2e-6: tmp = math.pow((x + 1.0), (1.0 / n)) - t_0 elif (1.0 / n) <= 5e-16: tmp = (math.log1p(x) - (math.log(x) - (0.5 * ((math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0)) / n)))) / 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) <= -2e-6) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); elseif (Float64(1.0 / n) <= 5e-16) tmp = Float64(Float64(log1p(x) - Float64(log(x) - Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) / n)))) / 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], -2e-6], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-16], N[(N[(N[Log[1 + x], $MachinePrecision] - N[(N[Log[x], $MachinePrecision] - N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $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 -2 \cdot 10^{-6}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-16}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \left(\log x - 0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n}\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.99999999999999991e-6Initial program 98.5%
if -1.99999999999999991e-6 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000004e-16Initial program 24.7%
Taylor expanded in n around inf 80.2%
associate--l+80.2%
log1p-define80.2%
+-commutative80.2%
associate--r+80.2%
distribute-lft-out--80.2%
div-sub80.2%
log1p-define80.2%
Simplified80.2%
if 5.0000000000000004e-16 < (/.f64 #s(literal 1 binary64) n) Initial program 46.5%
Taylor expanded in n around 0 27.7%
log1p-define56.8%
*-rgt-identity56.8%
associate-*l/56.8%
associate-/l*56.8%
exp-to-pow95.1%
Simplified95.1%
Final simplification90.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-6)
(- (pow (+ 1.0 x) (/ 1.0 n)) t_0)
(if (<= (/ 1.0 n) 5e-16)
(/ (- (log1p x) (log 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) <= -2e-6) {
tmp = pow((1.0 + x), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 5e-16) {
tmp = (log1p(x) - log(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) <= -2e-6) {
tmp = Math.pow((1.0 + x), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 5e-16) {
tmp = (Math.log1p(x) - Math.log(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) <= -2e-6: tmp = math.pow((1.0 + x), (1.0 / n)) - t_0 elif (1.0 / n) <= 5e-16: tmp = (math.log1p(x) - math.log(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) <= -2e-6) tmp = Float64((Float64(1.0 + x) ^ Float64(1.0 / n)) - t_0); elseif (Float64(1.0 / n) <= 5e-16) tmp = Float64(Float64(log1p(x) - log(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], -2e-6], N[(N[Power[N[(1.0 + x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-16], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-6}:\\
\;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-16}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{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.99999999999999991e-6Initial program 98.5%
if -1.99999999999999991e-6 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000004e-16Initial program 24.7%
Taylor expanded in n around inf 80.1%
log1p-define80.1%
Simplified80.1%
if 5.0000000000000004e-16 < (/.f64 #s(literal 1 binary64) n) Initial program 46.5%
Taylor expanded in n around 0 27.7%
log1p-define56.8%
*-rgt-identity56.8%
associate-*l/56.8%
associate-/l*56.8%
exp-to-pow95.1%
Simplified95.1%
Final simplification90.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x -8.6e-239)
0.0
(if (<= x 9.2e-280)
(- (+ (/ x n) 1.0) t_0)
(if (<= x 3.8e-81)
(/ (log x) (- n))
(if (<= x 1.85e-5)
(log1p (expm1 (/ 1.0 (* n x))))
(/ (/ t_0 n) x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= -8.6e-239) {
tmp = 0.0;
} else if (x <= 9.2e-280) {
tmp = ((x / n) + 1.0) - t_0;
} else if (x <= 3.8e-81) {
tmp = log(x) / -n;
} else if (x <= 1.85e-5) {
tmp = log1p(expm1((1.0 / (n * x))));
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= -8.6e-239) {
tmp = 0.0;
} else if (x <= 9.2e-280) {
tmp = ((x / n) + 1.0) - t_0;
} else if (x <= 3.8e-81) {
tmp = Math.log(x) / -n;
} else if (x <= 1.85e-5) {
tmp = Math.log1p(Math.expm1((1.0 / (n * x))));
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= -8.6e-239: tmp = 0.0 elif x <= 9.2e-280: tmp = ((x / n) + 1.0) - t_0 elif x <= 3.8e-81: tmp = math.log(x) / -n elif x <= 1.85e-5: tmp = math.log1p(math.expm1((1.0 / (n * x)))) else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= -8.6e-239) tmp = 0.0; elseif (x <= 9.2e-280) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); elseif (x <= 3.8e-81) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 1.85e-5) tmp = log1p(expm1(Float64(1.0 / Float64(n * x)))); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -8.6e-239], 0.0, If[LessEqual[x, 9.2e-280], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 3.8e-81], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 1.85e-5], N[Log[1 + N[(Exp[N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq -8.6 \cdot 10^{-239}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{-280}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-81}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{n \cdot x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < -8.6000000000000001e-239Initial program 71.2%
sub-neg71.2%
+-commutative71.2%
add-log-exp71.2%
add-log-exp71.2%
sum-log71.2%
pow-to-exp12.1%
un-div-inv12.1%
+-commutative12.1%
log1p-define36.4%
Applied egg-rr36.4%
Taylor expanded in x around inf 0.0%
exp-neg0.0%
rgt-mult-inverse89.0%
metadata-eval89.0%
Simplified89.0%
if -8.6000000000000001e-239 < x < 9.1999999999999998e-280Initial program 64.6%
Taylor expanded in x around 0 64.9%
if 9.1999999999999998e-280 < x < 3.7999999999999999e-81Initial program 33.0%
Taylor expanded in x around 0 33.0%
*-rgt-identity33.0%
associate-*l/33.0%
associate-/l*33.0%
exp-to-pow33.0%
Simplified33.0%
Taylor expanded in n around inf 57.7%
associate-*r/57.7%
mul-1-neg57.7%
Simplified57.7%
if 3.7999999999999999e-81 < x < 1.84999999999999991e-5Initial program 51.7%
Taylor expanded in x around inf 35.8%
associate-/r*35.8%
mul-1-neg35.8%
log-rec35.8%
mul-1-neg35.8%
distribute-neg-frac35.8%
mul-1-neg35.8%
remove-double-neg35.8%
*-rgt-identity35.8%
associate-/l*35.8%
exp-to-pow35.8%
Simplified35.8%
Taylor expanded in n around inf 10.0%
*-commutative10.0%
Simplified10.0%
log1p-expm1-u59.6%
Applied egg-rr59.6%
if 1.84999999999999991e-5 < x Initial program 65.8%
Taylor expanded in x around inf 93.3%
associate-/r*94.4%
mul-1-neg94.4%
log-rec94.4%
mul-1-neg94.4%
distribute-neg-frac94.4%
mul-1-neg94.4%
remove-double-neg94.4%
*-rgt-identity94.4%
associate-/l*94.4%
exp-to-pow94.4%
Simplified94.4%
Final simplification75.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -20000.0)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 4e-9)
(/ (- (log1p x) (log x)) n)
(-
(+ (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))) 1.0)
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -20000.0) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 4e-9) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = ((x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n))) + 1.0) - 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) <= -20000.0) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 4e-9) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = ((x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n))) + 1.0) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -20000.0: tmp = (t_0 / n) / x elif (1.0 / n) <= 4e-9: tmp = (math.log1p(x) - math.log(x)) / n else: tmp = ((x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n))) + 1.0) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -20000.0) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 4e-9) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(Float64(Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n))) + 1.0) - 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], -20000.0], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-9], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $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 -20000:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-9}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right) + 1\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2e4Initial program 98.9%
Taylor expanded in x around inf 69.0%
associate-/r*69.0%
mul-1-neg69.0%
log-rec69.0%
mul-1-neg69.0%
distribute-neg-frac69.0%
mul-1-neg69.0%
remove-double-neg69.0%
*-rgt-identity69.0%
associate-/l*69.0%
exp-to-pow98.9%
Simplified98.9%
if -2e4 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000025e-9Initial program 25.4%
Taylor expanded in n around inf 77.9%
log1p-define77.9%
Simplified77.9%
if 4.00000000000000025e-9 < (/.f64 #s(literal 1 binary64) n) Initial program 48.0%
Taylor expanded in x around 0 58.0%
Taylor expanded in n around inf 61.5%
Final simplification81.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-6)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(if (<= (/ 1.0 n) 4e-9)
(/ (- (log1p x) (log x)) n)
(-
(+ (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))) 1.0)
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-6) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 4e-9) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = ((x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n))) + 1.0) - 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) <= -2e-6) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 4e-9) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = ((x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n))) + 1.0) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-6: tmp = math.pow((x + 1.0), (1.0 / n)) - t_0 elif (1.0 / n) <= 4e-9: tmp = (math.log1p(x) - math.log(x)) / n else: tmp = ((x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n))) + 1.0) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-6) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); elseif (Float64(1.0 / n) <= 4e-9) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(Float64(Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n))) + 1.0) - 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], -2e-6], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-9], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $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 -2 \cdot 10^{-6}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-9}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right) + 1\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999991e-6Initial program 98.5%
if -1.99999999999999991e-6 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000025e-9Initial program 24.3%
Taylor expanded in n around inf 78.7%
log1p-define78.7%
Simplified78.7%
if 4.00000000000000025e-9 < (/.f64 #s(literal 1 binary64) n) Initial program 48.0%
Taylor expanded in x around 0 58.0%
Taylor expanded in n around inf 61.5%
Final simplification81.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x -9.5e-239)
0.0
(if (<= x 7e-279)
(- (+ (/ x n) 1.0) t_0)
(if (<= x 8e-79)
(/ (log x) (- n))
(if (<= x 2.7e-62)
(- (- 1.0 (* x (- (/ -1.0 n) (* x (/ (+ -0.5 (/ 0.5 n)) n))))) t_0)
(if (<= x 0.0136)
(- (* x (+ (/ 1.0 n) (* -0.5 (/ x n)))) (/ (log x) n))
(/ (/ t_0 n) x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= -9.5e-239) {
tmp = 0.0;
} else if (x <= 7e-279) {
tmp = ((x / n) + 1.0) - t_0;
} else if (x <= 8e-79) {
tmp = log(x) / -n;
} else if (x <= 2.7e-62) {
tmp = (1.0 - (x * ((-1.0 / n) - (x * ((-0.5 + (0.5 / n)) / n))))) - t_0;
} else if (x <= 0.0136) {
tmp = (x * ((1.0 / n) + (-0.5 * (x / n)))) - (log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= (-9.5d-239)) then
tmp = 0.0d0
else if (x <= 7d-279) then
tmp = ((x / n) + 1.0d0) - t_0
else if (x <= 8d-79) then
tmp = log(x) / -n
else if (x <= 2.7d-62) then
tmp = (1.0d0 - (x * (((-1.0d0) / n) - (x * (((-0.5d0) + (0.5d0 / n)) / n))))) - t_0
else if (x <= 0.0136d0) then
tmp = (x * ((1.0d0 / n) + ((-0.5d0) * (x / n)))) - (log(x) / n)
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= -9.5e-239) {
tmp = 0.0;
} else if (x <= 7e-279) {
tmp = ((x / n) + 1.0) - t_0;
} else if (x <= 8e-79) {
tmp = Math.log(x) / -n;
} else if (x <= 2.7e-62) {
tmp = (1.0 - (x * ((-1.0 / n) - (x * ((-0.5 + (0.5 / n)) / n))))) - t_0;
} else if (x <= 0.0136) {
tmp = (x * ((1.0 / n) + (-0.5 * (x / n)))) - (Math.log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= -9.5e-239: tmp = 0.0 elif x <= 7e-279: tmp = ((x / n) + 1.0) - t_0 elif x <= 8e-79: tmp = math.log(x) / -n elif x <= 2.7e-62: tmp = (1.0 - (x * ((-1.0 / n) - (x * ((-0.5 + (0.5 / n)) / n))))) - t_0 elif x <= 0.0136: tmp = (x * ((1.0 / n) + (-0.5 * (x / n)))) - (math.log(x) / n) else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= -9.5e-239) tmp = 0.0; elseif (x <= 7e-279) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); elseif (x <= 8e-79) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 2.7e-62) tmp = Float64(Float64(1.0 - Float64(x * Float64(Float64(-1.0 / n) - Float64(x * Float64(Float64(-0.5 + Float64(0.5 / n)) / n))))) - t_0); elseif (x <= 0.0136) tmp = Float64(Float64(x * Float64(Float64(1.0 / n) + Float64(-0.5 * Float64(x / n)))) - Float64(log(x) / n)); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= -9.5e-239) tmp = 0.0; elseif (x <= 7e-279) tmp = ((x / n) + 1.0) - t_0; elseif (x <= 8e-79) tmp = log(x) / -n; elseif (x <= 2.7e-62) tmp = (1.0 - (x * ((-1.0 / n) - (x * ((-0.5 + (0.5 / n)) / n))))) - t_0; elseif (x <= 0.0136) tmp = (x * ((1.0 / n) + (-0.5 * (x / n)))) - (log(x) / n); else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -9.5e-239], 0.0, If[LessEqual[x, 7e-279], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 8e-79], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 2.7e-62], N[(N[(1.0 - N[(x * N[(N[(-1.0 / n), $MachinePrecision] - N[(x * N[(N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 0.0136], N[(N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(-0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{-239}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-279}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-79}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-62}:\\
\;\;\;\;\left(1 - x \cdot \left(\frac{-1}{n} - x \cdot \frac{-0.5 + \frac{0.5}{n}}{n}\right)\right) - t\_0\\
\mathbf{elif}\;x \leq 0.0136:\\
\;\;\;\;x \cdot \left(\frac{1}{n} + -0.5 \cdot \frac{x}{n}\right) - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < -9.4999999999999992e-239Initial program 71.2%
sub-neg71.2%
+-commutative71.2%
add-log-exp71.2%
add-log-exp71.2%
sum-log71.2%
pow-to-exp12.1%
un-div-inv12.1%
+-commutative12.1%
log1p-define36.4%
Applied egg-rr36.4%
Taylor expanded in x around inf 0.0%
exp-neg0.0%
rgt-mult-inverse89.0%
metadata-eval89.0%
Simplified89.0%
if -9.4999999999999992e-239 < x < 7.00000000000000019e-279Initial program 64.6%
Taylor expanded in x around 0 64.9%
if 7.00000000000000019e-279 < x < 8e-79Initial program 33.9%
Taylor expanded in x around 0 33.9%
*-rgt-identity33.9%
associate-*l/33.9%
associate-/l*33.9%
exp-to-pow33.9%
Simplified33.9%
Taylor expanded in n around inf 57.1%
associate-*r/57.1%
mul-1-neg57.1%
Simplified57.1%
if 8e-79 < x < 2.70000000000000019e-62Initial program 56.1%
Taylor expanded in x around 0 84.0%
Taylor expanded in n around inf 70.5%
Taylor expanded in x around 0 70.5%
associate-/l*84.0%
sub-neg84.0%
associate-*r/84.0%
metadata-eval84.0%
metadata-eval84.0%
Simplified84.0%
if 2.70000000000000019e-62 < x < 0.0135999999999999992Initial program 42.1%
Taylor expanded in x around 0 29.2%
Taylor expanded in n around inf 48.4%
Taylor expanded in x around 0 48.4%
if 0.0135999999999999992 < x Initial program 68.2%
Taylor expanded in x around inf 96.3%
associate-/r*97.4%
mul-1-neg97.4%
log-rec97.4%
mul-1-neg97.4%
distribute-neg-frac97.4%
mul-1-neg97.4%
remove-double-neg97.4%
*-rgt-identity97.4%
associate-/l*97.4%
exp-to-pow97.4%
Simplified97.4%
Final simplification75.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (+ (/ x n) 1.0) t_0)))
(if (<= x -9.5e-239)
0.0
(if (<= x 9.5e-280)
t_1
(if (<= x 1.05e-79)
(/ (log x) (- n))
(if (<= x 2.05e-19)
t_1
(if (<= x 0.0136)
(- (* x (+ (/ 1.0 n) (* -0.5 (/ x n)))) (/ (log x) n))
(/ (/ t_0 n) x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = ((x / n) + 1.0) - t_0;
double tmp;
if (x <= -9.5e-239) {
tmp = 0.0;
} else if (x <= 9.5e-280) {
tmp = t_1;
} else if (x <= 1.05e-79) {
tmp = log(x) / -n;
} else if (x <= 2.05e-19) {
tmp = t_1;
} else if (x <= 0.0136) {
tmp = (x * ((1.0 / n) + (-0.5 * (x / n)))) - (log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = ((x / n) + 1.0d0) - t_0
if (x <= (-9.5d-239)) then
tmp = 0.0d0
else if (x <= 9.5d-280) then
tmp = t_1
else if (x <= 1.05d-79) then
tmp = log(x) / -n
else if (x <= 2.05d-19) then
tmp = t_1
else if (x <= 0.0136d0) then
tmp = (x * ((1.0d0 / n) + ((-0.5d0) * (x / n)))) - (log(x) / n)
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = ((x / n) + 1.0) - t_0;
double tmp;
if (x <= -9.5e-239) {
tmp = 0.0;
} else if (x <= 9.5e-280) {
tmp = t_1;
} else if (x <= 1.05e-79) {
tmp = Math.log(x) / -n;
} else if (x <= 2.05e-19) {
tmp = t_1;
} else if (x <= 0.0136) {
tmp = (x * ((1.0 / n) + (-0.5 * (x / n)))) - (Math.log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = ((x / n) + 1.0) - t_0 tmp = 0 if x <= -9.5e-239: tmp = 0.0 elif x <= 9.5e-280: tmp = t_1 elif x <= 1.05e-79: tmp = math.log(x) / -n elif x <= 2.05e-19: tmp = t_1 elif x <= 0.0136: tmp = (x * ((1.0 / n) + (-0.5 * (x / n)))) - (math.log(x) / n) else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(Float64(x / n) + 1.0) - t_0) tmp = 0.0 if (x <= -9.5e-239) tmp = 0.0; elseif (x <= 9.5e-280) tmp = t_1; elseif (x <= 1.05e-79) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 2.05e-19) tmp = t_1; elseif (x <= 0.0136) tmp = Float64(Float64(x * Float64(Float64(1.0 / n) + Float64(-0.5 * Float64(x / n)))) - Float64(log(x) / n)); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = ((x / n) + 1.0) - t_0; tmp = 0.0; if (x <= -9.5e-239) tmp = 0.0; elseif (x <= 9.5e-280) tmp = t_1; elseif (x <= 1.05e-79) tmp = log(x) / -n; elseif (x <= 2.05e-19) tmp = t_1; elseif (x <= 0.0136) tmp = (x * ((1.0 / n) + (-0.5 * (x / n)))) - (log(x) / n); else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[x, -9.5e-239], 0.0, If[LessEqual[x, 9.5e-280], t$95$1, If[LessEqual[x, 1.05e-79], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 2.05e-19], t$95$1, If[LessEqual[x, 0.0136], N[(N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(-0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{-239}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-280}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-79}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.0136:\\
\;\;\;\;x \cdot \left(\frac{1}{n} + -0.5 \cdot \frac{x}{n}\right) - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < -9.4999999999999992e-239Initial program 71.2%
sub-neg71.2%
+-commutative71.2%
add-log-exp71.2%
add-log-exp71.2%
sum-log71.2%
pow-to-exp12.1%
un-div-inv12.1%
+-commutative12.1%
log1p-define36.4%
Applied egg-rr36.4%
Taylor expanded in x around inf 0.0%
exp-neg0.0%
rgt-mult-inverse89.0%
metadata-eval89.0%
Simplified89.0%
if -9.4999999999999992e-239 < x < 9.50000000000000082e-280 or 1.05e-79 < x < 2.04999999999999993e-19Initial program 58.3%
Taylor expanded in x around 0 58.5%
if 9.50000000000000082e-280 < x < 1.05e-79Initial program 33.0%
Taylor expanded in x around 0 33.0%
*-rgt-identity33.0%
associate-*l/33.0%
associate-/l*33.0%
exp-to-pow33.0%
Simplified33.0%
Taylor expanded in n around inf 57.7%
associate-*r/57.7%
mul-1-neg57.7%
Simplified57.7%
if 2.04999999999999993e-19 < x < 0.0135999999999999992Initial program 23.3%
Taylor expanded in x around 0 23.3%
Taylor expanded in n around inf 67.8%
Taylor expanded in x around 0 67.9%
if 0.0135999999999999992 < x Initial program 68.2%
Taylor expanded in x around inf 96.3%
associate-/r*97.4%
mul-1-neg97.4%
log-rec97.4%
mul-1-neg97.4%
distribute-neg-frac97.4%
mul-1-neg97.4%
remove-double-neg97.4%
*-rgt-identity97.4%
associate-/l*97.4%
exp-to-pow97.4%
Simplified97.4%
Final simplification75.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (+ (/ x n) 1.0) t_0)))
(if (<= x -9.5e-239)
0.0
(if (<= x 1.05e-278)
t_1
(if (<= x 3.2e-79)
(/ (log x) (- n))
(if (<= x 8.2e-17)
t_1
(if (<= x 0.018)
(/ (- (* x (+ (* x -0.5) 1.0)) (log x)) n)
(/ (/ t_0 n) x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = ((x / n) + 1.0) - t_0;
double tmp;
if (x <= -9.5e-239) {
tmp = 0.0;
} else if (x <= 1.05e-278) {
tmp = t_1;
} else if (x <= 3.2e-79) {
tmp = log(x) / -n;
} else if (x <= 8.2e-17) {
tmp = t_1;
} else if (x <= 0.018) {
tmp = ((x * ((x * -0.5) + 1.0)) - log(x)) / n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = ((x / n) + 1.0d0) - t_0
if (x <= (-9.5d-239)) then
tmp = 0.0d0
else if (x <= 1.05d-278) then
tmp = t_1
else if (x <= 3.2d-79) then
tmp = log(x) / -n
else if (x <= 8.2d-17) then
tmp = t_1
else if (x <= 0.018d0) then
tmp = ((x * ((x * (-0.5d0)) + 1.0d0)) - log(x)) / n
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = ((x / n) + 1.0) - t_0;
double tmp;
if (x <= -9.5e-239) {
tmp = 0.0;
} else if (x <= 1.05e-278) {
tmp = t_1;
} else if (x <= 3.2e-79) {
tmp = Math.log(x) / -n;
} else if (x <= 8.2e-17) {
tmp = t_1;
} else if (x <= 0.018) {
tmp = ((x * ((x * -0.5) + 1.0)) - Math.log(x)) / n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = ((x / n) + 1.0) - t_0 tmp = 0 if x <= -9.5e-239: tmp = 0.0 elif x <= 1.05e-278: tmp = t_1 elif x <= 3.2e-79: tmp = math.log(x) / -n elif x <= 8.2e-17: tmp = t_1 elif x <= 0.018: tmp = ((x * ((x * -0.5) + 1.0)) - math.log(x)) / n else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(Float64(x / n) + 1.0) - t_0) tmp = 0.0 if (x <= -9.5e-239) tmp = 0.0; elseif (x <= 1.05e-278) tmp = t_1; elseif (x <= 3.2e-79) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 8.2e-17) tmp = t_1; elseif (x <= 0.018) tmp = Float64(Float64(Float64(x * Float64(Float64(x * -0.5) + 1.0)) - log(x)) / n); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = ((x / n) + 1.0) - t_0; tmp = 0.0; if (x <= -9.5e-239) tmp = 0.0; elseif (x <= 1.05e-278) tmp = t_1; elseif (x <= 3.2e-79) tmp = log(x) / -n; elseif (x <= 8.2e-17) tmp = t_1; elseif (x <= 0.018) tmp = ((x * ((x * -0.5) + 1.0)) - log(x)) / n; else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[x, -9.5e-239], 0.0, If[LessEqual[x, 1.05e-278], t$95$1, If[LessEqual[x, 3.2e-79], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 8.2e-17], t$95$1, If[LessEqual[x, 0.018], N[(N[(N[(x * N[(N[(x * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{-239}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-278}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-79}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.018:\\
\;\;\;\;\frac{x \cdot \left(x \cdot -0.5 + 1\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < -9.4999999999999992e-239Initial program 71.2%
sub-neg71.2%
+-commutative71.2%
add-log-exp71.2%
add-log-exp71.2%
sum-log71.2%
pow-to-exp12.1%
un-div-inv12.1%
+-commutative12.1%
log1p-define36.4%
Applied egg-rr36.4%
Taylor expanded in x around inf 0.0%
exp-neg0.0%
rgt-mult-inverse89.0%
metadata-eval89.0%
Simplified89.0%
if -9.4999999999999992e-239 < x < 1.05000000000000007e-278 or 3.19999999999999988e-79 < x < 8.2000000000000001e-17Initial program 58.3%
Taylor expanded in x around 0 58.5%
if 1.05000000000000007e-278 < x < 3.19999999999999988e-79Initial program 33.0%
Taylor expanded in x around 0 33.0%
*-rgt-identity33.0%
associate-*l/33.0%
associate-/l*33.0%
exp-to-pow33.0%
Simplified33.0%
Taylor expanded in n around inf 57.7%
associate-*r/57.7%
mul-1-neg57.7%
Simplified57.7%
if 8.2000000000000001e-17 < x < 0.0179999999999999986Initial program 23.3%
Taylor expanded in x around 0 23.3%
Taylor expanded in n around inf 67.8%
if 0.0179999999999999986 < x Initial program 68.2%
Taylor expanded in x around inf 96.3%
associate-/r*97.4%
mul-1-neg97.4%
log-rec97.4%
mul-1-neg97.4%
distribute-neg-frac97.4%
mul-1-neg97.4%
remove-double-neg97.4%
*-rgt-identity97.4%
associate-/l*97.4%
exp-to-pow97.4%
Simplified97.4%
Final simplification75.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- 1.0 t_0)))
(if (<= x -9.5e-239)
0.0
(if (<= x 8e-280)
t_1
(if (<= x 4.8e-80)
(/ (log x) (- n))
(if (<= x 1.56e-15)
t_1
(if (<= x 0.0136) (- (/ x n) (/ (log x) n)) (/ (/ t_0 n) x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = 1.0 - t_0;
double tmp;
if (x <= -9.5e-239) {
tmp = 0.0;
} else if (x <= 8e-280) {
tmp = t_1;
} else if (x <= 4.8e-80) {
tmp = log(x) / -n;
} else if (x <= 1.56e-15) {
tmp = t_1;
} else if (x <= 0.0136) {
tmp = (x / n) - (log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = 1.0d0 - t_0
if (x <= (-9.5d-239)) then
tmp = 0.0d0
else if (x <= 8d-280) then
tmp = t_1
else if (x <= 4.8d-80) then
tmp = log(x) / -n
else if (x <= 1.56d-15) then
tmp = t_1
else if (x <= 0.0136d0) then
tmp = (x / n) - (log(x) / n)
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = 1.0 - t_0;
double tmp;
if (x <= -9.5e-239) {
tmp = 0.0;
} else if (x <= 8e-280) {
tmp = t_1;
} else if (x <= 4.8e-80) {
tmp = Math.log(x) / -n;
} else if (x <= 1.56e-15) {
tmp = t_1;
} else if (x <= 0.0136) {
tmp = (x / n) - (Math.log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = 1.0 - t_0 tmp = 0 if x <= -9.5e-239: tmp = 0.0 elif x <= 8e-280: tmp = t_1 elif x <= 4.8e-80: tmp = math.log(x) / -n elif x <= 1.56e-15: tmp = t_1 elif x <= 0.0136: tmp = (x / n) - (math.log(x) / n) else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(1.0 - t_0) tmp = 0.0 if (x <= -9.5e-239) tmp = 0.0; elseif (x <= 8e-280) tmp = t_1; elseif (x <= 4.8e-80) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 1.56e-15) tmp = t_1; elseif (x <= 0.0136) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = 1.0 - t_0; tmp = 0.0; if (x <= -9.5e-239) tmp = 0.0; elseif (x <= 8e-280) tmp = t_1; elseif (x <= 4.8e-80) tmp = log(x) / -n; elseif (x <= 1.56e-15) tmp = t_1; elseif (x <= 0.0136) tmp = (x / n) - (log(x) / n); else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - t$95$0), $MachinePrecision]}, If[LessEqual[x, -9.5e-239], 0.0, If[LessEqual[x, 8e-280], t$95$1, If[LessEqual[x, 4.8e-80], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 1.56e-15], t$95$1, If[LessEqual[x, 0.0136], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := 1 - t\_0\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{-239}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-280}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-80}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 1.56 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.0136:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < -9.4999999999999992e-239Initial program 71.2%
sub-neg71.2%
+-commutative71.2%
add-log-exp71.2%
add-log-exp71.2%
sum-log71.2%
pow-to-exp12.1%
un-div-inv12.1%
+-commutative12.1%
log1p-define36.4%
Applied egg-rr36.4%
Taylor expanded in x around inf 0.0%
exp-neg0.0%
rgt-mult-inverse89.0%
metadata-eval89.0%
Simplified89.0%
if -9.4999999999999992e-239 < x < 7.9999999999999997e-280 or 4.7999999999999998e-80 < x < 1.55999999999999991e-15Initial program 58.3%
Taylor expanded in x around 0 47.1%
*-rgt-identity47.1%
associate-*l/47.1%
associate-/l*47.1%
exp-to-pow58.3%
Simplified58.3%
if 7.9999999999999997e-280 < x < 4.7999999999999998e-80Initial program 33.0%
Taylor expanded in x around 0 33.0%
*-rgt-identity33.0%
associate-*l/33.0%
associate-/l*33.0%
exp-to-pow33.0%
Simplified33.0%
Taylor expanded in n around inf 57.7%
associate-*r/57.7%
mul-1-neg57.7%
Simplified57.7%
if 1.55999999999999991e-15 < x < 0.0135999999999999992Initial program 23.3%
Taylor expanded in x around 0 23.3%
Taylor expanded in n around inf 67.8%
Taylor expanded in x around 0 57.0%
+-commutative57.0%
neg-mul-157.0%
unsub-neg57.0%
Simplified57.0%
if 0.0135999999999999992 < x Initial program 68.2%
Taylor expanded in x around inf 96.3%
associate-/r*97.4%
mul-1-neg97.4%
log-rec97.4%
mul-1-neg97.4%
distribute-neg-frac97.4%
mul-1-neg97.4%
remove-double-neg97.4%
*-rgt-identity97.4%
associate-/l*97.4%
exp-to-pow97.4%
Simplified97.4%
Final simplification75.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (+ (/ x n) 1.0) t_0)))
(if (<= x -7e-239)
0.0
(if (<= x 2.55e-279)
t_1
(if (<= x 1.6e-80)
(/ (log x) (- n))
(if (<= x 3.2e-19)
t_1
(if (<= x 0.0185) (- (/ x n) (/ (log x) n)) (/ (/ t_0 n) x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = ((x / n) + 1.0) - t_0;
double tmp;
if (x <= -7e-239) {
tmp = 0.0;
} else if (x <= 2.55e-279) {
tmp = t_1;
} else if (x <= 1.6e-80) {
tmp = log(x) / -n;
} else if (x <= 3.2e-19) {
tmp = t_1;
} else if (x <= 0.0185) {
tmp = (x / n) - (log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = ((x / n) + 1.0d0) - t_0
if (x <= (-7d-239)) then
tmp = 0.0d0
else if (x <= 2.55d-279) then
tmp = t_1
else if (x <= 1.6d-80) then
tmp = log(x) / -n
else if (x <= 3.2d-19) then
tmp = t_1
else if (x <= 0.0185d0) then
tmp = (x / n) - (log(x) / n)
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = ((x / n) + 1.0) - t_0;
double tmp;
if (x <= -7e-239) {
tmp = 0.0;
} else if (x <= 2.55e-279) {
tmp = t_1;
} else if (x <= 1.6e-80) {
tmp = Math.log(x) / -n;
} else if (x <= 3.2e-19) {
tmp = t_1;
} else if (x <= 0.0185) {
tmp = (x / n) - (Math.log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = ((x / n) + 1.0) - t_0 tmp = 0 if x <= -7e-239: tmp = 0.0 elif x <= 2.55e-279: tmp = t_1 elif x <= 1.6e-80: tmp = math.log(x) / -n elif x <= 3.2e-19: tmp = t_1 elif x <= 0.0185: tmp = (x / n) - (math.log(x) / n) else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(Float64(x / n) + 1.0) - t_0) tmp = 0.0 if (x <= -7e-239) tmp = 0.0; elseif (x <= 2.55e-279) tmp = t_1; elseif (x <= 1.6e-80) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 3.2e-19) tmp = t_1; elseif (x <= 0.0185) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = ((x / n) + 1.0) - t_0; tmp = 0.0; if (x <= -7e-239) tmp = 0.0; elseif (x <= 2.55e-279) tmp = t_1; elseif (x <= 1.6e-80) tmp = log(x) / -n; elseif (x <= 3.2e-19) tmp = t_1; elseif (x <= 0.0185) tmp = (x / n) - (log(x) / n); else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[x, -7e-239], 0.0, If[LessEqual[x, 2.55e-279], t$95$1, If[LessEqual[x, 1.6e-80], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 3.2e-19], t$95$1, If[LessEqual[x, 0.0185], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{if}\;x \leq -7 \cdot 10^{-239}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2.55 \cdot 10^{-279}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-80}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.0185:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < -7.00000000000000011e-239Initial program 71.2%
sub-neg71.2%
+-commutative71.2%
add-log-exp71.2%
add-log-exp71.2%
sum-log71.2%
pow-to-exp12.1%
un-div-inv12.1%
+-commutative12.1%
log1p-define36.4%
Applied egg-rr36.4%
Taylor expanded in x around inf 0.0%
exp-neg0.0%
rgt-mult-inverse89.0%
metadata-eval89.0%
Simplified89.0%
if -7.00000000000000011e-239 < x < 2.54999999999999982e-279 or 1.5999999999999999e-80 < x < 3.19999999999999982e-19Initial program 58.3%
Taylor expanded in x around 0 58.5%
if 2.54999999999999982e-279 < x < 1.5999999999999999e-80Initial program 33.0%
Taylor expanded in x around 0 33.0%
*-rgt-identity33.0%
associate-*l/33.0%
associate-/l*33.0%
exp-to-pow33.0%
Simplified33.0%
Taylor expanded in n around inf 57.7%
associate-*r/57.7%
mul-1-neg57.7%
Simplified57.7%
if 3.19999999999999982e-19 < x < 0.0184999999999999991Initial program 23.3%
Taylor expanded in x around 0 23.3%
Taylor expanded in n around inf 67.8%
Taylor expanded in x around 0 57.0%
+-commutative57.0%
neg-mul-157.0%
unsub-neg57.0%
Simplified57.0%
if 0.0184999999999999991 < x Initial program 68.2%
Taylor expanded in x around inf 96.3%
associate-/r*97.4%
mul-1-neg97.4%
log-rec97.4%
mul-1-neg97.4%
distribute-neg-frac97.4%
mul-1-neg97.4%
remove-double-neg97.4%
*-rgt-identity97.4%
associate-/l*97.4%
exp-to-pow97.4%
Simplified97.4%
Final simplification75.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x -9.5e-239)
0.0
(if (<= x 1.4e-279)
t_0
(if (<= x 5e-80)
(/ (log x) (- n))
(if (<= x 1.0)
t_0
(if (or (<= x 2.1e+54) (and (not (<= x 9.5e+98)) (<= x 2.5e+161)))
(/ (/ 1.0 n) x)
0.0)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= -9.5e-239) {
tmp = 0.0;
} else if (x <= 1.4e-279) {
tmp = t_0;
} else if (x <= 5e-80) {
tmp = log(x) / -n;
} else if (x <= 1.0) {
tmp = t_0;
} else if ((x <= 2.1e+54) || (!(x <= 9.5e+98) && (x <= 2.5e+161))) {
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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= (-9.5d-239)) then
tmp = 0.0d0
else if (x <= 1.4d-279) then
tmp = t_0
else if (x <= 5d-80) then
tmp = log(x) / -n
else if (x <= 1.0d0) then
tmp = t_0
else if ((x <= 2.1d+54) .or. (.not. (x <= 9.5d+98)) .and. (x <= 2.5d+161)) 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 t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if (x <= -9.5e-239) {
tmp = 0.0;
} else if (x <= 1.4e-279) {
tmp = t_0;
} else if (x <= 5e-80) {
tmp = Math.log(x) / -n;
} else if (x <= 1.0) {
tmp = t_0;
} else if ((x <= 2.1e+54) || (!(x <= 9.5e+98) && (x <= 2.5e+161))) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if x <= -9.5e-239: tmp = 0.0 elif x <= 1.4e-279: tmp = t_0 elif x <= 5e-80: tmp = math.log(x) / -n elif x <= 1.0: tmp = t_0 elif (x <= 2.1e+54) or (not (x <= 9.5e+98) and (x <= 2.5e+161)): tmp = (1.0 / n) / x else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (x <= -9.5e-239) tmp = 0.0; elseif (x <= 1.4e-279) tmp = t_0; elseif (x <= 5e-80) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 1.0) tmp = t_0; elseif ((x <= 2.1e+54) || (!(x <= 9.5e+98) && (x <= 2.5e+161))) tmp = Float64(Float64(1.0 / n) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= -9.5e-239) tmp = 0.0; elseif (x <= 1.4e-279) tmp = t_0; elseif (x <= 5e-80) tmp = log(x) / -n; elseif (x <= 1.0) tmp = t_0; elseif ((x <= 2.1e+54) || (~((x <= 9.5e+98)) && (x <= 2.5e+161))) tmp = (1.0 / n) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.5e-239], 0.0, If[LessEqual[x, 1.4e-279], t$95$0, If[LessEqual[x, 5e-80], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 1.0], t$95$0, If[Or[LessEqual[x, 2.1e+54], And[N[Not[LessEqual[x, 9.5e+98]], $MachinePrecision], LessEqual[x, 2.5e+161]]], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], 0.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{-239}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-279}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-80}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+54} \lor \neg \left(x \leq 9.5 \cdot 10^{+98}\right) \land x \leq 2.5 \cdot 10^{+161}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -9.4999999999999992e-239 or 2.09999999999999986e54 < x < 9.5000000000000001e98 or 2.4999999999999998e161 < x Initial program 79.9%
sub-neg79.9%
+-commutative79.9%
add-log-exp79.9%
add-log-exp79.9%
sum-log79.9%
pow-to-exp50.0%
un-div-inv50.0%
+-commutative50.0%
log1p-define62.3%
Applied egg-rr62.3%
Taylor expanded in x around inf 43.9%
exp-neg43.9%
rgt-mult-inverse88.9%
metadata-eval88.9%
Simplified88.9%
if -9.4999999999999992e-239 < x < 1.4e-279 or 5e-80 < x < 1Initial program 56.7%
Taylor expanded in x around 0 45.2%
*-rgt-identity45.2%
associate-*l/45.2%
associate-/l*45.2%
exp-to-pow55.1%
Simplified55.1%
if 1.4e-279 < x < 5e-80Initial program 33.0%
Taylor expanded in x around 0 33.0%
*-rgt-identity33.0%
associate-*l/33.0%
associate-/l*33.0%
exp-to-pow33.0%
Simplified33.0%
Taylor expanded in n around inf 57.7%
associate-*r/57.7%
mul-1-neg57.7%
Simplified57.7%
if 1 < x < 2.09999999999999986e54 or 9.5000000000000001e98 < x < 2.4999999999999998e161Initial program 40.2%
Taylor expanded in x around inf 91.9%
associate-/r*94.1%
mul-1-neg94.1%
log-rec94.1%
mul-1-neg94.1%
distribute-neg-frac94.1%
mul-1-neg94.1%
remove-double-neg94.1%
*-rgt-identity94.1%
associate-/l*94.1%
exp-to-pow94.1%
Simplified94.1%
Taylor expanded in n around inf 75.1%
Final simplification70.0%
(FPCore (x n)
:precision binary64
(if (<= x -5e-310)
0.0
(if (<= x 0.023)
(/ (- x (log x)) n)
(if (or (<= x 1.4e+54) (and (not (<= x 1.8e+94)) (<= x 2e+161)))
(/ (/ 1.0 n) x)
0.0))))
double code(double x, double n) {
double tmp;
if (x <= -5e-310) {
tmp = 0.0;
} else if (x <= 0.023) {
tmp = (x - log(x)) / n;
} else if ((x <= 1.4e+54) || (!(x <= 1.8e+94) && (x <= 2e+161))) {
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 (x <= (-5d-310)) then
tmp = 0.0d0
else if (x <= 0.023d0) then
tmp = (x - log(x)) / n
else if ((x <= 1.4d+54) .or. (.not. (x <= 1.8d+94)) .and. (x <= 2d+161)) 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 (x <= -5e-310) {
tmp = 0.0;
} else if (x <= 0.023) {
tmp = (x - Math.log(x)) / n;
} else if ((x <= 1.4e+54) || (!(x <= 1.8e+94) && (x <= 2e+161))) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= -5e-310: tmp = 0.0 elif x <= 0.023: tmp = (x - math.log(x)) / n elif (x <= 1.4e+54) or (not (x <= 1.8e+94) and (x <= 2e+161)): tmp = (1.0 / n) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= -5e-310) tmp = 0.0; elseif (x <= 0.023) tmp = Float64(Float64(x - log(x)) / n); elseif ((x <= 1.4e+54) || (!(x <= 1.8e+94) && (x <= 2e+161))) tmp = Float64(Float64(1.0 / n) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= -5e-310) tmp = 0.0; elseif (x <= 0.023) tmp = (x - log(x)) / n; elseif ((x <= 1.4e+54) || (~((x <= 1.8e+94)) && (x <= 2e+161))) tmp = (1.0 / n) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, -5e-310], 0.0, If[LessEqual[x, 0.023], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[Or[LessEqual[x, 1.4e+54], And[N[Not[LessEqual[x, 1.8e+94]], $MachinePrecision], LessEqual[x, 2e+161]]], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-310}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 0.023:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+54} \lor \neg \left(x \leq 1.8 \cdot 10^{+94}\right) \land x \leq 2 \cdot 10^{+161}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -4.999999999999985e-310 or 1.40000000000000008e54 < x < 1.79999999999999996e94 or 2.0000000000000001e161 < x Initial program 80.3%
sub-neg80.3%
+-commutative80.3%
add-log-exp80.3%
add-log-exp80.3%
sum-log80.3%
pow-to-exp52.6%
un-div-inv52.6%
+-commutative52.6%
log1p-define65.1%
Applied egg-rr65.1%
Taylor expanded in x around inf 40.6%
exp-neg40.6%
rgt-mult-inverse83.5%
metadata-eval83.5%
Simplified83.5%
if -4.999999999999985e-310 < x < 0.023Initial program 40.4%
Taylor expanded in x around 0 40.2%
Taylor expanded in n around inf 51.4%
Taylor expanded in x around 0 50.9%
if 0.023 < x < 1.40000000000000008e54 or 1.79999999999999996e94 < x < 2.0000000000000001e161Initial program 43.6%
Taylor expanded in x around inf 92.3%
associate-/r*94.5%
mul-1-neg94.5%
log-rec94.5%
mul-1-neg94.5%
distribute-neg-frac94.5%
mul-1-neg94.5%
remove-double-neg94.5%
*-rgt-identity94.5%
associate-/l*94.5%
exp-to-pow94.5%
Simplified94.5%
Taylor expanded in n around inf 71.2%
Final simplification65.7%
(FPCore (x n)
:precision binary64
(if (<= x -5e-310)
0.0
(if (<= x 0.023)
(/ (log x) (- n))
(if (or (<= x 9.6e+50) (and (not (<= x 2.35e+98)) (<= x 3.3e+161)))
(/ (/ 1.0 n) x)
0.0))))
double code(double x, double n) {
double tmp;
if (x <= -5e-310) {
tmp = 0.0;
} else if (x <= 0.023) {
tmp = log(x) / -n;
} else if ((x <= 9.6e+50) || (!(x <= 2.35e+98) && (x <= 3.3e+161))) {
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 (x <= (-5d-310)) then
tmp = 0.0d0
else if (x <= 0.023d0) then
tmp = log(x) / -n
else if ((x <= 9.6d+50) .or. (.not. (x <= 2.35d+98)) .and. (x <= 3.3d+161)) 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 (x <= -5e-310) {
tmp = 0.0;
} else if (x <= 0.023) {
tmp = Math.log(x) / -n;
} else if ((x <= 9.6e+50) || (!(x <= 2.35e+98) && (x <= 3.3e+161))) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= -5e-310: tmp = 0.0 elif x <= 0.023: tmp = math.log(x) / -n elif (x <= 9.6e+50) or (not (x <= 2.35e+98) and (x <= 3.3e+161)): tmp = (1.0 / n) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= -5e-310) tmp = 0.0; elseif (x <= 0.023) tmp = Float64(log(x) / Float64(-n)); elseif ((x <= 9.6e+50) || (!(x <= 2.35e+98) && (x <= 3.3e+161))) tmp = Float64(Float64(1.0 / n) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= -5e-310) tmp = 0.0; elseif (x <= 0.023) tmp = log(x) / -n; elseif ((x <= 9.6e+50) || (~((x <= 2.35e+98)) && (x <= 3.3e+161))) tmp = (1.0 / n) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, -5e-310], 0.0, If[LessEqual[x, 0.023], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[Or[LessEqual[x, 9.6e+50], And[N[Not[LessEqual[x, 2.35e+98]], $MachinePrecision], LessEqual[x, 3.3e+161]]], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-310}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 0.023:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{+50} \lor \neg \left(x \leq 2.35 \cdot 10^{+98}\right) \land x \leq 3.3 \cdot 10^{+161}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -4.999999999999985e-310 or 9.6000000000000007e50 < x < 2.34999999999999985e98 or 3.29999999999999997e161 < x Initial program 80.3%
sub-neg80.3%
+-commutative80.3%
add-log-exp80.3%
add-log-exp80.3%
sum-log80.3%
pow-to-exp52.6%
un-div-inv52.6%
+-commutative52.6%
log1p-define65.1%
Applied egg-rr65.1%
Taylor expanded in x around inf 40.6%
exp-neg40.6%
rgt-mult-inverse83.5%
metadata-eval83.5%
Simplified83.5%
if -4.999999999999985e-310 < x < 0.023Initial program 40.4%
Taylor expanded in x around 0 39.6%
*-rgt-identity39.6%
associate-*l/39.6%
associate-/l*39.6%
exp-to-pow39.6%
Simplified39.6%
Taylor expanded in n around inf 50.5%
associate-*r/50.5%
mul-1-neg50.5%
Simplified50.5%
if 0.023 < x < 9.6000000000000007e50 or 2.34999999999999985e98 < x < 3.29999999999999997e161Initial program 43.6%
Taylor expanded in x around inf 92.3%
associate-/r*94.5%
mul-1-neg94.5%
log-rec94.5%
mul-1-neg94.5%
distribute-neg-frac94.5%
mul-1-neg94.5%
remove-double-neg94.5%
*-rgt-identity94.5%
associate-/l*94.5%
exp-to-pow94.5%
Simplified94.5%
Taylor expanded in n around inf 71.2%
Final simplification65.5%
(FPCore (x n)
:precision binary64
(if (<= x 4.5e-291)
0.0
(if (or (<= x 8.5e+50) (and (not (<= x 2.2e+99)) (<= x 2.7e+116)))
(/ 1.0 (* n x))
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 4.5e-291) {
tmp = 0.0;
} else if ((x <= 8.5e+50) || (!(x <= 2.2e+99) && (x <= 2.7e+116))) {
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 (x <= 4.5d-291) then
tmp = 0.0d0
else if ((x <= 8.5d+50) .or. (.not. (x <= 2.2d+99)) .and. (x <= 2.7d+116)) 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 (x <= 4.5e-291) {
tmp = 0.0;
} else if ((x <= 8.5e+50) || (!(x <= 2.2e+99) && (x <= 2.7e+116))) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 4.5e-291: tmp = 0.0 elif (x <= 8.5e+50) or (not (x <= 2.2e+99) and (x <= 2.7e+116)): tmp = 1.0 / (n * x) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 4.5e-291) tmp = 0.0; elseif ((x <= 8.5e+50) || (!(x <= 2.2e+99) && (x <= 2.7e+116))) 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 (x <= 4.5e-291) tmp = 0.0; elseif ((x <= 8.5e+50) || (~((x <= 2.2e+99)) && (x <= 2.7e+116))) tmp = 1.0 / (n * x); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 4.5e-291], 0.0, If[Or[LessEqual[x, 8.5e+50], And[N[Not[LessEqual[x, 2.2e+99]], $MachinePrecision], LessEqual[x, 2.7e+116]]], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{-291}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+50} \lor \neg \left(x \leq 2.2 \cdot 10^{+99}\right) \land x \leq 2.7 \cdot 10^{+116}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 4.49999999999999974e-291 or 8.49999999999999961e50 < x < 2.19999999999999978e99 or 2.7e116 < x Initial program 75.9%
sub-neg75.9%
+-commutative75.9%
add-log-exp75.9%
add-log-exp75.9%
sum-log75.9%
pow-to-exp52.5%
un-div-inv52.5%
+-commutative52.5%
log1p-define63.0%
Applied egg-rr63.0%
Taylor expanded in x around inf 39.7%
exp-neg39.7%
rgt-mult-inverse76.0%
metadata-eval76.0%
Simplified76.0%
if 4.49999999999999974e-291 < x < 8.49999999999999961e50 or 2.19999999999999978e99 < x < 2.7e116Initial program 39.9%
Taylor expanded in x around inf 39.8%
associate-/r*40.0%
mul-1-neg40.0%
log-rec40.0%
mul-1-neg40.0%
distribute-neg-frac40.0%
mul-1-neg40.0%
remove-double-neg40.0%
*-rgt-identity40.0%
associate-/l*40.0%
exp-to-pow40.0%
Simplified40.0%
Taylor expanded in n around inf 34.9%
*-commutative34.9%
Simplified34.9%
Final simplification52.7%
(FPCore (x n)
:precision binary64
(if (<= x 4.5e-291)
0.0
(if (or (<= x 1.2e+55) (and (not (<= x 4.5e+100)) (<= x 1.3e+162)))
(/ (/ 1.0 n) x)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 4.5e-291) {
tmp = 0.0;
} else if ((x <= 1.2e+55) || (!(x <= 4.5e+100) && (x <= 1.3e+162))) {
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 (x <= 4.5d-291) then
tmp = 0.0d0
else if ((x <= 1.2d+55) .or. (.not. (x <= 4.5d+100)) .and. (x <= 1.3d+162)) 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 (x <= 4.5e-291) {
tmp = 0.0;
} else if ((x <= 1.2e+55) || (!(x <= 4.5e+100) && (x <= 1.3e+162))) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 4.5e-291: tmp = 0.0 elif (x <= 1.2e+55) or (not (x <= 4.5e+100) and (x <= 1.3e+162)): tmp = (1.0 / n) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 4.5e-291) tmp = 0.0; elseif ((x <= 1.2e+55) || (!(x <= 4.5e+100) && (x <= 1.3e+162))) tmp = Float64(Float64(1.0 / n) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 4.5e-291) tmp = 0.0; elseif ((x <= 1.2e+55) || (~((x <= 4.5e+100)) && (x <= 1.3e+162))) tmp = (1.0 / n) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 4.5e-291], 0.0, If[Or[LessEqual[x, 1.2e+55], And[N[Not[LessEqual[x, 4.5e+100]], $MachinePrecision], LessEqual[x, 1.3e+162]]], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{-291}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+55} \lor \neg \left(x \leq 4.5 \cdot 10^{+100}\right) \land x \leq 1.3 \cdot 10^{+162}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 4.49999999999999974e-291 or 1.2e55 < x < 4.50000000000000036e100 or 1.3e162 < x Initial program 77.2%
sub-neg77.2%
+-commutative77.2%
add-log-exp77.2%
add-log-exp77.2%
sum-log77.2%
pow-to-exp51.7%
un-div-inv51.7%
+-commutative51.7%
log1p-define63.2%
Applied egg-rr63.2%
Taylor expanded in x around inf 37.8%
exp-neg37.8%
rgt-mult-inverse77.3%
metadata-eval77.3%
Simplified77.3%
if 4.49999999999999974e-291 < x < 1.2e55 or 4.50000000000000036e100 < x < 1.3e162Initial program 41.1%
Taylor expanded in x around inf 42.8%
associate-/r*43.5%
mul-1-neg43.5%
log-rec43.5%
mul-1-neg43.5%
distribute-neg-frac43.5%
mul-1-neg43.5%
remove-double-neg43.5%
*-rgt-identity43.5%
associate-/l*43.5%
exp-to-pow43.5%
Simplified43.5%
Taylor expanded in n around inf 36.8%
Final simplification53.0%
(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 55.5%
sub-neg55.5%
+-commutative55.5%
add-log-exp55.5%
add-log-exp55.5%
sum-log55.5%
pow-to-exp45.3%
un-div-inv45.3%
+-commutative45.3%
log1p-define56.7%
Applied egg-rr56.7%
Taylor expanded in x around inf 21.9%
exp-neg21.9%
rgt-mult-inverse37.8%
metadata-eval37.8%
Simplified37.8%
Final simplification37.8%
herbie shell --seed 2024067
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))