
(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 x (/ 1.0 n))) (t_1 (/ t_0 n)))
(if (<= (/ 1.0 n) -2e-77)
(/ t_1 x)
(if (<= (/ 1.0 n) 5e-80)
(* (/ -1.0 n) (- (log x) (log1p x)))
(if (<= (/ 1.0 n) 2e-5)
(/ (+ t_1 (* t_0 (/ (+ (/ 0.5 (pow n 2.0)) (/ -0.5 n)) x))) x)
(- (exp (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / n;
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = t_1 / x;
} else if ((1.0 / n) <= 5e-80) {
tmp = (-1.0 / n) * (log(x) - log1p(x));
} else if ((1.0 / n) <= 2e-5) {
tmp = (t_1 + (t_0 * (((0.5 / pow(n, 2.0)) + (-0.5 / n)) / x))) / x;
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = t_0 / n;
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = t_1 / x;
} else if ((1.0 / n) <= 5e-80) {
tmp = (-1.0 / n) * (Math.log(x) - Math.log1p(x));
} else if ((1.0 / n) <= 2e-5) {
tmp = (t_1 + (t_0 * (((0.5 / Math.pow(n, 2.0)) + (-0.5 / n)) / x))) / x;
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = t_0 / n tmp = 0 if (1.0 / n) <= -2e-77: tmp = t_1 / x elif (1.0 / n) <= 5e-80: tmp = (-1.0 / n) * (math.log(x) - math.log1p(x)) elif (1.0 / n) <= 2e-5: tmp = (t_1 + (t_0 * (((0.5 / math.pow(n, 2.0)) + (-0.5 / n)) / x))) / x else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-77) tmp = Float64(t_1 / x); elseif (Float64(1.0 / n) <= 5e-80) tmp = Float64(Float64(-1.0 / n) * Float64(log(x) - log1p(x))); elseif (Float64(1.0 / n) <= 2e-5) tmp = Float64(Float64(t_1 + Float64(t_0 * Float64(Float64(Float64(0.5 / (n ^ 2.0)) + Float64(-0.5 / n)) / x))) / x); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-77], N[(t$95$1 / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-80], N[(N[(-1.0 / n), $MachinePrecision] * N[(N[Log[x], $MachinePrecision] - N[Log[1 + x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-5], N[(N[(t$95$1 + N[(t$95$0 * N[(N[(N[(0.5 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t\_0}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-77}:\\
\;\;\;\;\frac{t\_1}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-80}:\\
\;\;\;\;\frac{-1}{n} \cdot \left(\log x - \mathsf{log1p}\left(x\right)\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\frac{t\_1 + t\_0 \cdot \frac{\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-77Initial program 85.2%
Taylor expanded in x around inf 91.8%
mul-1-neg91.8%
log-rec91.8%
mul-1-neg91.8%
distribute-neg-frac91.8%
mul-1-neg91.8%
remove-double-neg91.8%
*-commutative91.8%
Simplified91.8%
Taylor expanded in x around 0 91.8%
associate-/r*92.6%
*-rgt-identity92.6%
associate-*l/92.6%
associate-*r/92.6%
exp-to-pow92.6%
Simplified92.6%
if -1.9999999999999999e-77 < (/.f64 #s(literal 1 binary64) n) < 5e-80Initial program 33.4%
Taylor expanded in n around inf 88.2%
Simplified88.2%
add-sqr-sqrt87.8%
pow287.8%
fma-neg87.8%
Applied egg-rr87.8%
Taylor expanded in n around inf 87.8%
log1p-define87.8%
Simplified87.8%
div-inv88.0%
unpow288.0%
add-sqr-sqrt88.2%
Applied egg-rr88.2%
if 5e-80 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000016e-5Initial program 13.2%
add-log-exp12.9%
pow-to-exp12.9%
un-div-inv12.9%
+-commutative12.9%
log1p-define12.9%
Applied egg-rr12.9%
Taylor expanded in x around inf 85.0%
Simplified85.0%
if 2.00000000000000016e-5 < (/.f64 #s(literal 1 binary64) n) Initial program 67.8%
Taylor expanded in n around 0 67.8%
log1p-define99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Final simplification90.7%
(FPCore (x n)
:precision binary64
(if (<= x 3.5)
(/
(-
(-
(log1p x)
(/
(-
(*
(/ -0.16666666666666666 n)
(- (pow (log1p x) 3.0) (pow (log x) 3.0)))
(* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0))))
n))
(log x))
n)
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 3.5) {
tmp = ((log1p(x) - ((((-0.16666666666666666 / n) * (pow(log1p(x), 3.0) - pow(log(x), 3.0))) - (0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0)))) / n)) - log(x)) / n;
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (x <= 3.5) {
tmp = ((Math.log1p(x) - ((((-0.16666666666666666 / n) * (Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0))) - (0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)))) / n)) - Math.log(x)) / n;
} else {
tmp = (Math.pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 3.5: tmp = ((math.log1p(x) - ((((-0.16666666666666666 / n) * (math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0))) - (0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0)))) / n)) - math.log(x)) / n else: tmp = (math.pow(x, (1.0 / n)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 3.5) tmp = Float64(Float64(Float64(log1p(x) - Float64(Float64(Float64(Float64(-0.16666666666666666 / n) * Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0))) - Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)))) / n)) - log(x)) / n); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
code[x_, n_] := If[LessEqual[x, 3.5], N[(N[(N[(N[Log[1 + x], $MachinePrecision] - N[(N[(N[(N[(-0.16666666666666666 / n), $MachinePrecision] * N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 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]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.5:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) - \frac{\frac{-0.16666666666666666}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - 0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right)}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 3.5Initial program 40.8%
Taylor expanded in n around -inf 82.0%
Simplified82.0%
if 3.5 < x Initial program 68.0%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
log-rec97.7%
mul-1-neg97.7%
distribute-neg-frac97.7%
mul-1-neg97.7%
remove-double-neg97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 97.7%
associate-/r*99.3%
*-rgt-identity99.3%
associate-*l/99.3%
associate-*r/99.3%
exp-to-pow99.3%
Simplified99.3%
Final simplification90.1%
(FPCore (x n)
:precision binary64
(if (<= x 0.52)
(/
(-
(* -0.16666666666666666 (* (/ 1.0 n) (/ (pow (log x) 3.0) n)))
(+ (log x) (* 0.5 (/ (pow (log x) 2.0) n))))
n)
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 0.52) {
tmp = ((-0.16666666666666666 * ((1.0 / n) * (pow(log(x), 3.0) / n))) - (log(x) + (0.5 * (pow(log(x), 2.0) / n)))) / n;
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.52d0) then
tmp = (((-0.16666666666666666d0) * ((1.0d0 / n) * ((log(x) ** 3.0d0) / n))) - (log(x) + (0.5d0 * ((log(x) ** 2.0d0) / n)))) / n
else
tmp = ((x ** (1.0d0 / n)) / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.52) {
tmp = ((-0.16666666666666666 * ((1.0 / n) * (Math.pow(Math.log(x), 3.0) / n))) - (Math.log(x) + (0.5 * (Math.pow(Math.log(x), 2.0) / n)))) / n;
} else {
tmp = (Math.pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.52: tmp = ((-0.16666666666666666 * ((1.0 / n) * (math.pow(math.log(x), 3.0) / n))) - (math.log(x) + (0.5 * (math.pow(math.log(x), 2.0) / n)))) / n else: tmp = (math.pow(x, (1.0 / n)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 0.52) tmp = Float64(Float64(Float64(-0.16666666666666666 * Float64(Float64(1.0 / n) * Float64((log(x) ^ 3.0) / n))) - Float64(log(x) + Float64(0.5 * Float64((log(x) ^ 2.0) / n)))) / n); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.52) tmp = ((-0.16666666666666666 * ((1.0 / n) * ((log(x) ^ 3.0) / n))) - (log(x) + (0.5 * ((log(x) ^ 2.0) / n)))) / n; else tmp = ((x ^ (1.0 / n)) / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.52], N[(N[(N[(-0.16666666666666666 * N[(N[(1.0 / n), $MachinePrecision] * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] + N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.52:\\
\;\;\;\;\frac{-0.16666666666666666 \cdot \left(\frac{1}{n} \cdot \frac{{\log x}^{3}}{n}\right) - \left(\log x + 0.5 \cdot \frac{{\log x}^{2}}{n}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 0.52000000000000002Initial program 40.8%
Taylor expanded in x around 0 40.1%
Taylor expanded in n around inf 81.4%
*-un-lft-identity81.4%
unpow281.4%
times-frac81.4%
Applied egg-rr81.4%
if 0.52000000000000002 < x Initial program 68.0%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
log-rec97.7%
mul-1-neg97.7%
distribute-neg-frac97.7%
mul-1-neg97.7%
remove-double-neg97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 97.7%
associate-/r*99.3%
*-rgt-identity99.3%
associate-*l/99.3%
associate-*r/99.3%
exp-to-pow99.3%
Simplified99.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (/ t_0 n) x)))
(if (<= (/ 1.0 n) -2e-77)
t_1
(if (<= (/ 1.0 n) 5e-80)
(* (/ -1.0 n) (- (log x) (log1p x)))
(if (<= (/ 1.0 n) 2e-5) t_1 (- (exp (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-80) {
tmp = (-1.0 / n) * (log(x) - log1p(x));
} else if ((1.0 / n) <= 2e-5) {
tmp = t_1;
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-80) {
tmp = (-1.0 / n) * (Math.log(x) - Math.log1p(x));
} else if ((1.0 / n) <= 2e-5) {
tmp = t_1;
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (t_0 / n) / x tmp = 0 if (1.0 / n) <= -2e-77: tmp = t_1 elif (1.0 / n) <= 5e-80: tmp = (-1.0 / n) * (math.log(x) - math.log1p(x)) elif (1.0 / n) <= 2e-5: tmp = t_1 else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(t_0 / n) / x) tmp = 0.0 if (Float64(1.0 / n) <= -2e-77) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-80) tmp = Float64(Float64(-1.0 / n) * Float64(log(x) - log1p(x))); elseif (Float64(1.0 / n) <= 2e-5) tmp = t_1; else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-77], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-80], N[(N[(-1.0 / n), $MachinePrecision] * N[(N[Log[x], $MachinePrecision] - N[Log[1 + x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-5], t$95$1, N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\frac{t\_0}{n}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-77}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-80}:\\
\;\;\;\;\frac{-1}{n} \cdot \left(\log x - \mathsf{log1p}\left(x\right)\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-77 or 5e-80 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000016e-5Initial program 71.2%
Taylor expanded in x around inf 90.0%
mul-1-neg90.0%
log-rec90.0%
mul-1-neg90.0%
distribute-neg-frac90.0%
mul-1-neg90.0%
remove-double-neg90.0%
*-commutative90.0%
Simplified90.0%
Taylor expanded in x around 0 90.0%
associate-/r*91.0%
*-rgt-identity91.0%
associate-*l/91.0%
associate-*r/91.0%
exp-to-pow91.0%
Simplified91.0%
if -1.9999999999999999e-77 < (/.f64 #s(literal 1 binary64) n) < 5e-80Initial program 33.4%
Taylor expanded in n around inf 88.2%
Simplified88.2%
add-sqr-sqrt87.8%
pow287.8%
fma-neg87.8%
Applied egg-rr87.8%
Taylor expanded in n around inf 87.8%
log1p-define87.8%
Simplified87.8%
div-inv88.0%
unpow288.0%
add-sqr-sqrt88.2%
Applied egg-rr88.2%
if 2.00000000000000016e-5 < (/.f64 #s(literal 1 binary64) n) Initial program 67.8%
Taylor expanded in n around 0 67.8%
log1p-define99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Final simplification90.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (/ t_0 n) x)))
(if (<= (/ 1.0 n) -2e-77)
t_1
(if (<= (/ 1.0 n) 5e-80)
(* (/ -1.0 n) (- (log x) (log1p x)))
(if (<= (/ 1.0 n) 2e-5) t_1 (- (+ 1.0 (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-80) {
tmp = (-1.0 / n) * (log(x) - log1p(x));
} else if ((1.0 / n) <= 2e-5) {
tmp = t_1;
} else {
tmp = (1.0 + (x / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-80) {
tmp = (-1.0 / n) * (Math.log(x) - Math.log1p(x));
} else if ((1.0 / n) <= 2e-5) {
tmp = t_1;
} else {
tmp = (1.0 + (x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (t_0 / n) / x tmp = 0 if (1.0 / n) <= -2e-77: tmp = t_1 elif (1.0 / n) <= 5e-80: tmp = (-1.0 / n) * (math.log(x) - math.log1p(x)) elif (1.0 / n) <= 2e-5: tmp = t_1 else: tmp = (1.0 + (x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(t_0 / n) / x) tmp = 0.0 if (Float64(1.0 / n) <= -2e-77) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-80) tmp = Float64(Float64(-1.0 / n) * Float64(log(x) - log1p(x))); elseif (Float64(1.0 / n) <= 2e-5) tmp = t_1; else tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-77], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-80], N[(N[(-1.0 / n), $MachinePrecision] * N[(N[Log[x], $MachinePrecision] - N[Log[1 + x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-5], t$95$1, N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\frac{t\_0}{n}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-77}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-80}:\\
\;\;\;\;\frac{-1}{n} \cdot \left(\log x - \mathsf{log1p}\left(x\right)\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-77 or 5e-80 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000016e-5Initial program 71.2%
Taylor expanded in x around inf 90.0%
mul-1-neg90.0%
log-rec90.0%
mul-1-neg90.0%
distribute-neg-frac90.0%
mul-1-neg90.0%
remove-double-neg90.0%
*-commutative90.0%
Simplified90.0%
Taylor expanded in x around 0 90.0%
associate-/r*91.0%
*-rgt-identity91.0%
associate-*l/91.0%
associate-*r/91.0%
exp-to-pow91.0%
Simplified91.0%
if -1.9999999999999999e-77 < (/.f64 #s(literal 1 binary64) n) < 5e-80Initial program 33.4%
Taylor expanded in n around inf 88.2%
Simplified88.2%
add-sqr-sqrt87.8%
pow287.8%
fma-neg87.8%
Applied egg-rr87.8%
Taylor expanded in n around inf 87.8%
log1p-define87.8%
Simplified87.8%
div-inv88.0%
unpow288.0%
add-sqr-sqrt88.2%
Applied egg-rr88.2%
if 2.00000000000000016e-5 < (/.f64 #s(literal 1 binary64) n) Initial program 67.8%
Taylor expanded in x around 0 66.1%
Final simplification87.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (/ t_0 n) x)))
(if (<= (/ 1.0 n) -2e-77)
t_1
(if (<= (/ 1.0 n) 5e-80)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 2e-5) t_1 (- (+ 1.0 (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-80) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = t_1;
} else {
tmp = (1.0 + (x / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-80) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = t_1;
} else {
tmp = (1.0 + (x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (t_0 / n) / x tmp = 0 if (1.0 / n) <= -2e-77: tmp = t_1 elif (1.0 / n) <= 5e-80: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 2e-5: tmp = t_1 else: tmp = (1.0 + (x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(t_0 / n) / x) tmp = 0.0 if (Float64(1.0 / n) <= -2e-77) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-80) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 2e-5) tmp = t_1; else tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-77], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-80], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-5], t$95$1, N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\frac{t\_0}{n}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-77}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-80}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-77 or 5e-80 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000016e-5Initial program 71.2%
Taylor expanded in x around inf 90.0%
mul-1-neg90.0%
log-rec90.0%
mul-1-neg90.0%
distribute-neg-frac90.0%
mul-1-neg90.0%
remove-double-neg90.0%
*-commutative90.0%
Simplified90.0%
Taylor expanded in x around 0 90.0%
associate-/r*91.0%
*-rgt-identity91.0%
associate-*l/91.0%
associate-*r/91.0%
exp-to-pow91.0%
Simplified91.0%
if -1.9999999999999999e-77 < (/.f64 #s(literal 1 binary64) n) < 5e-80Initial program 33.4%
Taylor expanded in n around inf 88.2%
log1p-define88.2%
Simplified88.2%
if 2.00000000000000016e-5 < (/.f64 #s(literal 1 binary64) n) Initial program 67.8%
Taylor expanded in x around 0 66.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log x) (- n))))
(if (<= x 3.4e-226)
t_1
(if (<= x 5e-215)
(- (+ 1.0 (/ x n)) t_0)
(if (<= x 2.25e-129)
t_1
(if (<= x 4.5e-125)
(/
(+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* x n))) x))
x)
(if (<= x 0.125)
(-
(*
x
(-
(/ 1.0 n)
(* x (- (* 0.5 (/ 1.0 n)) (* (/ x n) 0.3333333333333333)))))
(/ (log x) n))
(/ (/ t_0 n) x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(x) / -n;
double tmp;
if (x <= 3.4e-226) {
tmp = t_1;
} else if (x <= 5e-215) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 2.25e-129) {
tmp = t_1;
} else if (x <= 4.5e-125) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
} else if (x <= 0.125) {
tmp = (x * ((1.0 / n) - (x * ((0.5 * (1.0 / n)) - ((x / n) * 0.3333333333333333))))) - (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 = log(x) / -n
if (x <= 3.4d-226) then
tmp = t_1
else if (x <= 5d-215) then
tmp = (1.0d0 + (x / n)) - t_0
else if (x <= 2.25d-129) then
tmp = t_1
else if (x <= 4.5d-125) then
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (x * n))) / x)) / x
else if (x <= 0.125d0) then
tmp = (x * ((1.0d0 / n) - (x * ((0.5d0 * (1.0d0 / n)) - ((x / n) * 0.3333333333333333d0))))) - (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 = Math.log(x) / -n;
double tmp;
if (x <= 3.4e-226) {
tmp = t_1;
} else if (x <= 5e-215) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 2.25e-129) {
tmp = t_1;
} else if (x <= 4.5e-125) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
} else if (x <= 0.125) {
tmp = (x * ((1.0 / n) - (x * ((0.5 * (1.0 / n)) - ((x / n) * 0.3333333333333333))))) - (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 = math.log(x) / -n tmp = 0 if x <= 3.4e-226: tmp = t_1 elif x <= 5e-215: tmp = (1.0 + (x / n)) - t_0 elif x <= 2.25e-129: tmp = t_1 elif x <= 4.5e-125: tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x elif x <= 0.125: tmp = (x * ((1.0 / n) - (x * ((0.5 * (1.0 / n)) - ((x / n) * 0.3333333333333333))))) - (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(log(x) / Float64(-n)) tmp = 0.0 if (x <= 3.4e-226) tmp = t_1; elseif (x <= 5e-215) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); elseif (x <= 2.25e-129) tmp = t_1; elseif (x <= 4.5e-125) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(x * n))) / x)) / x); elseif (x <= 0.125) tmp = Float64(Float64(x * Float64(Float64(1.0 / n) - Float64(x * Float64(Float64(0.5 * Float64(1.0 / n)) - Float64(Float64(x / n) * 0.3333333333333333))))) - 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 = log(x) / -n; tmp = 0.0; if (x <= 3.4e-226) tmp = t_1; elseif (x <= 5e-215) tmp = (1.0 + (x / n)) - t_0; elseif (x <= 2.25e-129) tmp = t_1; elseif (x <= 4.5e-125) tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x; elseif (x <= 0.125) tmp = (x * ((1.0 / n) - (x * ((0.5 * (1.0 / n)) - ((x / n) * 0.3333333333333333))))) - (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[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 3.4e-226], t$95$1, If[LessEqual[x, 5e-215], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 2.25e-129], t$95$1, If[LessEqual[x, 4.5e-125], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.125], N[(N[(x * N[(N[(1.0 / n), $MachinePrecision] - N[(x * N[(N[(0.5 * N[(1.0 / n), $MachinePrecision]), $MachinePrecision] - N[(N[(x / n), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $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 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 3.4 \cdot 10^{-226}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-215}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{-129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-125}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{x \cdot n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.125:\\
\;\;\;\;x \cdot \left(\frac{1}{n} - x \cdot \left(0.5 \cdot \frac{1}{n} - \frac{x}{n} \cdot 0.3333333333333333\right)\right) - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < 3.40000000000000007e-226 or 4.99999999999999956e-215 < x < 2.25000000000000015e-129Initial program 35.8%
Taylor expanded in x around 0 35.8%
Taylor expanded in n around inf 66.7%
mul-1-neg66.7%
distribute-frac-neg266.7%
Simplified66.7%
if 3.40000000000000007e-226 < x < 4.99999999999999956e-215Initial program 83.9%
Taylor expanded in x around 0 83.9%
if 2.25000000000000015e-129 < x < 4.50000000000000012e-125Initial program 83.9%
Taylor expanded in n around inf 51.8%
Simplified51.8%
add-sqr-sqrt51.8%
pow251.8%
fma-neg51.8%
Applied egg-rr51.8%
Taylor expanded in n around inf 6.0%
log1p-define6.0%
Simplified6.0%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
distribute-neg-frac2100.0%
Simplified100.0%
if 4.50000000000000012e-125 < x < 0.125Initial program 37.7%
Taylor expanded in n around inf 79.2%
Simplified79.2%
add-sqr-sqrt78.8%
pow278.8%
fma-neg78.8%
Applied egg-rr78.8%
Taylor expanded in n around inf 60.7%
log1p-define60.7%
Simplified60.7%
Taylor expanded in x around 0 60.1%
if 0.125 < x Initial program 68.0%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
log-rec97.7%
mul-1-neg97.7%
distribute-neg-frac97.7%
mul-1-neg97.7%
remove-double-neg97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 97.7%
associate-/r*99.3%
*-rgt-identity99.3%
associate-*l/99.3%
associate-*r/99.3%
exp-to-pow99.3%
Simplified99.3%
Final simplification81.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log x) (- n))))
(if (<= x 4.5e-226)
t_1
(if (<= x 4.4e-215)
(- (+ 1.0 (/ x n)) t_0)
(if (<= x 2.3e-129)
t_1
(if (<= x 5.2e-125)
(/
(+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* x n))) x))
x)
(if (<= x 0.043)
(- (* 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 = log(x) / -n;
double tmp;
if (x <= 4.5e-226) {
tmp = t_1;
} else if (x <= 4.4e-215) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 2.3e-129) {
tmp = t_1;
} else if (x <= 5.2e-125) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
} else if (x <= 0.043) {
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 = log(x) / -n
if (x <= 4.5d-226) then
tmp = t_1
else if (x <= 4.4d-215) then
tmp = (1.0d0 + (x / n)) - t_0
else if (x <= 2.3d-129) then
tmp = t_1
else if (x <= 5.2d-125) then
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (x * n))) / x)) / x
else if (x <= 0.043d0) 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 = Math.log(x) / -n;
double tmp;
if (x <= 4.5e-226) {
tmp = t_1;
} else if (x <= 4.4e-215) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 2.3e-129) {
tmp = t_1;
} else if (x <= 5.2e-125) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
} else if (x <= 0.043) {
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 = math.log(x) / -n tmp = 0 if x <= 4.5e-226: tmp = t_1 elif x <= 4.4e-215: tmp = (1.0 + (x / n)) - t_0 elif x <= 2.3e-129: tmp = t_1 elif x <= 5.2e-125: tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x elif x <= 0.043: 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(log(x) / Float64(-n)) tmp = 0.0 if (x <= 4.5e-226) tmp = t_1; elseif (x <= 4.4e-215) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); elseif (x <= 2.3e-129) tmp = t_1; elseif (x <= 5.2e-125) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(x * n))) / x)) / x); elseif (x <= 0.043) 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 = log(x) / -n; tmp = 0.0; if (x <= 4.5e-226) tmp = t_1; elseif (x <= 4.4e-215) tmp = (1.0 + (x / n)) - t_0; elseif (x <= 2.3e-129) tmp = t_1; elseif (x <= 5.2e-125) tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x; elseif (x <= 0.043) 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[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 4.5e-226], t$95$1, If[LessEqual[x, 4.4e-215], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 2.3e-129], t$95$1, If[LessEqual[x, 5.2e-125], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.043], 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 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 4.5 \cdot 10^{-226}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{-215}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-125}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{x \cdot n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.043:\\
\;\;\;\;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 < 4.50000000000000011e-226 or 4.39999999999999993e-215 < x < 2.3e-129Initial program 35.8%
Taylor expanded in x around 0 35.8%
Taylor expanded in n around inf 66.7%
mul-1-neg66.7%
distribute-frac-neg266.7%
Simplified66.7%
if 4.50000000000000011e-226 < x < 4.39999999999999993e-215Initial program 83.9%
Taylor expanded in x around 0 83.9%
if 2.3e-129 < x < 5.20000000000000011e-125Initial program 83.9%
Taylor expanded in n around inf 51.8%
Simplified51.8%
add-sqr-sqrt51.8%
pow251.8%
fma-neg51.8%
Applied egg-rr51.8%
Taylor expanded in n around inf 6.0%
log1p-define6.0%
Simplified6.0%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
distribute-neg-frac2100.0%
Simplified100.0%
if 5.20000000000000011e-125 < x < 0.042999999999999997Initial program 37.7%
Taylor expanded in n around inf 79.2%
Simplified79.2%
add-sqr-sqrt78.8%
pow278.8%
fma-neg78.8%
Applied egg-rr78.8%
Taylor expanded in n around inf 60.7%
log1p-define60.7%
Simplified60.7%
Taylor expanded in x around 0 59.9%
if 0.042999999999999997 < x Initial program 68.0%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
log-rec97.7%
mul-1-neg97.7%
distribute-neg-frac97.7%
mul-1-neg97.7%
remove-double-neg97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 97.7%
associate-/r*99.3%
*-rgt-identity99.3%
associate-*l/99.3%
associate-*r/99.3%
exp-to-pow99.3%
Simplified99.3%
Final simplification81.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log x) (- n))))
(if (<= x 5.1e-226)
t_1
(if (<= x 4e-215)
(- (+ 1.0 (/ x n)) t_0)
(if (<= x 2.3e-129)
t_1
(if (<= x 4.5e-125)
(/
(+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* x n))) x))
x)
(if (<= x 0.043) (- (/ 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 = log(x) / -n;
double tmp;
if (x <= 5.1e-226) {
tmp = t_1;
} else if (x <= 4e-215) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 2.3e-129) {
tmp = t_1;
} else if (x <= 4.5e-125) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
} else if (x <= 0.043) {
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 = log(x) / -n
if (x <= 5.1d-226) then
tmp = t_1
else if (x <= 4d-215) then
tmp = (1.0d0 + (x / n)) - t_0
else if (x <= 2.3d-129) then
tmp = t_1
else if (x <= 4.5d-125) then
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (x * n))) / x)) / x
else if (x <= 0.043d0) 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 = Math.log(x) / -n;
double tmp;
if (x <= 5.1e-226) {
tmp = t_1;
} else if (x <= 4e-215) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 2.3e-129) {
tmp = t_1;
} else if (x <= 4.5e-125) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
} else if (x <= 0.043) {
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 = math.log(x) / -n tmp = 0 if x <= 5.1e-226: tmp = t_1 elif x <= 4e-215: tmp = (1.0 + (x / n)) - t_0 elif x <= 2.3e-129: tmp = t_1 elif x <= 4.5e-125: tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x elif x <= 0.043: 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(log(x) / Float64(-n)) tmp = 0.0 if (x <= 5.1e-226) tmp = t_1; elseif (x <= 4e-215) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); elseif (x <= 2.3e-129) tmp = t_1; elseif (x <= 4.5e-125) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(x * n))) / x)) / x); elseif (x <= 0.043) 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 = log(x) / -n; tmp = 0.0; if (x <= 5.1e-226) tmp = t_1; elseif (x <= 4e-215) tmp = (1.0 + (x / n)) - t_0; elseif (x <= 2.3e-129) tmp = t_1; elseif (x <= 4.5e-125) tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x; elseif (x <= 0.043) 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[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 5.1e-226], t$95$1, If[LessEqual[x, 4e-215], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 2.3e-129], t$95$1, If[LessEqual[x, 4.5e-125], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.043], 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 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 5.1 \cdot 10^{-226}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-215}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-125}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{x \cdot n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.043:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < 5.09999999999999973e-226 or 4.00000000000000017e-215 < x < 2.3e-129Initial program 35.8%
Taylor expanded in x around 0 35.8%
Taylor expanded in n around inf 66.7%
mul-1-neg66.7%
distribute-frac-neg266.7%
Simplified66.7%
if 5.09999999999999973e-226 < x < 4.00000000000000017e-215Initial program 83.9%
Taylor expanded in x around 0 83.9%
if 2.3e-129 < x < 4.50000000000000012e-125Initial program 83.9%
Taylor expanded in n around inf 51.8%
Simplified51.8%
add-sqr-sqrt51.8%
pow251.8%
fma-neg51.8%
Applied egg-rr51.8%
Taylor expanded in n around inf 6.0%
log1p-define6.0%
Simplified6.0%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
distribute-neg-frac2100.0%
Simplified100.0%
if 4.50000000000000012e-125 < x < 0.042999999999999997Initial program 37.7%
Taylor expanded in n around inf 79.2%
Simplified79.2%
add-sqr-sqrt78.8%
pow278.8%
fma-neg78.8%
Applied egg-rr78.8%
Taylor expanded in n around inf 60.7%
log1p-define60.7%
Simplified60.7%
Taylor expanded in x around 0 59.8%
if 0.042999999999999997 < x Initial program 68.0%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
log-rec97.7%
mul-1-neg97.7%
distribute-neg-frac97.7%
mul-1-neg97.7%
remove-double-neg97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 97.7%
associate-/r*99.3%
*-rgt-identity99.3%
associate-*l/99.3%
associate-*r/99.3%
exp-to-pow99.3%
Simplified99.3%
Final simplification81.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))) (t_1 (pow x (/ 1.0 n))))
(if (<= x 2e-226)
t_0
(if (<= x 4.1e-215)
(- 1.0 t_1)
(if (<= x 2.3e-129)
t_0
(if (<= x 1.25e-124)
(/
(+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* x n))) x))
x)
(if (<= x 0.055) (- (/ x n) (/ (log x) n)) (/ (/ t_1 n) x))))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double t_1 = pow(x, (1.0 / n));
double tmp;
if (x <= 2e-226) {
tmp = t_0;
} else if (x <= 4.1e-215) {
tmp = 1.0 - t_1;
} else if (x <= 2.3e-129) {
tmp = t_0;
} else if (x <= 1.25e-124) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
} else if (x <= 0.055) {
tmp = (x / n) - (log(x) / n);
} else {
tmp = (t_1 / 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 = log(x) / -n
t_1 = x ** (1.0d0 / n)
if (x <= 2d-226) then
tmp = t_0
else if (x <= 4.1d-215) then
tmp = 1.0d0 - t_1
else if (x <= 2.3d-129) then
tmp = t_0
else if (x <= 1.25d-124) then
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (x * n))) / x)) / x
else if (x <= 0.055d0) then
tmp = (x / n) - (log(x) / n)
else
tmp = (t_1 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 2e-226) {
tmp = t_0;
} else if (x <= 4.1e-215) {
tmp = 1.0 - t_1;
} else if (x <= 2.3e-129) {
tmp = t_0;
} else if (x <= 1.25e-124) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
} else if (x <= 0.055) {
tmp = (x / n) - (Math.log(x) / n);
} else {
tmp = (t_1 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n t_1 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 2e-226: tmp = t_0 elif x <= 4.1e-215: tmp = 1.0 - t_1 elif x <= 2.3e-129: tmp = t_0 elif x <= 1.25e-124: tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x elif x <= 0.055: tmp = (x / n) - (math.log(x) / n) else: tmp = (t_1 / n) / x return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 2e-226) tmp = t_0; elseif (x <= 4.1e-215) tmp = Float64(1.0 - t_1); elseif (x <= 2.3e-129) tmp = t_0; elseif (x <= 1.25e-124) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(x * n))) / x)) / x); elseif (x <= 0.055) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); else tmp = Float64(Float64(t_1 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; t_1 = x ^ (1.0 / n); tmp = 0.0; if (x <= 2e-226) tmp = t_0; elseif (x <= 4.1e-215) tmp = 1.0 - t_1; elseif (x <= 2.3e-129) tmp = t_0; elseif (x <= 1.25e-124) tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x; elseif (x <= 0.055) tmp = (x / n) - (log(x) / n); else tmp = (t_1 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 2e-226], t$95$0, If[LessEqual[x, 4.1e-215], N[(1.0 - t$95$1), $MachinePrecision], If[LessEqual[x, 2.3e-129], t$95$0, If[LessEqual[x, 1.25e-124], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.055], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 2 \cdot 10^{-226}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-215}:\\
\;\;\;\;1 - t\_1\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-129}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-124}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{x \cdot n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.055:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_1}{n}}{x}\\
\end{array}
\end{array}
if x < 1.99999999999999984e-226 or 4.09999999999999985e-215 < x < 2.3e-129Initial program 35.8%
Taylor expanded in x around 0 35.8%
Taylor expanded in n around inf 66.7%
mul-1-neg66.7%
distribute-frac-neg266.7%
Simplified66.7%
if 1.99999999999999984e-226 < x < 4.09999999999999985e-215Initial program 83.9%
Taylor expanded in x around 0 83.9%
if 2.3e-129 < x < 1.2500000000000001e-124Initial program 83.9%
Taylor expanded in n around inf 51.8%
Simplified51.8%
add-sqr-sqrt51.8%
pow251.8%
fma-neg51.8%
Applied egg-rr51.8%
Taylor expanded in n around inf 6.0%
log1p-define6.0%
Simplified6.0%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
distribute-neg-frac2100.0%
Simplified100.0%
if 1.2500000000000001e-124 < x < 0.0550000000000000003Initial program 37.7%
Taylor expanded in n around inf 79.2%
Simplified79.2%
add-sqr-sqrt78.8%
pow278.8%
fma-neg78.8%
Applied egg-rr78.8%
Taylor expanded in n around inf 60.7%
log1p-define60.7%
Simplified60.7%
Taylor expanded in x around 0 59.8%
if 0.0550000000000000003 < x Initial program 68.0%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
log-rec97.7%
mul-1-neg97.7%
distribute-neg-frac97.7%
mul-1-neg97.7%
remove-double-neg97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 97.7%
associate-/r*99.3%
*-rgt-identity99.3%
associate-*l/99.3%
associate-*r/99.3%
exp-to-pow99.3%
Simplified99.3%
Final simplification81.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))) (t_1 (pow x (/ 1.0 n))))
(if (<= x 4.5e-226)
t_0
(if (<= x 6.8e-215)
(- 1.0 t_1)
(if (<= x 1.85e-129)
t_0
(if (<= x 4.8e-125)
(/
(+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* x n))) x))
x)
(if (<= x 0.055) (/ (- x (log x)) n) (/ (/ t_1 n) x))))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double t_1 = pow(x, (1.0 / n));
double tmp;
if (x <= 4.5e-226) {
tmp = t_0;
} else if (x <= 6.8e-215) {
tmp = 1.0 - t_1;
} else if (x <= 1.85e-129) {
tmp = t_0;
} else if (x <= 4.8e-125) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
} else if (x <= 0.055) {
tmp = (x - log(x)) / n;
} else {
tmp = (t_1 / 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 = log(x) / -n
t_1 = x ** (1.0d0 / n)
if (x <= 4.5d-226) then
tmp = t_0
else if (x <= 6.8d-215) then
tmp = 1.0d0 - t_1
else if (x <= 1.85d-129) then
tmp = t_0
else if (x <= 4.8d-125) then
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (x * n))) / x)) / x
else if (x <= 0.055d0) then
tmp = (x - log(x)) / n
else
tmp = (t_1 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 4.5e-226) {
tmp = t_0;
} else if (x <= 6.8e-215) {
tmp = 1.0 - t_1;
} else if (x <= 1.85e-129) {
tmp = t_0;
} else if (x <= 4.8e-125) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
} else if (x <= 0.055) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (t_1 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n t_1 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 4.5e-226: tmp = t_0 elif x <= 6.8e-215: tmp = 1.0 - t_1 elif x <= 1.85e-129: tmp = t_0 elif x <= 4.8e-125: tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x elif x <= 0.055: tmp = (x - math.log(x)) / n else: tmp = (t_1 / n) / x return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 4.5e-226) tmp = t_0; elseif (x <= 6.8e-215) tmp = Float64(1.0 - t_1); elseif (x <= 1.85e-129) tmp = t_0; elseif (x <= 4.8e-125) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(x * n))) / x)) / x); elseif (x <= 0.055) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(t_1 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; t_1 = x ^ (1.0 / n); tmp = 0.0; if (x <= 4.5e-226) tmp = t_0; elseif (x <= 6.8e-215) tmp = 1.0 - t_1; elseif (x <= 1.85e-129) tmp = t_0; elseif (x <= 4.8e-125) tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x; elseif (x <= 0.055) tmp = (x - log(x)) / n; else tmp = (t_1 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 4.5e-226], t$95$0, If[LessEqual[x, 6.8e-215], N[(1.0 - t$95$1), $MachinePrecision], If[LessEqual[x, 1.85e-129], t$95$0, If[LessEqual[x, 4.8e-125], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.055], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(t$95$1 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 4.5 \cdot 10^{-226}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-215}:\\
\;\;\;\;1 - t\_1\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-129}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-125}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{x \cdot n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.055:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_1}{n}}{x}\\
\end{array}
\end{array}
if x < 4.50000000000000011e-226 or 6.80000000000000003e-215 < x < 1.8500000000000001e-129Initial program 35.8%
Taylor expanded in x around 0 35.8%
Taylor expanded in n around inf 66.7%
mul-1-neg66.7%
distribute-frac-neg266.7%
Simplified66.7%
if 4.50000000000000011e-226 < x < 6.80000000000000003e-215Initial program 83.9%
Taylor expanded in x around 0 83.9%
if 1.8500000000000001e-129 < x < 4.8000000000000003e-125Initial program 83.9%
Taylor expanded in n around inf 51.8%
Simplified51.8%
add-sqr-sqrt51.8%
pow251.8%
fma-neg51.8%
Applied egg-rr51.8%
Taylor expanded in n around inf 6.0%
log1p-define6.0%
Simplified6.0%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
distribute-neg-frac2100.0%
Simplified100.0%
if 4.8000000000000003e-125 < x < 0.0550000000000000003Initial program 37.7%
Taylor expanded in x around 0 36.1%
Taylor expanded in n around inf 59.8%
if 0.0550000000000000003 < x Initial program 68.0%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
log-rec97.7%
mul-1-neg97.7%
distribute-neg-frac97.7%
mul-1-neg97.7%
remove-double-neg97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 97.7%
associate-/r*99.3%
*-rgt-identity99.3%
associate-*l/99.3%
associate-*r/99.3%
exp-to-pow99.3%
Simplified99.3%
Final simplification81.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))))
(if (<= x 2e-226)
t_0
(if (<= x 4e-215)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 2.3e-129)
t_0
(if (or (<= x 4.5e-125) (not (<= x 0.85)))
(/
(+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* x n))) x))
x)
(/ (- x (log x)) n)))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double tmp;
if (x <= 2e-226) {
tmp = t_0;
} else if (x <= 4e-215) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 2.3e-129) {
tmp = t_0;
} else if ((x <= 4.5e-125) || !(x <= 0.85)) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
} else {
tmp = (x - log(x)) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = log(x) / -n
if (x <= 2d-226) then
tmp = t_0
else if (x <= 4d-215) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 2.3d-129) then
tmp = t_0
else if ((x <= 4.5d-125) .or. (.not. (x <= 0.85d0))) then
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (x * n))) / x)) / x
else
tmp = (x - log(x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double tmp;
if (x <= 2e-226) {
tmp = t_0;
} else if (x <= 4e-215) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 2.3e-129) {
tmp = t_0;
} else if ((x <= 4.5e-125) || !(x <= 0.85)) {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
} else {
tmp = (x - Math.log(x)) / n;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n tmp = 0 if x <= 2e-226: tmp = t_0 elif x <= 4e-215: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 2.3e-129: tmp = t_0 elif (x <= 4.5e-125) or not (x <= 0.85): tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x else: tmp = (x - math.log(x)) / n return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) tmp = 0.0 if (x <= 2e-226) tmp = t_0; elseif (x <= 4e-215) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 2.3e-129) tmp = t_0; elseif ((x <= 4.5e-125) || !(x <= 0.85)) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(x * n))) / x)) / x); else tmp = Float64(Float64(x - log(x)) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; tmp = 0.0; if (x <= 2e-226) tmp = t_0; elseif (x <= 4e-215) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 2.3e-129) tmp = t_0; elseif ((x <= 4.5e-125) || ~((x <= 0.85))) tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x; else tmp = (x - log(x)) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 2e-226], t$95$0, If[LessEqual[x, 4e-215], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.3e-129], t$95$0, If[Or[LessEqual[x, 4.5e-125], N[Not[LessEqual[x, 0.85]], $MachinePrecision]], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 2 \cdot 10^{-226}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-215}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-129}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-125} \lor \neg \left(x \leq 0.85\right):\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{x \cdot n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\end{array}
\end{array}
if x < 1.99999999999999984e-226 or 4.00000000000000017e-215 < x < 2.3e-129Initial program 35.8%
Taylor expanded in x around 0 35.8%
Taylor expanded in n around inf 66.7%
mul-1-neg66.7%
distribute-frac-neg266.7%
Simplified66.7%
if 1.99999999999999984e-226 < x < 4.00000000000000017e-215Initial program 83.9%
Taylor expanded in x around 0 83.9%
if 2.3e-129 < x < 4.50000000000000012e-125 or 0.849999999999999978 < x Initial program 68.8%
Taylor expanded in n around inf 65.8%
Simplified66.6%
add-sqr-sqrt66.5%
pow266.5%
fma-neg66.5%
Applied egg-rr66.5%
Taylor expanded in n around inf 64.4%
log1p-define64.4%
Simplified64.4%
Taylor expanded in x around -inf 66.0%
mul-1-neg66.0%
distribute-neg-frac266.0%
Simplified66.0%
if 4.50000000000000012e-125 < x < 0.849999999999999978Initial program 37.7%
Taylor expanded in x around 0 36.1%
Taylor expanded in n around inf 59.8%
Final simplification65.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n)))
(t_1
(/
(+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* x n))) x))
x)))
(if (<= x 5.8e-226)
t_0
(if (<= x 3.5e-215)
t_1
(if (<= x 2.2e-129)
t_0
(if (or (<= x 4.5e-125) (not (<= x 0.85)))
t_1
(/ (- x (log x)) n)))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double t_1 = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
double tmp;
if (x <= 5.8e-226) {
tmp = t_0;
} else if (x <= 3.5e-215) {
tmp = t_1;
} else if (x <= 2.2e-129) {
tmp = t_0;
} else if ((x <= 4.5e-125) || !(x <= 0.85)) {
tmp = t_1;
} else {
tmp = (x - log(x)) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = log(x) / -n
t_1 = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (x * n))) / x)) / x
if (x <= 5.8d-226) then
tmp = t_0
else if (x <= 3.5d-215) then
tmp = t_1
else if (x <= 2.2d-129) then
tmp = t_0
else if ((x <= 4.5d-125) .or. (.not. (x <= 0.85d0))) then
tmp = t_1
else
tmp = (x - log(x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double t_1 = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
double tmp;
if (x <= 5.8e-226) {
tmp = t_0;
} else if (x <= 3.5e-215) {
tmp = t_1;
} else if (x <= 2.2e-129) {
tmp = t_0;
} else if ((x <= 4.5e-125) || !(x <= 0.85)) {
tmp = t_1;
} else {
tmp = (x - Math.log(x)) / n;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n t_1 = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x tmp = 0 if x <= 5.8e-226: tmp = t_0 elif x <= 3.5e-215: tmp = t_1 elif x <= 2.2e-129: tmp = t_0 elif (x <= 4.5e-125) or not (x <= 0.85): tmp = t_1 else: tmp = (x - math.log(x)) / n return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) t_1 = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(x * n))) / x)) / x) tmp = 0.0 if (x <= 5.8e-226) tmp = t_0; elseif (x <= 3.5e-215) tmp = t_1; elseif (x <= 2.2e-129) tmp = t_0; elseif ((x <= 4.5e-125) || !(x <= 0.85)) tmp = t_1; else tmp = Float64(Float64(x - log(x)) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; t_1 = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x; tmp = 0.0; if (x <= 5.8e-226) tmp = t_0; elseif (x <= 3.5e-215) tmp = t_1; elseif (x <= 2.2e-129) tmp = t_0; elseif ((x <= 4.5e-125) || ~((x <= 0.85))) tmp = t_1; else tmp = (x - log(x)) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, 5.8e-226], t$95$0, If[LessEqual[x, 3.5e-215], t$95$1, If[LessEqual[x, 2.2e-129], t$95$0, If[Or[LessEqual[x, 4.5e-125], N[Not[LessEqual[x, 0.85]], $MachinePrecision]], t$95$1, N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
t_1 := \frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{x \cdot n}}{x}}{x}\\
\mathbf{if}\;x \leq 5.8 \cdot 10^{-226}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-215}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-129}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-125} \lor \neg \left(x \leq 0.85\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\end{array}
\end{array}
if x < 5.80000000000000003e-226 or 3.5000000000000002e-215 < x < 2.20000000000000003e-129Initial program 35.8%
Taylor expanded in x around 0 35.8%
Taylor expanded in n around inf 66.7%
mul-1-neg66.7%
distribute-frac-neg266.7%
Simplified66.7%
if 5.80000000000000003e-226 < x < 3.5000000000000002e-215 or 2.20000000000000003e-129 < x < 4.50000000000000012e-125 or 0.849999999999999978 < x Initial program 69.5%
Taylor expanded in n around inf 63.7%
Simplified64.4%
add-sqr-sqrt64.4%
pow264.4%
fma-neg64.4%
Applied egg-rr64.4%
Taylor expanded in n around inf 61.7%
log1p-define61.7%
Simplified61.7%
Taylor expanded in x around -inf 66.8%
mul-1-neg66.8%
distribute-neg-frac266.8%
Simplified66.8%
if 4.50000000000000012e-125 < x < 0.849999999999999978Initial program 37.7%
Taylor expanded in x around 0 36.1%
Taylor expanded in n around inf 59.8%
Final simplification65.4%
(FPCore (x n)
:precision binary64
(if (or (<= x 6.1e-226)
(and (not (<= x 3.5e-215))
(or (<= x 2.05e-129) (and (not (<= x 1.2e-124)) (<= x 0.6)))))
(/ (log x) (- n))
(/ (+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* x n))) x)) x)))
double code(double x, double n) {
double tmp;
if ((x <= 6.1e-226) || (!(x <= 3.5e-215) && ((x <= 2.05e-129) || (!(x <= 1.2e-124) && (x <= 0.6))))) {
tmp = log(x) / -n;
} else {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((x <= 6.1d-226) .or. (.not. (x <= 3.5d-215)) .and. (x <= 2.05d-129) .or. (.not. (x <= 1.2d-124)) .and. (x <= 0.6d0)) then
tmp = log(x) / -n
else
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (x * n))) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((x <= 6.1e-226) || (!(x <= 3.5e-215) && ((x <= 2.05e-129) || (!(x <= 1.2e-124) && (x <= 0.6))))) {
tmp = Math.log(x) / -n;
} else {
tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (x <= 6.1e-226) or (not (x <= 3.5e-215) and ((x <= 2.05e-129) or (not (x <= 1.2e-124) and (x <= 0.6)))): tmp = math.log(x) / -n else: tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x return tmp
function code(x, n) tmp = 0.0 if ((x <= 6.1e-226) || (!(x <= 3.5e-215) && ((x <= 2.05e-129) || (!(x <= 1.2e-124) && (x <= 0.6))))) tmp = Float64(log(x) / Float64(-n)); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(x * n))) / x)) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((x <= 6.1e-226) || (~((x <= 3.5e-215)) && ((x <= 2.05e-129) || (~((x <= 1.2e-124)) && (x <= 0.6))))) tmp = log(x) / -n; else tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := If[Or[LessEqual[x, 6.1e-226], And[N[Not[LessEqual[x, 3.5e-215]], $MachinePrecision], Or[LessEqual[x, 2.05e-129], And[N[Not[LessEqual[x, 1.2e-124]], $MachinePrecision], LessEqual[x, 0.6]]]]], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.1 \cdot 10^{-226} \lor \neg \left(x \leq 3.5 \cdot 10^{-215}\right) \land \left(x \leq 2.05 \cdot 10^{-129} \lor \neg \left(x \leq 1.2 \cdot 10^{-124}\right) \land x \leq 0.6\right):\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{x \cdot n}}{x}}{x}\\
\end{array}
\end{array}
if x < 6.0999999999999998e-226 or 3.5000000000000002e-215 < x < 2.05e-129 or 1.19999999999999996e-124 < x < 0.599999999999999978Initial program 36.6%
Taylor expanded in x around 0 35.8%
Taylor expanded in n around inf 63.7%
mul-1-neg63.7%
distribute-frac-neg263.7%
Simplified63.7%
if 6.0999999999999998e-226 < x < 3.5000000000000002e-215 or 2.05e-129 < x < 1.19999999999999996e-124 or 0.599999999999999978 < x Initial program 69.5%
Taylor expanded in n around inf 63.7%
Simplified64.4%
add-sqr-sqrt64.4%
pow264.4%
fma-neg64.4%
Applied egg-rr64.4%
Taylor expanded in n around inf 61.7%
log1p-define61.7%
Simplified61.7%
Taylor expanded in x around -inf 66.8%
mul-1-neg66.8%
distribute-neg-frac266.8%
Simplified66.8%
Final simplification65.3%
(FPCore (x n) :precision binary64 (/ (+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* x n))) x)) x))
double code(double x, double n) {
return ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (x * n))) / x)) / x
end function
public static double code(double x, double n) {
return ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x;
}
def code(x, n): return ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x
function code(x, n) return Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(x * n))) / x)) / x) end
function tmp = code(x, n) tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (x * n))) / x)) / x; end
code[x_, n_] := N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{x \cdot n}}{x}}{x}
\end{array}
Initial program 53.6%
Taylor expanded in n around inf 70.1%
Simplified70.5%
add-sqr-sqrt70.2%
pow270.2%
fma-neg70.2%
Applied egg-rr70.2%
Taylor expanded in n around inf 62.8%
log1p-define62.8%
Simplified62.8%
Taylor expanded in x around -inf 45.5%
mul-1-neg45.5%
distribute-neg-frac245.5%
Simplified45.5%
Final simplification45.5%
(FPCore (x n) :precision binary64 (/ (/ 1.0 n) x))
double code(double x, double n) {
return (1.0 / n) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) / x
end function
public static double code(double x, double n) {
return (1.0 / n) / x;
}
def code(x, n): return (1.0 / n) / x
function code(x, n) return Float64(Float64(1.0 / n) / x) end
function tmp = code(x, n) tmp = (1.0 / n) / x; end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n}}{x}
\end{array}
Initial program 53.6%
Taylor expanded in x around inf 60.0%
mul-1-neg60.0%
log-rec60.0%
mul-1-neg60.0%
distribute-neg-frac60.0%
mul-1-neg60.0%
remove-double-neg60.0%
*-commutative60.0%
Simplified60.0%
associate-/r*60.8%
div-inv60.8%
pow-to-exp60.8%
pow160.8%
pow-div60.8%
Applied egg-rr60.8%
Taylor expanded in n around inf 39.4%
associate-/r*40.0%
Simplified40.0%
(FPCore (x n) :precision binary64 (/ 1.0 (* x n)))
double code(double x, double n) {
return 1.0 / (x * n);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (x * n)
end function
public static double code(double x, double n) {
return 1.0 / (x * n);
}
def code(x, n): return 1.0 / (x * n)
function code(x, n) return Float64(1.0 / Float64(x * n)) end
function tmp = code(x, n) tmp = 1.0 / (x * n); end
code[x_, n_] := N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x \cdot n}
\end{array}
Initial program 53.6%
Taylor expanded in x around inf 60.0%
mul-1-neg60.0%
log-rec60.0%
mul-1-neg60.0%
distribute-neg-frac60.0%
mul-1-neg60.0%
remove-double-neg60.0%
*-commutative60.0%
Simplified60.0%
Taylor expanded in n around inf 39.4%
*-commutative39.4%
Simplified39.4%
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
return x / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = x / n
end function
public static double code(double x, double n) {
return x / n;
}
def code(x, n): return x / n
function code(x, n) return Float64(x / n) end
function tmp = code(x, n) tmp = x / n; end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{n}
\end{array}
Initial program 53.6%
Taylor expanded in x around 0 28.5%
Taylor expanded in x around inf 4.2%
herbie shell --seed 2024095
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))