
(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 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(if (<= x 660.0)
(/
(log
(/
x
(exp
(+
(log1p x)
(/
(fma
0.5
(- (pow (log1p x) 2.0) (pow (log x) 2.0))
(*
0.16666666666666666
(/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n)))
n)))))
(- n))
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 660.0) {
tmp = log((x / exp((log1p(x) + (fma(0.5, (pow(log1p(x), 2.0) - pow(log(x), 2.0)), (0.16666666666666666 * ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n))) / n))))) / -n;
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
function code(x, n) tmp = 0.0 if (x <= 660.0) tmp = Float64(log(Float64(x / exp(Float64(log1p(x) + Float64(fma(0.5, Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)), Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n))) / n))))) / Float64(-n)); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
code[x_, n_] := If[LessEqual[x, 660.0], N[(N[Log[N[(x / N[Exp[N[(N[Log[1 + x], $MachinePrecision] + 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] + N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]], $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 660:\\
\;\;\;\;\frac{\log \left(\frac{x}{e^{\mathsf{log1p}\left(x\right) + \frac{\mathsf{fma}\left(0.5, {\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}, 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}\right)}{n}}}\right)}{-n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 660Initial program 41.5%
Taylor expanded in n around -inf 77.7%
Simplified77.7%
add-log-exp83.3%
diff-log83.4%
fma-define83.4%
Applied egg-rr83.4%
if 660 < x Initial program 66.2%
Taylor expanded in x around inf 97.9%
mul-1-neg97.9%
log-rec97.9%
mul-1-neg97.9%
distribute-neg-frac97.9%
mul-1-neg97.9%
remove-double-neg97.9%
*-commutative97.9%
Simplified97.9%
Taylor expanded in x around 0 97.9%
associate-/r*99.0%
*-lft-identity99.0%
associate-*l/99.0%
*-commutative99.0%
exp-to-pow99.0%
Simplified99.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 1.05e-265)
(- 1.0 t_0)
(if (<= x 2500.0)
(/
(-
(+
(log1p x)
(/
(+
(*
0.16666666666666666
(/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n))
(* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0))))
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 <= 1.05e-265) {
tmp = 1.0 - t_0;
} else if (x <= 2500.0) {
tmp = ((log1p(x) + (((0.16666666666666666 * ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n)) + (0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0)))) / n)) - log(x)) / n;
} 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 <= 1.05e-265) {
tmp = 1.0 - t_0;
} else if (x <= 2500.0) {
tmp = ((Math.log1p(x) + (((0.16666666666666666 * ((Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0)) / n)) + (0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)))) / 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 <= 1.05e-265: tmp = 1.0 - t_0 elif x <= 2500.0: tmp = ((math.log1p(x) + (((0.16666666666666666 * ((math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0)) / n)) + (0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0)))) / 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 <= 1.05e-265) tmp = Float64(1.0 - t_0); elseif (x <= 2500.0) tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n)) + Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)))) / n)) - log(x)) / n); 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, 1.05e-265], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[x, 2500.0], N[(N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + 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[(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 1.05 \cdot 10^{-265}:\\
\;\;\;\;1 - t\_0\\
\mathbf{elif}\;x \leq 2500:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n} + 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{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < 1.05000000000000002e-265Initial program 67.1%
Taylor expanded in x around 0 67.1%
*-rgt-identity67.1%
associate-/l*67.1%
exp-to-pow67.1%
Simplified67.1%
if 1.05000000000000002e-265 < x < 2500Initial program 35.2%
Taylor expanded in n around -inf 84.4%
Simplified84.4%
if 2500 < x Initial program 66.2%
Taylor expanded in x around inf 97.9%
mul-1-neg97.9%
log-rec97.9%
mul-1-neg97.9%
distribute-neg-frac97.9%
mul-1-neg97.9%
remove-double-neg97.9%
*-commutative97.9%
Simplified97.9%
Taylor expanded in x around 0 97.9%
associate-/r*99.0%
*-lft-identity99.0%
associate-*l/99.0%
*-commutative99.0%
exp-to-pow99.0%
Simplified99.0%
Final simplification88.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 5.6e-268)
(- 1.0 t_0)
(if (<= x 0.116)
(/
(-
(/
(-
(* (pow (log x) 2.0) -0.5)
(* 0.16666666666666666 (/ (pow (log x) 3.0) n)))
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 <= 5.6e-268) {
tmp = 1.0 - t_0;
} else if (x <= 0.116) {
tmp = ((((pow(log(x), 2.0) * -0.5) - (0.16666666666666666 * (pow(log(x), 3.0) / n))) / 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 <= 5.6d-268) then
tmp = 1.0d0 - t_0
else if (x <= 0.116d0) then
tmp = (((((log(x) ** 2.0d0) * (-0.5d0)) - (0.16666666666666666d0 * ((log(x) ** 3.0d0) / n))) / 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 <= 5.6e-268) {
tmp = 1.0 - t_0;
} else if (x <= 0.116) {
tmp = ((((Math.pow(Math.log(x), 2.0) * -0.5) - (0.16666666666666666 * (Math.pow(Math.log(x), 3.0) / n))) / 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 <= 5.6e-268: tmp = 1.0 - t_0 elif x <= 0.116: tmp = ((((math.pow(math.log(x), 2.0) * -0.5) - (0.16666666666666666 * (math.pow(math.log(x), 3.0) / n))) / 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 <= 5.6e-268) tmp = Float64(1.0 - t_0); elseif (x <= 0.116) tmp = Float64(Float64(Float64(Float64(Float64((log(x) ^ 2.0) * -0.5) - Float64(0.16666666666666666 * Float64((log(x) ^ 3.0) / n))) / n) - 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 <= 5.6e-268) tmp = 1.0 - t_0; elseif (x <= 0.116) tmp = (((((log(x) ^ 2.0) * -0.5) - (0.16666666666666666 * ((log(x) ^ 3.0) / n))) / 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, 5.6e-268], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[x, 0.116], N[(N[(N[(N[(N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision] - N[(0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $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)}\\
\mathbf{if}\;x \leq 5.6 \cdot 10^{-268}:\\
\;\;\;\;1 - t\_0\\
\mathbf{elif}\;x \leq 0.116:\\
\;\;\;\;\frac{\frac{{\log x}^{2} \cdot -0.5 - 0.16666666666666666 \cdot \frac{{\log x}^{3}}{n}}{n} - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < 5.6000000000000003e-268Initial program 67.1%
Taylor expanded in x around 0 67.1%
*-rgt-identity67.1%
associate-/l*67.1%
exp-to-pow67.1%
Simplified67.1%
if 5.6000000000000003e-268 < x < 0.116000000000000006Initial program 35.5%
Taylor expanded in x around 0 33.0%
*-rgt-identity33.0%
associate-/l*33.0%
exp-to-pow33.0%
Simplified33.0%
Taylor expanded in n around -inf 84.0%
mul-1-neg84.0%
Simplified84.0%
Taylor expanded in n around inf 84.0%
if 0.116000000000000006 < x Initial program 65.7%
Taylor expanded in x around inf 97.2%
mul-1-neg97.2%
log-rec97.2%
mul-1-neg97.2%
distribute-neg-frac97.2%
mul-1-neg97.2%
remove-double-neg97.2%
*-commutative97.2%
Simplified97.2%
Taylor expanded in x around 0 97.2%
associate-/r*98.4%
*-lft-identity98.4%
associate-*l/98.4%
*-commutative98.4%
exp-to-pow98.4%
Simplified98.4%
Final simplification88.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ (/ 1.0 n) 2.0))) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2.5e-20)
(/ (/ t_1 n) x)
(if (<= (/ 1.0 n) 2e-51)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5.0)
(/ (* t_0 t_0) (* x n))
(- (exp (/ x n)) t_1))))))
double code(double x, double n) {
double t_0 = pow(x, ((1.0 / n) / 2.0));
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_1 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = (t_0 * t_0) / (x * n);
} else {
tmp = exp((x / n)) - t_1;
}
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) / 2.0d0)
t_1 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2.5d-20)) then
tmp = (t_1 / n) / x
else if ((1.0d0 / n) <= 2d-51) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5.0d0) then
tmp = (t_0 * t_0) / (x * n)
else
tmp = exp((x / n)) - t_1
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, ((1.0 / n) / 2.0));
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_1 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = (t_0 * t_0) / (x * n);
} else {
tmp = Math.exp((x / n)) - t_1;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, ((1.0 / n) / 2.0)) t_1 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2.5e-20: tmp = (t_1 / n) / x elif (1.0 / n) <= 2e-51: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5.0: tmp = (t_0 * t_0) / (x * n) else: tmp = math.exp((x / n)) - t_1 return tmp
function code(x, n) t_0 = x ^ Float64(Float64(1.0 / n) / 2.0) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2.5e-20) tmp = Float64(Float64(t_1 / n) / x); elseif (Float64(1.0 / n) <= 2e-51) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5.0) tmp = Float64(Float64(t_0 * t_0) / Float64(x * n)); else tmp = Float64(exp(Float64(x / n)) - t_1); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ ((1.0 / n) / 2.0); t_1 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2.5e-20) tmp = (t_1 / n) / x; elseif ((1.0 / n) <= 2e-51) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5.0) tmp = (t_0 * t_0) / (x * n); else tmp = exp((x / n)) - t_1; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(N[(1.0 / n), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2.5e-20], N[(N[(t$95$1 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-51], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5.0], N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{\frac{1}{n}}{2}\right)}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2.5 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{t\_1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-51}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5:\\
\;\;\;\;\frac{t\_0 \cdot t\_0}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_1\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.4999999999999999e-20Initial program 92.0%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
mul-1-neg96.5%
distribute-neg-frac96.5%
mul-1-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
associate-/r*96.5%
*-lft-identity96.5%
associate-*l/96.5%
*-commutative96.5%
exp-to-pow96.5%
Simplified96.5%
if -2.4999999999999999e-20 < (/.f64 #s(literal 1 binary64) n) < 2e-51Initial program 27.1%
Taylor expanded in n around inf 82.4%
log1p-define82.4%
Simplified82.4%
log1p-undefine82.4%
diff-log82.6%
Applied egg-rr82.6%
+-commutative82.6%
Simplified82.6%
if 2e-51 < (/.f64 #s(literal 1 binary64) n) < 5Initial program 4.9%
Taylor expanded in x around inf 76.9%
mul-1-neg76.9%
log-rec76.9%
mul-1-neg76.9%
distribute-neg-frac76.9%
mul-1-neg76.9%
remove-double-neg76.9%
*-commutative76.9%
Simplified76.9%
div-inv76.9%
pow-to-exp77.1%
add-cbrt-cube65.1%
pow1/365.3%
pow365.3%
pow-pow65.3%
Applied egg-rr65.3%
pow-unpow65.3%
pow-pow77.1%
metadata-eval77.1%
pow177.1%
sqr-pow77.1%
Applied egg-rr77.1%
if 5 < (/.f64 #s(literal 1 binary64) n) Initial program 62.0%
Taylor expanded in n around 0 62.0%
log1p-define100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2.5e-20)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 2e-51)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5.0)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 2e+187)
(- (+ 1.0 (/ x n)) t_0)
(log1p (expm1 (/ x n)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 2e+187) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = log1p(expm1((x / n)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 2e+187) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.log1p(Math.expm1((x / n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2.5e-20: tmp = (t_0 / n) / x elif (1.0 / n) <= 2e-51: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5.0: tmp = t_0 / (x * n) elif (1.0 / n) <= 2e+187: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.log1p(math.expm1((x / n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2.5e-20) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 2e-51) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5.0) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 2e+187) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = log1p(expm1(Float64(x / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2.5e-20], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-51], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5.0], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+187], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[1 + N[(Exp[N[(x / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2.5 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-51}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+187}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.4999999999999999e-20Initial program 92.0%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
mul-1-neg96.5%
distribute-neg-frac96.5%
mul-1-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
associate-/r*96.5%
*-lft-identity96.5%
associate-*l/96.5%
*-commutative96.5%
exp-to-pow96.5%
Simplified96.5%
if -2.4999999999999999e-20 < (/.f64 #s(literal 1 binary64) n) < 2e-51Initial program 27.1%
Taylor expanded in n around inf 82.4%
log1p-define82.4%
Simplified82.4%
log1p-undefine82.4%
diff-log82.6%
Applied egg-rr82.6%
+-commutative82.6%
Simplified82.6%
if 2e-51 < (/.f64 #s(literal 1 binary64) n) < 5Initial program 4.9%
Taylor expanded in x around inf 76.9%
mul-1-neg76.9%
log-rec76.9%
mul-1-neg76.9%
distribute-neg-frac76.9%
mul-1-neg76.9%
remove-double-neg76.9%
*-rgt-identity76.9%
associate-/l*76.9%
exp-to-pow77.1%
*-commutative77.1%
Simplified77.1%
if 5 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999981e187Initial program 84.0%
Taylor expanded in x around 0 84.9%
if 1.99999999999999981e187 < (/.f64 #s(literal 1 binary64) n) Initial program 41.0%
Taylor expanded in x around 0 29.6%
Taylor expanded in x around inf 5.6%
log1p-expm1-u76.0%
Applied egg-rr76.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2.5e-20)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 2e-51)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5.0)
(/ (pow E (/ (log x) n)) (* x n))
(- (exp (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = pow(((double) M_E), (log(x) / n)) / (x * n);
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = Math.pow(Math.E, (Math.log(x) / n)) / (x * n);
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2.5e-20: tmp = (t_0 / n) / x elif (1.0 / n) <= 2e-51: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5.0: tmp = math.pow(math.e, (math.log(x) / n)) / (x * n) else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2.5e-20) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 2e-51) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5.0) tmp = Float64((exp(1) ^ Float64(log(x) / n)) / Float64(x * n)); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2.5e-20) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 2e-51) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5.0) tmp = (2.71828182845904523536 ^ (log(x) / n)) / (x * n); else tmp = exp((x / n)) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2.5e-20], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-51], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5.0], N[(N[Power[E, N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2.5 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-51}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5:\\
\;\;\;\;\frac{{e}^{\left(\frac{\log x}{n}\right)}}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.4999999999999999e-20Initial program 92.0%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
mul-1-neg96.5%
distribute-neg-frac96.5%
mul-1-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
associate-/r*96.5%
*-lft-identity96.5%
associate-*l/96.5%
*-commutative96.5%
exp-to-pow96.5%
Simplified96.5%
if -2.4999999999999999e-20 < (/.f64 #s(literal 1 binary64) n) < 2e-51Initial program 27.1%
Taylor expanded in n around inf 82.4%
log1p-define82.4%
Simplified82.4%
log1p-undefine82.4%
diff-log82.6%
Applied egg-rr82.6%
+-commutative82.6%
Simplified82.6%
if 2e-51 < (/.f64 #s(literal 1 binary64) n) < 5Initial program 4.9%
Taylor expanded in x around inf 76.9%
mul-1-neg76.9%
log-rec76.9%
mul-1-neg76.9%
distribute-neg-frac76.9%
mul-1-neg76.9%
remove-double-neg76.9%
*-commutative76.9%
Simplified76.9%
*-un-lft-identity76.9%
exp-prod77.8%
Applied egg-rr77.8%
if 5 < (/.f64 #s(literal 1 binary64) n) Initial program 62.0%
Taylor expanded in n around 0 62.0%
log1p-define100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification89.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2.5e-20)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 2e-51)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5.0)
(/ (pow (sqrt x) (/ 2.0 n)) (* x n))
(- (exp (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = pow(sqrt(x), (2.0 / n)) / (x * n);
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2.5d-20)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 2d-51) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5.0d0) then
tmp = (sqrt(x) ** (2.0d0 / n)) / (x * n)
else
tmp = exp((x / n)) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = Math.pow(Math.sqrt(x), (2.0 / n)) / (x * n);
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2.5e-20: tmp = (t_0 / n) / x elif (1.0 / n) <= 2e-51: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5.0: tmp = math.pow(math.sqrt(x), (2.0 / n)) / (x * n) else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2.5e-20) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 2e-51) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5.0) tmp = Float64((sqrt(x) ^ Float64(2.0 / n)) / Float64(x * n)); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2.5e-20) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 2e-51) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5.0) tmp = (sqrt(x) ^ (2.0 / n)) / (x * n); else tmp = exp((x / n)) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2.5e-20], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-51], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5.0], N[(N[Power[N[Sqrt[x], $MachinePrecision], N[(2.0 / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2.5 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-51}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5:\\
\;\;\;\;\frac{{\left(\sqrt{x}\right)}^{\left(\frac{2}{n}\right)}}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.4999999999999999e-20Initial program 92.0%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
mul-1-neg96.5%
distribute-neg-frac96.5%
mul-1-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
associate-/r*96.5%
*-lft-identity96.5%
associate-*l/96.5%
*-commutative96.5%
exp-to-pow96.5%
Simplified96.5%
if -2.4999999999999999e-20 < (/.f64 #s(literal 1 binary64) n) < 2e-51Initial program 27.1%
Taylor expanded in n around inf 82.4%
log1p-define82.4%
Simplified82.4%
log1p-undefine82.4%
diff-log82.6%
Applied egg-rr82.6%
+-commutative82.6%
Simplified82.6%
if 2e-51 < (/.f64 #s(literal 1 binary64) n) < 5Initial program 4.9%
Taylor expanded in x around inf 76.9%
mul-1-neg76.9%
log-rec76.9%
mul-1-neg76.9%
distribute-neg-frac76.9%
mul-1-neg76.9%
remove-double-neg76.9%
*-rgt-identity76.9%
associate-/l*76.9%
exp-to-pow77.1%
*-commutative77.1%
Simplified77.1%
add-sqr-sqrt77.1%
unpow-prod-down77.1%
Applied egg-rr77.1%
pow-sqr77.1%
associate-*r/77.1%
metadata-eval77.1%
Simplified77.1%
if 5 < (/.f64 #s(literal 1 binary64) n) Initial program 62.0%
Taylor expanded in n around 0 62.0%
log1p-define100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2.5e-20)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 2e-51)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5.0) (/ t_0 (* x n)) (- (exp (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = t_0 / (x * n);
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2.5d-20)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 2d-51) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5.0d0) then
tmp = t_0 / (x * n)
else
tmp = exp((x / n)) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = t_0 / (x * n);
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2.5e-20: tmp = (t_0 / n) / x elif (1.0 / n) <= 2e-51: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5.0: tmp = t_0 / (x * n) else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2.5e-20) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 2e-51) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5.0) tmp = Float64(t_0 / Float64(x * n)); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2.5e-20) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 2e-51) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5.0) tmp = t_0 / (x * n); else tmp = exp((x / n)) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2.5e-20], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-51], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5.0], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2.5 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-51}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.4999999999999999e-20Initial program 92.0%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
mul-1-neg96.5%
distribute-neg-frac96.5%
mul-1-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
associate-/r*96.5%
*-lft-identity96.5%
associate-*l/96.5%
*-commutative96.5%
exp-to-pow96.5%
Simplified96.5%
if -2.4999999999999999e-20 < (/.f64 #s(literal 1 binary64) n) < 2e-51Initial program 27.1%
Taylor expanded in n around inf 82.4%
log1p-define82.4%
Simplified82.4%
log1p-undefine82.4%
diff-log82.6%
Applied egg-rr82.6%
+-commutative82.6%
Simplified82.6%
if 2e-51 < (/.f64 #s(literal 1 binary64) n) < 5Initial program 4.9%
Taylor expanded in x around inf 76.9%
mul-1-neg76.9%
log-rec76.9%
mul-1-neg76.9%
distribute-neg-frac76.9%
mul-1-neg76.9%
remove-double-neg76.9%
*-rgt-identity76.9%
associate-/l*76.9%
exp-to-pow77.1%
*-commutative77.1%
Simplified77.1%
if 5 < (/.f64 #s(literal 1 binary64) n) Initial program 62.0%
Taylor expanded in n around 0 62.0%
log1p-define100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2.5e-20)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 2e-51)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5.0)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 2e+187)
(- (+ 1.0 (/ x n)) t_0)
(/
(/ (+ 1.0 (/ (- (* 0.3333333333333333 (/ 1.0 x)) 0.5) x)) x)
n)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 2e+187) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / 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 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2.5d-20)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 2d-51) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5.0d0) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= 2d+187) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = ((1.0d0 + (((0.3333333333333333d0 * (1.0d0 / x)) - 0.5d0) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 2e+187) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2.5e-20: tmp = (t_0 / n) / x elif (1.0 / n) <= 2e-51: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5.0: tmp = t_0 / (x * n) elif (1.0 / n) <= 2e+187: tmp = (1.0 + (x / n)) - t_0 else: tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2.5e-20) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 2e-51) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5.0) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 2e+187) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 0.5) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2.5e-20) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 2e-51) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5.0) tmp = t_0 / (x * n); elseif ((1.0 / n) <= 2e+187) tmp = (1.0 + (x / n)) - t_0; else tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2.5e-20], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-51], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5.0], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+187], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2.5 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-51}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+187}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.4999999999999999e-20Initial program 92.0%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
mul-1-neg96.5%
distribute-neg-frac96.5%
mul-1-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
associate-/r*96.5%
*-lft-identity96.5%
associate-*l/96.5%
*-commutative96.5%
exp-to-pow96.5%
Simplified96.5%
if -2.4999999999999999e-20 < (/.f64 #s(literal 1 binary64) n) < 2e-51Initial program 27.1%
Taylor expanded in n around inf 82.4%
log1p-define82.4%
Simplified82.4%
log1p-undefine82.4%
diff-log82.6%
Applied egg-rr82.6%
+-commutative82.6%
Simplified82.6%
if 2e-51 < (/.f64 #s(literal 1 binary64) n) < 5Initial program 4.9%
Taylor expanded in x around inf 76.9%
mul-1-neg76.9%
log-rec76.9%
mul-1-neg76.9%
distribute-neg-frac76.9%
mul-1-neg76.9%
remove-double-neg76.9%
*-rgt-identity76.9%
associate-/l*76.9%
exp-to-pow77.1%
*-commutative77.1%
Simplified77.1%
if 5 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999981e187Initial program 84.0%
Taylor expanded in x around 0 84.9%
if 1.99999999999999981e187 < (/.f64 #s(literal 1 binary64) n) Initial program 41.0%
Taylor expanded in n around inf 6.4%
log1p-define6.4%
Simplified6.4%
Taylor expanded in x around -inf 58.8%
Final simplification84.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2.5e-20)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 2e-51)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5.0)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 2e+187)
(- 1.0 t_0)
(/
(/ (+ 1.0 (/ (- (* 0.3333333333333333 (/ 1.0 x)) 0.5) x)) x)
n)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 2e+187) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / 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 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2.5d-20)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 2d-51) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5.0d0) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= 2d+187) then
tmp = 1.0d0 - t_0
else
tmp = ((1.0d0 + (((0.3333333333333333d0 * (1.0d0 / x)) - 0.5d0) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-51) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 2e+187) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2.5e-20: tmp = (t_0 / n) / x elif (1.0 / n) <= 2e-51: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5.0: tmp = t_0 / (x * n) elif (1.0 / n) <= 2e+187: tmp = 1.0 - t_0 else: tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2.5e-20) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 2e-51) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5.0) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 2e+187) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 0.5) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2.5e-20) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 2e-51) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5.0) tmp = t_0 / (x * n); elseif ((1.0 / n) <= 2e+187) tmp = 1.0 - t_0; else tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2.5e-20], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-51], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5.0], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+187], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2.5 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-51}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+187}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.4999999999999999e-20Initial program 92.0%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
mul-1-neg96.5%
distribute-neg-frac96.5%
mul-1-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
associate-/r*96.5%
*-lft-identity96.5%
associate-*l/96.5%
*-commutative96.5%
exp-to-pow96.5%
Simplified96.5%
if -2.4999999999999999e-20 < (/.f64 #s(literal 1 binary64) n) < 2e-51Initial program 27.1%
Taylor expanded in n around inf 82.4%
log1p-define82.4%
Simplified82.4%
log1p-undefine82.4%
diff-log82.6%
Applied egg-rr82.6%
+-commutative82.6%
Simplified82.6%
if 2e-51 < (/.f64 #s(literal 1 binary64) n) < 5Initial program 4.9%
Taylor expanded in x around inf 76.9%
mul-1-neg76.9%
log-rec76.9%
mul-1-neg76.9%
distribute-neg-frac76.9%
mul-1-neg76.9%
remove-double-neg76.9%
*-rgt-identity76.9%
associate-/l*76.9%
exp-to-pow77.1%
*-commutative77.1%
Simplified77.1%
if 5 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999981e187Initial program 84.0%
Taylor expanded in x around 0 84.0%
*-rgt-identity84.0%
associate-/l*84.0%
exp-to-pow84.0%
Simplified84.0%
if 1.99999999999999981e187 < (/.f64 #s(literal 1 binary64) n) Initial program 41.0%
Taylor expanded in n around inf 6.4%
log1p-define6.4%
Simplified6.4%
Taylor expanded in x around -inf 58.8%
Final simplification84.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (/ t_0 n) x)))
(if (<= (/ 1.0 n) -2.5e-20)
t_1
(if (<= (/ 1.0 n) 2e-51)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5.0)
t_1
(if (<= (/ 1.0 n) 2e+187)
(- 1.0 t_0)
(/
(/ (+ 1.0 (/ (- (* 0.3333333333333333 (/ 1.0 x)) 0.5) x)) x)
n)))))))
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) <= -2.5e-20) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-51) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+187) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / 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 = x ** (1.0d0 / n)
t_1 = (t_0 / n) / x
if ((1.0d0 / n) <= (-2.5d-20)) then
tmp = t_1
else if ((1.0d0 / n) <= 2d-51) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5.0d0) then
tmp = t_1
else if ((1.0d0 / n) <= 2d+187) then
tmp = 1.0d0 - t_0
else
tmp = ((1.0d0 + (((0.3333333333333333d0 * (1.0d0 / x)) - 0.5d0) / x)) / x) / n
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 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -2.5e-20) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-51) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+187) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
}
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) <= -2.5e-20: tmp = t_1 elif (1.0 / n) <= 2e-51: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5.0: tmp = t_1 elif (1.0 / n) <= 2e+187: tmp = 1.0 - t_0 else: tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n 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) <= -2.5e-20) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-51) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5.0) tmp = t_1; elseif (Float64(1.0 / n) <= 2e+187) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 0.5) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = (t_0 / n) / x; tmp = 0.0; if ((1.0 / n) <= -2.5e-20) tmp = t_1; elseif ((1.0 / n) <= 2e-51) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5.0) tmp = t_1; elseif ((1.0 / n) <= 2e+187) tmp = 1.0 - t_0; else tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n; 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[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2.5e-20], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-51], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5.0], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+187], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $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.5 \cdot 10^{-20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-51}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+187}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.4999999999999999e-20 or 2e-51 < (/.f64 #s(literal 1 binary64) n) < 5Initial program 78.8%
Taylor expanded in x around inf 93.5%
mul-1-neg93.5%
log-rec93.5%
mul-1-neg93.5%
distribute-neg-frac93.5%
mul-1-neg93.5%
remove-double-neg93.5%
*-commutative93.5%
Simplified93.5%
Taylor expanded in x around 0 93.5%
associate-/r*93.5%
*-lft-identity93.5%
associate-*l/93.5%
*-commutative93.5%
exp-to-pow93.5%
Simplified93.5%
if -2.4999999999999999e-20 < (/.f64 #s(literal 1 binary64) n) < 2e-51Initial program 27.1%
Taylor expanded in n around inf 82.4%
log1p-define82.4%
Simplified82.4%
log1p-undefine82.4%
diff-log82.6%
Applied egg-rr82.6%
+-commutative82.6%
Simplified82.6%
if 5 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999981e187Initial program 84.0%
Taylor expanded in x around 0 84.0%
*-rgt-identity84.0%
associate-/l*84.0%
exp-to-pow84.0%
Simplified84.0%
if 1.99999999999999981e187 < (/.f64 #s(literal 1 binary64) n) Initial program 41.0%
Taylor expanded in n around inf 6.4%
log1p-define6.4%
Simplified6.4%
Taylor expanded in x around -inf 58.8%
Final simplification84.6%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) 2e-51)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5.0)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e+187)
(- 1.0 (pow x (/ 1.0 n)))
(/ (/ (+ 1.0 (/ (- (* 0.3333333333333333 (/ 1.0 x)) 0.5) x)) x) n)))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2e-51) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e+187) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= 2d-51) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5.0d0) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 2d+187) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = ((1.0d0 + (((0.3333333333333333d0 * (1.0d0 / x)) - 0.5d0) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2e-51) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5.0) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e+187) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= 2e-51: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5.0: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e+187: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= 2e-51) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5.0) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e+187) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 0.5) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= 2e-51) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5.0) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 2e+187) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-51], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5.0], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+187], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq 2 \cdot 10^{-51}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+187}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < 2e-51Initial program 53.1%
Taylor expanded in n around inf 71.7%
log1p-define71.7%
Simplified71.7%
log1p-undefine71.7%
diff-log71.9%
Applied egg-rr71.9%
+-commutative71.9%
Simplified71.9%
if 2e-51 < (/.f64 #s(literal 1 binary64) n) < 5Initial program 4.9%
Taylor expanded in x around inf 76.9%
mul-1-neg76.9%
log-rec76.9%
mul-1-neg76.9%
distribute-neg-frac76.9%
mul-1-neg76.9%
remove-double-neg76.9%
*-rgt-identity76.9%
associate-/l*76.9%
exp-to-pow77.1%
*-commutative77.1%
Simplified77.1%
Taylor expanded in n around inf 57.5%
*-commutative57.5%
associate-/r*57.6%
Simplified57.6%
if 5 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999981e187Initial program 84.0%
Taylor expanded in x around 0 84.0%
*-rgt-identity84.0%
associate-/l*84.0%
exp-to-pow84.0%
Simplified84.0%
if 1.99999999999999981e187 < (/.f64 #s(literal 1 binary64) n) Initial program 41.0%
Taylor expanded in n around inf 6.4%
log1p-define6.4%
Simplified6.4%
Taylor expanded in x around -inf 58.8%
Final simplification71.0%
(FPCore (x n)
:precision binary64
(if (<= x 1.02e-266)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.94)
(/ (- x (log x)) n)
(/
(/
(+ 1.0 (/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
x)
n))))
double code(double x, double n) {
double tmp;
if (x <= 1.02e-266) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.94) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.02d-266) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.94d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.02e-266) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.94) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.02e-266: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.94: tmp = (x - math.log(x)) / n else: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.02e-266) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.94) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.02e-266) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.94) tmp = (x - log(x)) / n; else tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.02e-266], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.94], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.02 \cdot 10^{-266}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.94:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 1.02000000000000002e-266Initial program 67.1%
Taylor expanded in x around 0 67.1%
*-rgt-identity67.1%
associate-/l*67.1%
exp-to-pow67.1%
Simplified67.1%
if 1.02000000000000002e-266 < x < 0.93999999999999995Initial program 35.5%
Taylor expanded in x around 0 33.4%
Taylor expanded in n around inf 55.9%
if 0.93999999999999995 < x Initial program 65.7%
Taylor expanded in n around inf 64.8%
log1p-define64.8%
Simplified64.8%
Taylor expanded in x around -inf 57.5%
Final simplification57.8%
(FPCore (x n)
:precision binary64
(if (<= x 0.9)
(/ (- x (log x)) n)
(/
(/
(+ 1.0 (/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
x)
n)))
double code(double x, double n) {
double tmp;
if (x <= 0.9) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.9d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.9) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.9: tmp = (x - math.log(x)) / n else: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.9) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.9) tmp = (x - log(x)) / n; else tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.9], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.9:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 0.900000000000000022Initial program 41.8%
Taylor expanded in x around 0 40.1%
Taylor expanded in n around inf 52.3%
if 0.900000000000000022 < x Initial program 65.7%
Taylor expanded in n around inf 64.8%
log1p-define64.8%
Simplified64.8%
Taylor expanded in x around -inf 57.5%
Final simplification54.5%
(FPCore (x n)
:precision binary64
(if (<= x 0.7)
(/ (log x) (- n))
(/
(/
(+ 1.0 (/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
x)
n)))
double code(double x, double n) {
double tmp;
if (x <= 0.7) {
tmp = log(x) / -n;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.7d0) then
tmp = log(x) / -n
else
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.7) {
tmp = Math.log(x) / -n;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.7: tmp = math.log(x) / -n else: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.7) tmp = Float64(log(x) / Float64(-n)); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.7) tmp = log(x) / -n; else tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.7], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.7:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 0.69999999999999996Initial program 41.8%
Taylor expanded in x around 0 39.8%
*-rgt-identity39.8%
associate-/l*39.8%
exp-to-pow39.8%
Simplified39.8%
Taylor expanded in n around inf 52.1%
associate-*r/52.1%
neg-mul-152.1%
Simplified52.1%
if 0.69999999999999996 < x Initial program 65.7%
Taylor expanded in n around inf 64.8%
log1p-define64.8%
Simplified64.8%
Taylor expanded in x around -inf 57.5%
Final simplification54.4%
(FPCore (x n) :precision binary64 (/ (+ (/ 1.0 n) (/ (+ (* 0.3333333333333333 (/ 1.0 (* x n))) (* 0.5 (/ -1.0 n))) x)) x))
double code(double x, double n) {
return ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 / n) + (((0.3333333333333333d0 * (1.0d0 / (x * n))) + (0.5d0 * ((-1.0d0) / n))) / x)) / x
end function
public static double code(double x, double n) {
return ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x;
}
def code(x, n): return ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x
function code(x, n) return Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / Float64(x * n))) + Float64(0.5 * Float64(-1.0 / n))) / x)) / x) end
function tmp = code(x, n) tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x; end
code[x_, n_] := N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 * N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n} + \frac{0.3333333333333333 \cdot \frac{1}{x \cdot n} + 0.5 \cdot \frac{-1}{n}}{x}}{x}
\end{array}
Initial program 52.0%
Taylor expanded in n around inf 57.6%
log1p-define57.6%
Simplified57.6%
Taylor expanded in x around -inf 41.7%
Final simplification41.7%
(FPCore (x n) :precision binary64 (/ (/ (+ 1.0 (/ (- (* 0.3333333333333333 (/ 1.0 x)) 0.5) x)) x) n))
double code(double x, double n) {
return ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 + (((0.3333333333333333d0 * (1.0d0 / x)) - 0.5d0) / x)) / x) / n
end function
public static double code(double x, double n) {
return ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
}
def code(x, n): return ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n
function code(x, n) return Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 0.5) / x)) / x) / n) end
function tmp = code(x, n) tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n; end
code[x_, n_] := N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}
\end{array}
Initial program 52.0%
Taylor expanded in n around inf 57.6%
log1p-define57.6%
Simplified57.6%
Taylor expanded in x around -inf 41.6%
Final simplification41.6%
(FPCore (x n) :precision binary64 (/ (/ 1.0 x) n))
double code(double x, double n) {
return (1.0 / x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / x) / n
end function
public static double code(double x, double n) {
return (1.0 / x) / n;
}
def code(x, n): return (1.0 / x) / n
function code(x, n) return Float64(Float64(1.0 / x) / n) end
function tmp = code(x, n) tmp = (1.0 / x) / n; end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{n}
\end{array}
Initial program 52.0%
Taylor expanded in x around inf 54.3%
mul-1-neg54.3%
log-rec54.3%
mul-1-neg54.3%
distribute-neg-frac54.3%
mul-1-neg54.3%
remove-double-neg54.3%
*-rgt-identity54.3%
associate-/l*54.3%
exp-to-pow54.3%
*-commutative54.3%
Simplified54.3%
Taylor expanded in n around inf 35.7%
*-commutative35.7%
associate-/r*36.2%
Simplified36.2%
(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 52.0%
Taylor expanded in x around inf 54.3%
mul-1-neg54.3%
log-rec54.3%
mul-1-neg54.3%
distribute-neg-frac54.3%
mul-1-neg54.3%
remove-double-neg54.3%
*-rgt-identity54.3%
associate-/l*54.3%
exp-to-pow54.3%
*-commutative54.3%
Simplified54.3%
Taylor expanded in n around inf 35.7%
associate-/r*36.2%
Simplified36.2%
(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 52.0%
Taylor expanded in x around inf 54.3%
mul-1-neg54.3%
log-rec54.3%
mul-1-neg54.3%
distribute-neg-frac54.3%
mul-1-neg54.3%
remove-double-neg54.3%
*-commutative54.3%
Simplified54.3%
Taylor expanded in n around inf 35.7%
*-commutative35.7%
Simplified35.7%
(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 52.0%
Taylor expanded in x around 0 28.2%
Taylor expanded in x around inf 4.4%
herbie shell --seed 2024139
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))