
(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 13 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 (- (pow (+ x 1.0) (/ 1.0 n)) t_0)))
(if (<= t_1 -0.002)
(- 1.0 (exp (/ (log x) n)))
(if (<= t_1 0.0) (/ (log (/ (+ x 1.0) x)) n) (- (exp (/ x n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -0.002) {
tmp = 1.0 - exp((log(x) / n));
} else if (t_1 <= 0.0) {
tmp = log(((x + 1.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) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = ((x + 1.0d0) ** (1.0d0 / n)) - t_0
if (t_1 <= (-0.002d0)) then
tmp = 1.0d0 - exp((log(x) / n))
else if (t_1 <= 0.0d0) then
tmp = log(((x + 1.0d0) / 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 t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -0.002) {
tmp = 1.0 - Math.exp((Math.log(x) / n));
} else if (t_1 <= 0.0) {
tmp = Math.log(((x + 1.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)) t_1 = math.pow((x + 1.0), (1.0 / n)) - t_0 tmp = 0 if t_1 <= -0.002: tmp = 1.0 - math.exp((math.log(x) / n)) elif t_1 <= 0.0: tmp = math.log(((x + 1.0) / x)) / n 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(x + 1.0) ^ Float64(1.0 / n)) - t_0) tmp = 0.0 if (t_1 <= -0.002) tmp = Float64(1.0 - exp(Float64(log(x) / n))); elseif (t_1 <= 0.0) tmp = Float64(log(Float64(Float64(x + 1.0) / 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); t_1 = ((x + 1.0) ^ (1.0 / n)) - t_0; tmp = 0.0; if (t_1 <= -0.002) tmp = 1.0 - exp((log(x) / n)); elseif (t_1 <= 0.0) tmp = log(((x + 1.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]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -0.002], N[(1.0 - N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $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 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -0.002:\\
\;\;\;\;1 - e^{\frac{\log x}{n}}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x 1) (/.f64 1 n)) (pow.f64 x (/.f64 1 n))) < -2e-3Initial program 99.5%
Taylor expanded in x around 0 99.6%
if -2e-3 < (-.f64 (pow.f64 (+.f64 x 1) (/.f64 1 n)) (pow.f64 x (/.f64 1 n))) < 0.0Initial program 47.3%
Taylor expanded in n around inf 78.0%
log1p-def78.0%
Simplified78.0%
log1p-udef78.0%
diff-log78.1%
+-commutative78.1%
Applied egg-rr78.1%
if 0.0 < (-.f64 (pow.f64 (+.f64 x 1) (/.f64 1 n)) (pow.f64 x (/.f64 1 n))) Initial program 55.4%
Taylor expanded in n around 0 55.4%
log1p-def99.6%
Simplified99.6%
Taylor expanded in x around 0 99.6%
Final simplification85.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-133)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 5e-154)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e-24)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 5e+146)
(- (+ 1.0 (/ x n)) t_0)
(sqrt (pow (* x n) -2.0))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-133) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 5e-154) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-24) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 5e+146) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = sqrt(pow((x * n), -2.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2d-133)) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= 5d-154) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d-24) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 5d+146) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = sqrt(((x * n) ** (-2.0d0)))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-133) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 5e-154) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-24) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 5e+146) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.sqrt(Math.pow((x * n), -2.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-133: tmp = t_0 / (x * n) elif (1.0 / n) <= 5e-154: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e-24: tmp = (1.0 / x) / n elif (1.0 / n) <= 5e+146: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.sqrt(math.pow((x * n), -2.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-133) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 5e-154) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e-24) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 5e+146) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = sqrt((Float64(x * n) ^ -2.0)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2e-133) tmp = t_0 / (x * n); elseif ((1.0 / n) <= 5e-154) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e-24) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 5e+146) tmp = (1.0 + (x / n)) - t_0; else tmp = sqrt(((x * n) ^ -2.0)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-133], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-154], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-24], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+146], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Sqrt[N[Power[N[(x * n), $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-133}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-154}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-24}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+146}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{\left(x \cdot n\right)}^{-2}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2.0000000000000001e-133Initial program 77.8%
Taylor expanded in x around inf 86.7%
mul-1-neg86.7%
log-rec86.7%
mul-1-neg86.7%
distribute-neg-frac86.7%
mul-1-neg86.7%
remove-double-neg86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in x around 0 86.7%
*-rgt-identity86.7%
associate-*r/86.7%
exp-to-pow86.7%
*-commutative86.7%
Simplified86.7%
if -2.0000000000000001e-133 < (/.f64 1 n) < 5.0000000000000002e-154Initial program 42.0%
Taylor expanded in n around inf 89.5%
log1p-def89.5%
Simplified89.5%
log1p-udef89.5%
diff-log89.6%
+-commutative89.6%
Applied egg-rr89.6%
if 5.0000000000000002e-154 < (/.f64 1 n) < 4.9999999999999998e-24Initial program 19.6%
Taylor expanded in n around inf 51.7%
log1p-def51.7%
Simplified51.7%
Taylor expanded in x around inf 68.1%
if 4.9999999999999998e-24 < (/.f64 1 n) < 4.9999999999999999e146Initial program 82.8%
Taylor expanded in x around 0 83.0%
if 4.9999999999999999e146 < (/.f64 1 n) Initial program 24.3%
Taylor expanded in n around inf 6.6%
log1p-def6.6%
Simplified6.6%
Taylor expanded in x around inf 52.8%
*-commutative52.8%
Simplified52.8%
add-sqr-sqrt52.8%
sqrt-unprod78.1%
inv-pow78.1%
inv-pow78.1%
pow-prod-up78.1%
metadata-eval78.1%
Applied egg-rr78.1%
Final simplification84.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= (/ 1.0 n) -5e+176)
t_0
(if (<= (/ 1.0 n) -1e+32)
t_1
(if (<= (/ 1.0 n) -1e-5)
t_0
(if (<= (/ 1.0 n) 5e-154)
t_1
(if (<= (/ 1.0 n) 5e-24)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e+228) t_0 (/ 1.0 (* x n))))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double t_1 = log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e+176) {
tmp = t_0;
} else if ((1.0 / n) <= -1e+32) {
tmp = t_1;
} else if ((1.0 / n) <= -1e-5) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-154) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-24) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e+228) {
tmp = t_0;
} else {
tmp = 1.0 / (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 = 1.0d0 - (x ** (1.0d0 / n))
t_1 = log(((x + 1.0d0) / x)) / n
if ((1.0d0 / n) <= (-5d+176)) then
tmp = t_0
else if ((1.0d0 / n) <= (-1d+32)) then
tmp = t_1
else if ((1.0d0 / n) <= (-1d-5)) then
tmp = t_0
else if ((1.0d0 / n) <= 5d-154) then
tmp = t_1
else if ((1.0d0 / n) <= 5d-24) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 2d+228) then
tmp = t_0
else
tmp = 1.0d0 / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double t_1 = Math.log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e+176) {
tmp = t_0;
} else if ((1.0 / n) <= -1e+32) {
tmp = t_1;
} else if ((1.0 / n) <= -1e-5) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-154) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-24) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e+228) {
tmp = t_0;
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) t_1 = math.log(((x + 1.0) / x)) / n tmp = 0 if (1.0 / n) <= -5e+176: tmp = t_0 elif (1.0 / n) <= -1e+32: tmp = t_1 elif (1.0 / n) <= -1e-5: tmp = t_0 elif (1.0 / n) <= 5e-154: tmp = t_1 elif (1.0 / n) <= 5e-24: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e+228: tmp = t_0 else: tmp = 1.0 / (x * n) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_1 = Float64(log(Float64(Float64(x + 1.0) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e+176) tmp = t_0; elseif (Float64(1.0 / n) <= -1e+32) tmp = t_1; elseif (Float64(1.0 / n) <= -1e-5) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-154) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-24) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e+228) tmp = t_0; else tmp = Float64(1.0 / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); t_1 = log(((x + 1.0) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -5e+176) tmp = t_0; elseif ((1.0 / n) <= -1e+32) tmp = t_1; elseif ((1.0 / n) <= -1e-5) tmp = t_0; elseif ((1.0 / n) <= 5e-154) tmp = t_1; elseif ((1.0 / n) <= 5e-24) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 2e+228) tmp = t_0; else tmp = 1.0 / (x * n); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+176], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+32], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-5], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-154], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-24], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+228], t$95$0, N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{+176}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-154}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-24}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+228}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5e176 or -1.00000000000000005e32 < (/.f64 1 n) < -1.00000000000000008e-5 or 4.9999999999999998e-24 < (/.f64 1 n) < 1.9999999999999998e228Initial program 84.7%
Taylor expanded in x around 0 66.3%
if -5e176 < (/.f64 1 n) < -1.00000000000000005e32 or -1.00000000000000008e-5 < (/.f64 1 n) < 5.0000000000000002e-154Initial program 51.9%
Taylor expanded in n around inf 77.2%
log1p-def77.2%
Simplified77.2%
log1p-udef77.2%
diff-log77.3%
+-commutative77.3%
Applied egg-rr77.3%
if 5.0000000000000002e-154 < (/.f64 1 n) < 4.9999999999999998e-24Initial program 19.6%
Taylor expanded in n around inf 51.7%
log1p-def51.7%
Simplified51.7%
Taylor expanded in x around inf 68.1%
if 1.9999999999999998e228 < (/.f64 1 n) Initial program 12.8%
Taylor expanded in n around inf 8.3%
log1p-def8.3%
Simplified8.3%
Taylor expanded in x around inf 90.6%
*-commutative90.6%
Simplified90.6%
Final simplification73.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-133)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 5e-154)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e-24)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e+228)
(- (+ 1.0 (/ x n)) t_0)
(/ 1.0 (* x n))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-133) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 5e-154) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-24) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e+228) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (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) <= (-2d-133)) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= 5d-154) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d-24) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 2d+228) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 1.0d0 / (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) <= -2e-133) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 5e-154) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-24) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e+228) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-133: tmp = t_0 / (x * n) elif (1.0 / n) <= 5e-154: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e-24: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e+228: tmp = (1.0 + (x / n)) - t_0 else: tmp = 1.0 / (x * n) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-133) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 5e-154) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e-24) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e+228) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(1.0 / Float64(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) <= -2e-133) tmp = t_0 / (x * n); elseif ((1.0 / n) <= 5e-154) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e-24) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 2e+228) tmp = (1.0 + (x / n)) - t_0; else tmp = 1.0 / (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], -2e-133], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-154], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-24], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+228], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-133}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-154}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-24}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+228}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2.0000000000000001e-133Initial program 77.8%
Taylor expanded in x around inf 86.7%
mul-1-neg86.7%
log-rec86.7%
mul-1-neg86.7%
distribute-neg-frac86.7%
mul-1-neg86.7%
remove-double-neg86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in x around 0 86.7%
*-rgt-identity86.7%
associate-*r/86.7%
exp-to-pow86.7%
*-commutative86.7%
Simplified86.7%
if -2.0000000000000001e-133 < (/.f64 1 n) < 5.0000000000000002e-154Initial program 42.0%
Taylor expanded in n around inf 89.5%
log1p-def89.5%
Simplified89.5%
log1p-udef89.5%
diff-log89.6%
+-commutative89.6%
Applied egg-rr89.6%
if 5.0000000000000002e-154 < (/.f64 1 n) < 4.9999999999999998e-24Initial program 19.6%
Taylor expanded in n around inf 51.7%
log1p-def51.7%
Simplified51.7%
Taylor expanded in x around inf 68.1%
if 4.9999999999999998e-24 < (/.f64 1 n) < 1.9999999999999998e228Initial program 66.0%
Taylor expanded in x around 0 66.5%
if 1.9999999999999998e228 < (/.f64 1 n) Initial program 12.8%
Taylor expanded in n around inf 8.3%
log1p-def8.3%
Simplified8.3%
Taylor expanded in x around inf 90.6%
*-commutative90.6%
Simplified90.6%
Final simplification82.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-133)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 5e-154)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e-24)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e+228) (- 1.0 t_0) (/ 1.0 (* x n))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-133) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 5e-154) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-24) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e+228) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (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) <= (-2d-133)) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= 5d-154) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d-24) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 2d+228) then
tmp = 1.0d0 - t_0
else
tmp = 1.0d0 / (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) <= -2e-133) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 5e-154) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-24) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e+228) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-133: tmp = t_0 / (x * n) elif (1.0 / n) <= 5e-154: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e-24: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e+228: tmp = 1.0 - t_0 else: tmp = 1.0 / (x * n) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-133) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 5e-154) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e-24) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e+228) tmp = Float64(1.0 - t_0); else tmp = Float64(1.0 / Float64(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) <= -2e-133) tmp = t_0 / (x * n); elseif ((1.0 / n) <= 5e-154) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e-24) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 2e+228) tmp = 1.0 - t_0; else tmp = 1.0 / (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], -2e-133], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-154], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-24], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+228], N[(1.0 - t$95$0), $MachinePrecision], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-133}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-154}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-24}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+228}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2.0000000000000001e-133Initial program 77.8%
Taylor expanded in x around inf 86.7%
mul-1-neg86.7%
log-rec86.7%
mul-1-neg86.7%
distribute-neg-frac86.7%
mul-1-neg86.7%
remove-double-neg86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in x around 0 86.7%
*-rgt-identity86.7%
associate-*r/86.7%
exp-to-pow86.7%
*-commutative86.7%
Simplified86.7%
if -2.0000000000000001e-133 < (/.f64 1 n) < 5.0000000000000002e-154Initial program 42.0%
Taylor expanded in n around inf 89.5%
log1p-def89.5%
Simplified89.5%
log1p-udef89.5%
diff-log89.6%
+-commutative89.6%
Applied egg-rr89.6%
if 5.0000000000000002e-154 < (/.f64 1 n) < 4.9999999999999998e-24Initial program 19.6%
Taylor expanded in n around inf 51.7%
log1p-def51.7%
Simplified51.7%
Taylor expanded in x around inf 68.1%
if 4.9999999999999998e-24 < (/.f64 1 n) < 1.9999999999999998e228Initial program 66.0%
Taylor expanded in x around 0 63.2%
if 1.9999999999999998e228 < (/.f64 1 n) Initial program 12.8%
Taylor expanded in n around inf 8.3%
log1p-def8.3%
Simplified8.3%
Taylor expanded in x around inf 90.6%
*-commutative90.6%
Simplified90.6%
Final simplification82.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x 4.1e-148)
t_0
(if (<= x 6.9e-47)
(/ (- (log x)) n)
(if (<= x 4.25e-16)
t_0
(if (<= x 7.5e-5)
(/ (- x (log x)) n)
(if (<= x 5.2e+160)
(/ (/ 1.0 x) n)
(/ -0.5 (* n (pow x 2.0))))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= 4.1e-148) {
tmp = t_0;
} else if (x <= 6.9e-47) {
tmp = -log(x) / n;
} else if (x <= 4.25e-16) {
tmp = t_0;
} else if (x <= 7.5e-5) {
tmp = (x - log(x)) / n;
} else if (x <= 5.2e+160) {
tmp = (1.0 / x) / n;
} else {
tmp = -0.5 / (n * pow(x, 2.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= 4.1d-148) then
tmp = t_0
else if (x <= 6.9d-47) then
tmp = -log(x) / n
else if (x <= 4.25d-16) then
tmp = t_0
else if (x <= 7.5d-5) then
tmp = (x - log(x)) / n
else if (x <= 5.2d+160) then
tmp = (1.0d0 / x) / n
else
tmp = (-0.5d0) / (n * (x ** 2.0d0))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if (x <= 4.1e-148) {
tmp = t_0;
} else if (x <= 6.9e-47) {
tmp = -Math.log(x) / n;
} else if (x <= 4.25e-16) {
tmp = t_0;
} else if (x <= 7.5e-5) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 5.2e+160) {
tmp = (1.0 / x) / n;
} else {
tmp = -0.5 / (n * Math.pow(x, 2.0));
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if x <= 4.1e-148: tmp = t_0 elif x <= 6.9e-47: tmp = -math.log(x) / n elif x <= 4.25e-16: tmp = t_0 elif x <= 7.5e-5: tmp = (x - math.log(x)) / n elif x <= 5.2e+160: tmp = (1.0 / x) / n else: tmp = -0.5 / (n * math.pow(x, 2.0)) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (x <= 4.1e-148) tmp = t_0; elseif (x <= 6.9e-47) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 4.25e-16) tmp = t_0; elseif (x <= 7.5e-5) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 5.2e+160) tmp = Float64(Float64(1.0 / x) / n); else tmp = Float64(-0.5 / Float64(n * (x ^ 2.0))); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= 4.1e-148) tmp = t_0; elseif (x <= 6.9e-47) tmp = -log(x) / n; elseif (x <= 4.25e-16) tmp = t_0; elseif (x <= 7.5e-5) tmp = (x - log(x)) / n; elseif (x <= 5.2e+160) tmp = (1.0 / x) / n; else tmp = -0.5 / (n * (x ^ 2.0)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 4.1e-148], t$95$0, If[LessEqual[x, 6.9e-47], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 4.25e-16], t$95$0, If[LessEqual[x, 7.5e-5], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 5.2e+160], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], N[(-0.5 / N[(n * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 4.1 \cdot 10^{-148}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6.9 \cdot 10^{-47}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 4.25 \cdot 10^{-16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{n \cdot {x}^{2}}\\
\end{array}
\end{array}
if x < 4.1000000000000002e-148 or 6.89999999999999994e-47 < x < 4.25e-16Initial program 58.3%
Taylor expanded in x around 0 58.3%
if 4.1000000000000002e-148 < x < 6.89999999999999994e-47Initial program 31.8%
Taylor expanded in x around 0 31.8%
Taylor expanded in n around inf 51.9%
neg-mul-151.9%
distribute-neg-frac51.9%
Simplified51.9%
if 4.25e-16 < x < 7.49999999999999934e-5Initial program 29.2%
Taylor expanded in n around inf 75.8%
log1p-def75.8%
Simplified75.8%
Taylor expanded in x around 0 74.5%
neg-mul-174.5%
unsub-neg74.5%
Simplified74.5%
if 7.49999999999999934e-5 < x < 5.2000000000000001e160Initial program 47.7%
Taylor expanded in n around inf 43.3%
log1p-def43.3%
Simplified43.3%
Taylor expanded in x around inf 60.5%
if 5.2000000000000001e160 < x Initial program 88.4%
Taylor expanded in n around inf 88.4%
log1p-def88.4%
Simplified88.4%
Taylor expanded in x around inf 65.8%
associate-*r/65.8%
metadata-eval65.8%
Simplified65.8%
Taylor expanded in x around 0 88.4%
Final simplification64.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x 4.2e-148)
t_0
(if (<= x 3.8e-47)
(/ (- (log x)) n)
(if (<= x 2.05e-17)
t_0
(if (<= x 7.5e-5)
(- (/ x n) (/ (log x) n))
(if (<= x 5.1e+160)
(/ (/ 1.0 x) n)
(/ -0.5 (* n (pow x 2.0))))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= 4.2e-148) {
tmp = t_0;
} else if (x <= 3.8e-47) {
tmp = -log(x) / n;
} else if (x <= 2.05e-17) {
tmp = t_0;
} else if (x <= 7.5e-5) {
tmp = (x / n) - (log(x) / n);
} else if (x <= 5.1e+160) {
tmp = (1.0 / x) / n;
} else {
tmp = -0.5 / (n * pow(x, 2.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= 4.2d-148) then
tmp = t_0
else if (x <= 3.8d-47) then
tmp = -log(x) / n
else if (x <= 2.05d-17) then
tmp = t_0
else if (x <= 7.5d-5) then
tmp = (x / n) - (log(x) / n)
else if (x <= 5.1d+160) then
tmp = (1.0d0 / x) / n
else
tmp = (-0.5d0) / (n * (x ** 2.0d0))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if (x <= 4.2e-148) {
tmp = t_0;
} else if (x <= 3.8e-47) {
tmp = -Math.log(x) / n;
} else if (x <= 2.05e-17) {
tmp = t_0;
} else if (x <= 7.5e-5) {
tmp = (x / n) - (Math.log(x) / n);
} else if (x <= 5.1e+160) {
tmp = (1.0 / x) / n;
} else {
tmp = -0.5 / (n * Math.pow(x, 2.0));
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if x <= 4.2e-148: tmp = t_0 elif x <= 3.8e-47: tmp = -math.log(x) / n elif x <= 2.05e-17: tmp = t_0 elif x <= 7.5e-5: tmp = (x / n) - (math.log(x) / n) elif x <= 5.1e+160: tmp = (1.0 / x) / n else: tmp = -0.5 / (n * math.pow(x, 2.0)) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (x <= 4.2e-148) tmp = t_0; elseif (x <= 3.8e-47) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 2.05e-17) tmp = t_0; elseif (x <= 7.5e-5) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); elseif (x <= 5.1e+160) tmp = Float64(Float64(1.0 / x) / n); else tmp = Float64(-0.5 / Float64(n * (x ^ 2.0))); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= 4.2e-148) tmp = t_0; elseif (x <= 3.8e-47) tmp = -log(x) / n; elseif (x <= 2.05e-17) tmp = t_0; elseif (x <= 7.5e-5) tmp = (x / n) - (log(x) / n); elseif (x <= 5.1e+160) tmp = (1.0 / x) / n; else tmp = -0.5 / (n * (x ^ 2.0)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 4.2e-148], t$95$0, If[LessEqual[x, 3.8e-47], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 2.05e-17], t$95$0, If[LessEqual[x, 7.5e-5], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.1e+160], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], N[(-0.5 / N[(n * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 4.2 \cdot 10^{-148}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-47}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{-17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{n \cdot {x}^{2}}\\
\end{array}
\end{array}
if x < 4.2e-148 or 3.80000000000000015e-47 < x < 2.05e-17Initial program 58.3%
Taylor expanded in x around 0 58.3%
if 4.2e-148 < x < 3.80000000000000015e-47Initial program 31.8%
Taylor expanded in x around 0 31.8%
Taylor expanded in n around inf 51.9%
neg-mul-151.9%
distribute-neg-frac51.9%
Simplified51.9%
if 2.05e-17 < x < 7.49999999999999934e-5Initial program 29.2%
Taylor expanded in n around inf 75.8%
log1p-def75.8%
Simplified75.8%
Taylor expanded in x around 0 74.9%
neg-mul-174.9%
+-commutative74.9%
unsub-neg74.9%
Simplified74.9%
if 7.49999999999999934e-5 < x < 5.1000000000000001e160Initial program 47.7%
Taylor expanded in n around inf 43.3%
log1p-def43.3%
Simplified43.3%
Taylor expanded in x around inf 60.5%
if 5.1000000000000001e160 < x Initial program 88.4%
Taylor expanded in n around inf 88.4%
log1p-def88.4%
Simplified88.4%
Taylor expanded in x around inf 65.8%
associate-*r/65.8%
metadata-eval65.8%
Simplified65.8%
Taylor expanded in x around 0 88.4%
Final simplification64.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x 4.6e-148)
t_0
(if (<= x 1.3e-56)
(/ 1.0 (- 0.5 (/ n (log x))))
(if (<= x 2.35e-17)
t_0
(if (<= x 7.5e-5)
(- (/ x n) (/ (log x) n))
(if (<= x 5.1e+160)
(/ (/ 1.0 x) n)
(/ -0.5 (* n (pow x 2.0))))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= 4.6e-148) {
tmp = t_0;
} else if (x <= 1.3e-56) {
tmp = 1.0 / (0.5 - (n / log(x)));
} else if (x <= 2.35e-17) {
tmp = t_0;
} else if (x <= 7.5e-5) {
tmp = (x / n) - (log(x) / n);
} else if (x <= 5.1e+160) {
tmp = (1.0 / x) / n;
} else {
tmp = -0.5 / (n * pow(x, 2.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= 4.6d-148) then
tmp = t_0
else if (x <= 1.3d-56) then
tmp = 1.0d0 / (0.5d0 - (n / log(x)))
else if (x <= 2.35d-17) then
tmp = t_0
else if (x <= 7.5d-5) then
tmp = (x / n) - (log(x) / n)
else if (x <= 5.1d+160) then
tmp = (1.0d0 / x) / n
else
tmp = (-0.5d0) / (n * (x ** 2.0d0))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if (x <= 4.6e-148) {
tmp = t_0;
} else if (x <= 1.3e-56) {
tmp = 1.0 / (0.5 - (n / Math.log(x)));
} else if (x <= 2.35e-17) {
tmp = t_0;
} else if (x <= 7.5e-5) {
tmp = (x / n) - (Math.log(x) / n);
} else if (x <= 5.1e+160) {
tmp = (1.0 / x) / n;
} else {
tmp = -0.5 / (n * Math.pow(x, 2.0));
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if x <= 4.6e-148: tmp = t_0 elif x <= 1.3e-56: tmp = 1.0 / (0.5 - (n / math.log(x))) elif x <= 2.35e-17: tmp = t_0 elif x <= 7.5e-5: tmp = (x / n) - (math.log(x) / n) elif x <= 5.1e+160: tmp = (1.0 / x) / n else: tmp = -0.5 / (n * math.pow(x, 2.0)) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (x <= 4.6e-148) tmp = t_0; elseif (x <= 1.3e-56) tmp = Float64(1.0 / Float64(0.5 - Float64(n / log(x)))); elseif (x <= 2.35e-17) tmp = t_0; elseif (x <= 7.5e-5) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); elseif (x <= 5.1e+160) tmp = Float64(Float64(1.0 / x) / n); else tmp = Float64(-0.5 / Float64(n * (x ^ 2.0))); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= 4.6e-148) tmp = t_0; elseif (x <= 1.3e-56) tmp = 1.0 / (0.5 - (n / log(x))); elseif (x <= 2.35e-17) tmp = t_0; elseif (x <= 7.5e-5) tmp = (x / n) - (log(x) / n); elseif (x <= 5.1e+160) tmp = (1.0 / x) / n; else tmp = -0.5 / (n * (x ^ 2.0)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 4.6e-148], t$95$0, If[LessEqual[x, 1.3e-56], N[(1.0 / N[(0.5 - N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.35e-17], t$95$0, If[LessEqual[x, 7.5e-5], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.1e+160], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], N[(-0.5 / N[(n * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 4.6 \cdot 10^{-148}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-56}:\\
\;\;\;\;\frac{1}{0.5 - \frac{n}{\log x}}\\
\mathbf{elif}\;x \leq 2.35 \cdot 10^{-17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{n \cdot {x}^{2}}\\
\end{array}
\end{array}
if x < 4.59999999999999995e-148 or 1.29999999999999998e-56 < x < 2.35e-17Initial program 57.4%
Taylor expanded in x around 0 57.4%
if 4.59999999999999995e-148 < x < 1.29999999999999998e-56Initial program 30.7%
Taylor expanded in x around 0 30.7%
add-log-exp28.8%
Applied egg-rr28.8%
Applied egg-rr30.7%
Taylor expanded in n around inf 53.5%
mul-1-neg53.5%
unsub-neg53.5%
Simplified53.5%
if 2.35e-17 < x < 7.49999999999999934e-5Initial program 29.2%
Taylor expanded in n around inf 75.8%
log1p-def75.8%
Simplified75.8%
Taylor expanded in x around 0 74.9%
neg-mul-174.9%
+-commutative74.9%
unsub-neg74.9%
Simplified74.9%
if 7.49999999999999934e-5 < x < 5.1000000000000001e160Initial program 47.7%
Taylor expanded in n around inf 43.3%
log1p-def43.3%
Simplified43.3%
Taylor expanded in x around inf 60.5%
if 5.1000000000000001e160 < x Initial program 88.4%
Taylor expanded in n around inf 88.4%
log1p-def88.4%
Simplified88.4%
Taylor expanded in x around inf 65.8%
associate-*r/65.8%
metadata-eval65.8%
Simplified65.8%
Taylor expanded in x around 0 88.4%
Final simplification64.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x 4.1e-148)
t_0
(if (<= x 4.2e-47)
(/ (- (log x)) n)
(if (<= x 1.16e-16)
t_0
(if (<= x 7.5e-5) (/ (- x (log x)) n) (/ (/ 1.0 x) n)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= 4.1e-148) {
tmp = t_0;
} else if (x <= 4.2e-47) {
tmp = -log(x) / n;
} else if (x <= 1.16e-16) {
tmp = t_0;
} else if (x <= 7.5e-5) {
tmp = (x - log(x)) / n;
} else {
tmp = (1.0 / 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 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= 4.1d-148) then
tmp = t_0
else if (x <= 4.2d-47) then
tmp = -log(x) / n
else if (x <= 1.16d-16) then
tmp = t_0
else if (x <= 7.5d-5) then
tmp = (x - log(x)) / n
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if (x <= 4.1e-148) {
tmp = t_0;
} else if (x <= 4.2e-47) {
tmp = -Math.log(x) / n;
} else if (x <= 1.16e-16) {
tmp = t_0;
} else if (x <= 7.5e-5) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if x <= 4.1e-148: tmp = t_0 elif x <= 4.2e-47: tmp = -math.log(x) / n elif x <= 1.16e-16: tmp = t_0 elif x <= 7.5e-5: tmp = (x - math.log(x)) / n else: tmp = (1.0 / x) / n return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (x <= 4.1e-148) tmp = t_0; elseif (x <= 4.2e-47) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.16e-16) tmp = t_0; elseif (x <= 7.5e-5) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= 4.1e-148) tmp = t_0; elseif (x <= 4.2e-47) tmp = -log(x) / n; elseif (x <= 1.16e-16) tmp = t_0; elseif (x <= 7.5e-5) tmp = (x - log(x)) / n; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 4.1e-148], t$95$0, If[LessEqual[x, 4.2e-47], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.16e-16], t$95$0, If[LessEqual[x, 7.5e-5], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 4.1 \cdot 10^{-148}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-47}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.16 \cdot 10^{-16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 4.1000000000000002e-148 or 4.2000000000000001e-47 < x < 1.1600000000000001e-16Initial program 58.3%
Taylor expanded in x around 0 58.3%
if 4.1000000000000002e-148 < x < 4.2000000000000001e-47Initial program 31.8%
Taylor expanded in x around 0 31.8%
Taylor expanded in n around inf 51.9%
neg-mul-151.9%
distribute-neg-frac51.9%
Simplified51.9%
if 1.1600000000000001e-16 < x < 7.49999999999999934e-5Initial program 29.2%
Taylor expanded in n around inf 75.8%
log1p-def75.8%
Simplified75.8%
Taylor expanded in x around 0 74.5%
neg-mul-174.5%
unsub-neg74.5%
Simplified74.5%
if 7.49999999999999934e-5 < x Initial program 68.4%
Taylor expanded in n around inf 66.3%
log1p-def66.3%
Simplified66.3%
Taylor expanded in x around inf 63.2%
Final simplification59.4%
(FPCore (x n)
:precision binary64
(if (<= x 3.1e-214)
(/ (- (log x)) n)
(if (<= x 4.1e-148)
(/ 1.0 (* x n))
(if (<= x 7.5e-5) (/ (- x (log x)) n) (/ (/ 1.0 x) n)))))
double code(double x, double n) {
double tmp;
if (x <= 3.1e-214) {
tmp = -log(x) / n;
} else if (x <= 4.1e-148) {
tmp = 1.0 / (x * n);
} else if (x <= 7.5e-5) {
tmp = (x - log(x)) / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 3.1d-214) then
tmp = -log(x) / n
else if (x <= 4.1d-148) then
tmp = 1.0d0 / (x * n)
else if (x <= 7.5d-5) then
tmp = (x - log(x)) / n
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 3.1e-214) {
tmp = -Math.log(x) / n;
} else if (x <= 4.1e-148) {
tmp = 1.0 / (x * n);
} else if (x <= 7.5e-5) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 3.1e-214: tmp = -math.log(x) / n elif x <= 4.1e-148: tmp = 1.0 / (x * n) elif x <= 7.5e-5: tmp = (x - math.log(x)) / n else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 3.1e-214) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 4.1e-148) tmp = Float64(1.0 / Float64(x * n)); elseif (x <= 7.5e-5) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 3.1e-214) tmp = -log(x) / n; elseif (x <= 4.1e-148) tmp = 1.0 / (x * n); elseif (x <= 7.5e-5) tmp = (x - log(x)) / n; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 3.1e-214], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 4.1e-148], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e-5], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.1 \cdot 10^{-214}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-148}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 3.10000000000000004e-214Initial program 51.1%
Taylor expanded in x around 0 51.1%
Taylor expanded in n around inf 56.7%
neg-mul-156.7%
distribute-neg-frac56.7%
Simplified56.7%
if 3.10000000000000004e-214 < x < 4.1000000000000002e-148Initial program 65.7%
Taylor expanded in n around inf 31.7%
log1p-def31.7%
Simplified31.7%
Taylor expanded in x around inf 49.1%
*-commutative49.1%
Simplified49.1%
if 4.1000000000000002e-148 < x < 7.49999999999999934e-5Initial program 37.4%
Taylor expanded in n around inf 48.6%
log1p-def48.6%
Simplified48.6%
Taylor expanded in x around 0 48.5%
neg-mul-148.5%
unsub-neg48.5%
Simplified48.5%
if 7.49999999999999934e-5 < x Initial program 68.4%
Taylor expanded in n around inf 66.3%
log1p-def66.3%
Simplified66.3%
Taylor expanded in x around inf 63.2%
Final simplification56.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log x)) n)))
(if (<= x 3.1e-214)
t_0
(if (<= x 4.1e-148)
(/ 1.0 (* x n))
(if (<= x 7.5e-5) t_0 (/ (/ 1.0 x) n))))))
double code(double x, double n) {
double t_0 = -log(x) / n;
double tmp;
if (x <= 3.1e-214) {
tmp = t_0;
} else if (x <= 4.1e-148) {
tmp = 1.0 / (x * n);
} else if (x <= 7.5e-5) {
tmp = t_0;
} else {
tmp = (1.0 / 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 <= 3.1d-214) then
tmp = t_0
else if (x <= 4.1d-148) then
tmp = 1.0d0 / (x * n)
else if (x <= 7.5d-5) then
tmp = t_0
else
tmp = (1.0d0 / 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 <= 3.1e-214) {
tmp = t_0;
} else if (x <= 4.1e-148) {
tmp = 1.0 / (x * n);
} else if (x <= 7.5e-5) {
tmp = t_0;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): t_0 = -math.log(x) / n tmp = 0 if x <= 3.1e-214: tmp = t_0 elif x <= 4.1e-148: tmp = 1.0 / (x * n) elif x <= 7.5e-5: tmp = t_0 else: tmp = (1.0 / x) / n return tmp
function code(x, n) t_0 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 3.1e-214) tmp = t_0; elseif (x <= 4.1e-148) tmp = Float64(1.0 / Float64(x * n)); elseif (x <= 7.5e-5) tmp = t_0; else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = -log(x) / n; tmp = 0.0; if (x <= 3.1e-214) tmp = t_0; elseif (x <= 4.1e-148) tmp = 1.0 / (x * n); elseif (x <= 7.5e-5) tmp = t_0; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 3.1e-214], t$95$0, If[LessEqual[x, 4.1e-148], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e-5], t$95$0, N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 3.1 \cdot 10^{-214}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-148}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 3.10000000000000004e-214 or 4.1000000000000002e-148 < x < 7.49999999999999934e-5Initial program 42.3%
Taylor expanded in x around 0 42.3%
Taylor expanded in n around inf 51.1%
neg-mul-151.1%
distribute-neg-frac51.1%
Simplified51.1%
if 3.10000000000000004e-214 < x < 4.1000000000000002e-148Initial program 65.7%
Taylor expanded in n around inf 31.7%
log1p-def31.7%
Simplified31.7%
Taylor expanded in x around inf 49.1%
*-commutative49.1%
Simplified49.1%
if 7.49999999999999934e-5 < x Initial program 68.4%
Taylor expanded in n around inf 66.3%
log1p-def66.3%
Simplified66.3%
Taylor expanded in x around inf 63.2%
Final simplification56.3%
(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 56.8%
Taylor expanded in n around inf 55.8%
log1p-def55.8%
Simplified55.8%
Taylor expanded in x around inf 41.0%
*-commutative41.0%
Simplified41.0%
Final simplification41.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(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 56.8%
Taylor expanded in n around inf 55.8%
log1p-def55.8%
Simplified55.8%
Taylor expanded in x around inf 41.9%
Final simplification41.9%
herbie shell --seed 2024027
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))