
(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))))
(if (<= (/ 1.0 n) -2e-92)
(/ (/ t_0 x) n)
(if (<= (/ 1.0 n) 2e-14)
(/
(+
(log1p x)
(- (* 0.5 (/ (- (pow (log1p x) 2.0) (pow (log x) 2.0)) n)) (log x)))
n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-92) {
tmp = (t_0 / x) / n;
} else if ((1.0 / n) <= 2e-14) {
tmp = (log1p(x) + ((0.5 * ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) / n)) - log(x))) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-92) {
tmp = (t_0 / x) / n;
} else if ((1.0 / n) <= 2e-14) {
tmp = (Math.log1p(x) + ((0.5 * ((Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)) / n)) - Math.log(x))) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-92: tmp = (t_0 / x) / n elif (1.0 / n) <= 2e-14: tmp = (math.log1p(x) + ((0.5 * ((math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0)) / n)) - math.log(x))) / n else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-92) tmp = Float64(Float64(t_0 / x) / n); elseif (Float64(1.0 / n) <= 2e-14) tmp = Float64(Float64(log1p(x) + Float64(Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) / n)) - log(x))) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-92], N[(N[(t$95$0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-14], N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-92}:\\
\;\;\;\;\frac{\frac{t\_0}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-14}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999998e-92Initial program 84.7%
Taylor expanded in x around inf 69.1%
log-rec69.1%
mul-1-neg69.1%
neg-mul-169.1%
mul-1-neg69.1%
distribute-frac-neg69.1%
remove-double-neg69.1%
*-rgt-identity69.1%
associate-/l*69.1%
exp-to-pow92.4%
*-commutative92.4%
Simplified92.4%
*-un-lft-identity92.4%
associate-/r*92.5%
pow192.5%
pow-div92.3%
Applied egg-rr92.3%
*-lft-identity92.3%
sub-neg92.3%
metadata-eval92.3%
Simplified92.3%
unpow-prod-up92.5%
unpow-192.5%
div-inv92.5%
Applied egg-rr92.5%
if -1.99999999999999998e-92 < (/.f64 #s(literal 1 binary64) n) < 2e-14Initial program 29.8%
Taylor expanded in n around inf 79.6%
associate--l+79.6%
log1p-define79.6%
+-commutative79.6%
associate--r+79.6%
distribute-lft-out--79.6%
div-sub79.6%
log1p-define79.6%
Simplified79.6%
if 2e-14 < (/.f64 #s(literal 1 binary64) n) Initial program 42.8%
Taylor expanded in n around 0 24.9%
log1p-define51.6%
*-rgt-identity51.6%
associate-*l/51.6%
associate-/l*51.6%
exp-to-pow92.9%
Simplified92.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-92)
(/ (/ t_0 x) n)
(if (<= (/ 1.0 n) 2e-14)
(/ (- (log1p x) (log x)) n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-92) {
tmp = (t_0 / x) / n;
} else if ((1.0 / n) <= 2e-14) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-92) {
tmp = (t_0 / x) / n;
} else if ((1.0 / n) <= 2e-14) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-92: tmp = (t_0 / x) / n elif (1.0 / n) <= 2e-14: tmp = (math.log1p(x) - math.log(x)) / n else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-92) tmp = Float64(Float64(t_0 / x) / n); elseif (Float64(1.0 / n) <= 2e-14) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-92], N[(N[(t$95$0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-14], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-92}:\\
\;\;\;\;\frac{\frac{t\_0}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-14}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999998e-92Initial program 84.7%
Taylor expanded in x around inf 69.1%
log-rec69.1%
mul-1-neg69.1%
neg-mul-169.1%
mul-1-neg69.1%
distribute-frac-neg69.1%
remove-double-neg69.1%
*-rgt-identity69.1%
associate-/l*69.1%
exp-to-pow92.4%
*-commutative92.4%
Simplified92.4%
*-un-lft-identity92.4%
associate-/r*92.5%
pow192.5%
pow-div92.3%
Applied egg-rr92.3%
*-lft-identity92.3%
sub-neg92.3%
metadata-eval92.3%
Simplified92.3%
unpow-prod-up92.5%
unpow-192.5%
div-inv92.5%
Applied egg-rr92.5%
if -1.99999999999999998e-92 < (/.f64 #s(literal 1 binary64) n) < 2e-14Initial program 29.8%
Taylor expanded in n around inf 79.4%
log1p-define79.4%
Simplified79.4%
if 2e-14 < (/.f64 #s(literal 1 binary64) n) Initial program 42.8%
Taylor expanded in n around 0 24.9%
log1p-define51.6%
*-rgt-identity51.6%
associate-*l/51.6%
associate-/l*51.6%
exp-to-pow92.9%
Simplified92.9%
(FPCore (x n)
:precision binary64
(if (<= x -3.6e-131)
0.0
(if (<= x 6e-290)
(- 1.0 (pow x (* (/ 3.0 n) 0.3333333333333333)))
(if (<= x 6e-190)
(/ (log x) (- n))
(if (<= x 3.6e-88)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x)) x)
(if (<= x 1.0)
(log1p (expm1 (/ x n)))
(/ (/ (pow x (/ 1.0 n)) x) n)))))))
double code(double x, double n) {
double tmp;
if (x <= -3.6e-131) {
tmp = 0.0;
} else if (x <= 6e-290) {
tmp = 1.0 - pow(x, ((3.0 / n) * 0.3333333333333333));
} else if (x <= 6e-190) {
tmp = log(x) / -n;
} else if (x <= 3.6e-88) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else if (x <= 1.0) {
tmp = log1p(expm1((x / n)));
} else {
tmp = (pow(x, (1.0 / n)) / x) / n;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (x <= -3.6e-131) {
tmp = 0.0;
} else if (x <= 6e-290) {
tmp = 1.0 - Math.pow(x, ((3.0 / n) * 0.3333333333333333));
} else if (x <= 6e-190) {
tmp = Math.log(x) / -n;
} else if (x <= 3.6e-88) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else if (x <= 1.0) {
tmp = Math.log1p(Math.expm1((x / n)));
} else {
tmp = (Math.pow(x, (1.0 / n)) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= -3.6e-131: tmp = 0.0 elif x <= 6e-290: tmp = 1.0 - math.pow(x, ((3.0 / n) * 0.3333333333333333)) elif x <= 6e-190: tmp = math.log(x) / -n elif x <= 3.6e-88: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x elif x <= 1.0: tmp = math.log1p(math.expm1((x / n))) else: tmp = (math.pow(x, (1.0 / n)) / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= -3.6e-131) tmp = 0.0; elseif (x <= 6e-290) tmp = Float64(1.0 - (x ^ Float64(Float64(3.0 / n) * 0.3333333333333333))); elseif (x <= 6e-190) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 3.6e-88) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x); elseif (x <= 1.0) tmp = log1p(expm1(Float64(x / n))); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / x) / n); end return tmp end
code[x_, n_] := If[LessEqual[x, -3.6e-131], 0.0, If[LessEqual[x, 6e-290], N[(1.0 - N[Power[x, N[(N[(3.0 / n), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6e-190], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 3.6e-88], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 1.0], N[Log[1 + N[(Exp[N[(x / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-131}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-290}:\\
\;\;\;\;1 - {x}^{\left(\frac{3}{n} \cdot 0.3333333333333333\right)}\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-190}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-88}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{x}}{n}\\
\end{array}
\end{array}
if x < -3.5999999999999999e-131Initial program 63.4%
Taylor expanded in x around inf 0.0%
log-rec0.0%
mul-1-neg0.0%
neg-mul-10.0%
mul-1-neg0.0%
distribute-frac-neg0.0%
remove-double-neg0.0%
*-rgt-identity0.0%
associate-/l*0.0%
exp-to-pow92.5%
Simplified92.5%
Taylor expanded in x around 0 100.0%
if -3.5999999999999999e-131 < x < 5.99999999999999985e-290Initial program 63.6%
Taylor expanded in x around 0 16.0%
*-rgt-identity16.0%
associate-*l/16.0%
associate-/l*16.0%
exp-to-pow63.6%
Simplified63.6%
add-cbrt-cube63.6%
pow363.6%
pow-pow74.2%
Applied egg-rr74.2%
associate-*l/74.2%
metadata-eval74.2%
Simplified74.2%
pow1/374.2%
pow-pow68.9%
Applied egg-rr68.9%
if 5.99999999999999985e-290 < x < 5.9999999999999996e-190Initial program 30.7%
Taylor expanded in x around 0 30.7%
*-rgt-identity30.7%
associate-*l/30.7%
associate-/l*30.7%
exp-to-pow30.7%
Simplified30.7%
Taylor expanded in n around inf 71.6%
associate-*r/71.6%
mul-1-neg71.6%
Simplified71.6%
if 5.9999999999999996e-190 < x < 3.5999999999999999e-88Initial program 54.7%
Taylor expanded in n around inf 34.1%
log1p-define34.1%
Simplified34.1%
Taylor expanded in x around -inf 60.1%
mul-1-neg60.1%
mul-1-neg60.1%
associate-*r/60.1%
metadata-eval60.1%
*-commutative60.1%
associate-*r/60.1%
metadata-eval60.1%
Simplified60.1%
if 3.5999999999999999e-88 < x < 1Initial program 37.4%
Taylor expanded in x around inf 26.1%
log-rec26.1%
mul-1-neg26.1%
neg-mul-126.1%
mul-1-neg26.1%
distribute-frac-neg26.1%
remove-double-neg26.1%
*-rgt-identity26.1%
associate-/l*26.1%
exp-to-pow26.1%
*-commutative26.1%
Simplified26.1%
Taylor expanded in n around inf 11.9%
*-commutative11.9%
Simplified11.9%
associate-/r*11.9%
div-inv11.9%
rem-exp-log11.9%
neg-log11.9%
add-sqr-sqrt11.9%
sqrt-unprod11.9%
sqr-neg11.9%
sqrt-unprod0.0%
add-sqr-sqrt6.3%
add-exp-log6.3%
log1p-expm1-u54.0%
un-div-inv54.0%
Applied egg-rr54.0%
if 1 < x Initial program 66.7%
Taylor expanded in x around inf 97.4%
log-rec97.4%
mul-1-neg97.4%
neg-mul-197.4%
mul-1-neg97.4%
distribute-frac-neg97.4%
remove-double-neg97.4%
*-rgt-identity97.4%
associate-/l*97.4%
exp-to-pow97.4%
*-commutative97.4%
Simplified97.4%
*-un-lft-identity97.4%
associate-/r*99.2%
pow199.2%
pow-div99.0%
Applied egg-rr99.0%
*-lft-identity99.0%
sub-neg99.0%
metadata-eval99.0%
Simplified99.0%
unpow-prod-up99.2%
unpow-199.2%
div-inv99.2%
Applied egg-rr99.2%
Final simplification80.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-92)
(/ (/ t_0 x) n)
(if (<= (/ 1.0 n) 2e-14)
(/ (- (log1p x) (log x)) n)
(-
(+ 1.0 (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))))
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-92) {
tmp = (t_0 / x) / n;
} else if ((1.0 / n) <= 2e-14) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-92) {
tmp = (t_0 / x) / n;
} else if ((1.0 / n) <= 2e-14) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-92: tmp = (t_0 / x) / n elif (1.0 / n) <= 2e-14: tmp = (math.log1p(x) - math.log(x)) / n else: tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-92) tmp = Float64(Float64(t_0 / x) / n); elseif (Float64(1.0 / n) <= 2e-14) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n)))) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-92], N[(N[(t$95$0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-14], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-92}:\\
\;\;\;\;\frac{\frac{t\_0}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-14}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999998e-92Initial program 84.7%
Taylor expanded in x around inf 69.1%
log-rec69.1%
mul-1-neg69.1%
neg-mul-169.1%
mul-1-neg69.1%
distribute-frac-neg69.1%
remove-double-neg69.1%
*-rgt-identity69.1%
associate-/l*69.1%
exp-to-pow92.4%
*-commutative92.4%
Simplified92.4%
*-un-lft-identity92.4%
associate-/r*92.5%
pow192.5%
pow-div92.3%
Applied egg-rr92.3%
*-lft-identity92.3%
sub-neg92.3%
metadata-eval92.3%
Simplified92.3%
unpow-prod-up92.5%
unpow-192.5%
div-inv92.5%
Applied egg-rr92.5%
if -1.99999999999999998e-92 < (/.f64 #s(literal 1 binary64) n) < 2e-14Initial program 29.8%
Taylor expanded in n around inf 79.4%
log1p-define79.4%
Simplified79.4%
if 2e-14 < (/.f64 #s(literal 1 binary64) n) Initial program 42.8%
Taylor expanded in x around 0 52.8%
Taylor expanded in n around inf 53.6%
Final simplification78.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))))
(if (<= x -3.8e-131)
0.0
(if (<= x 6.4e-290)
(- 1.0 (pow x (* (/ 3.0 n) 0.3333333333333333)))
(if (<= x 2.5e-189)
t_0
(if (<= x 1.15e-87)
(/
(+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x))
x)
(if (<= x 5.8e-14) t_0 (/ (/ (pow x (/ 1.0 n)) x) n))))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double tmp;
if (x <= -3.8e-131) {
tmp = 0.0;
} else if (x <= 6.4e-290) {
tmp = 1.0 - pow(x, ((3.0 / n) * 0.3333333333333333));
} else if (x <= 2.5e-189) {
tmp = t_0;
} else if (x <= 1.15e-87) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else if (x <= 5.8e-14) {
tmp = t_0;
} else {
tmp = (pow(x, (1.0 / n)) / 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.8d-131)) then
tmp = 0.0d0
else if (x <= 6.4d-290) then
tmp = 1.0d0 - (x ** ((3.0d0 / n) * 0.3333333333333333d0))
else if (x <= 2.5d-189) then
tmp = t_0
else if (x <= 1.15d-87) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
else if (x <= 5.8d-14) then
tmp = t_0
else
tmp = ((x ** (1.0d0 / n)) / 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.8e-131) {
tmp = 0.0;
} else if (x <= 6.4e-290) {
tmp = 1.0 - Math.pow(x, ((3.0 / n) * 0.3333333333333333));
} else if (x <= 2.5e-189) {
tmp = t_0;
} else if (x <= 1.15e-87) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else if (x <= 5.8e-14) {
tmp = t_0;
} else {
tmp = (Math.pow(x, (1.0 / n)) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n tmp = 0 if x <= -3.8e-131: tmp = 0.0 elif x <= 6.4e-290: tmp = 1.0 - math.pow(x, ((3.0 / n) * 0.3333333333333333)) elif x <= 2.5e-189: tmp = t_0 elif x <= 1.15e-87: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x elif x <= 5.8e-14: tmp = t_0 else: tmp = (math.pow(x, (1.0 / n)) / x) / n return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) tmp = 0.0 if (x <= -3.8e-131) tmp = 0.0; elseif (x <= 6.4e-290) tmp = Float64(1.0 - (x ^ Float64(Float64(3.0 / n) * 0.3333333333333333))); elseif (x <= 2.5e-189) tmp = t_0; elseif (x <= 1.15e-87) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x); elseif (x <= 5.8e-14) tmp = t_0; else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; tmp = 0.0; if (x <= -3.8e-131) tmp = 0.0; elseif (x <= 6.4e-290) tmp = 1.0 - (x ^ ((3.0 / n) * 0.3333333333333333)); elseif (x <= 2.5e-189) tmp = t_0; elseif (x <= 1.15e-87) tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x; elseif (x <= 5.8e-14) tmp = t_0; else tmp = ((x ^ (1.0 / n)) / 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.8e-131], 0.0, If[LessEqual[x, 6.4e-290], N[(1.0 - N[Power[x, N[(N[(3.0 / n), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.5e-189], t$95$0, If[LessEqual[x, 1.15e-87], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 5.8e-14], t$95$0, N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq -3.8 \cdot 10^{-131}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 6.4 \cdot 10^{-290}:\\
\;\;\;\;1 - {x}^{\left(\frac{3}{n} \cdot 0.3333333333333333\right)}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-189}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-87}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-14}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{x}}{n}\\
\end{array}
\end{array}
if x < -3.79999999999999995e-131Initial program 63.4%
Taylor expanded in x around inf 0.0%
log-rec0.0%
mul-1-neg0.0%
neg-mul-10.0%
mul-1-neg0.0%
distribute-frac-neg0.0%
remove-double-neg0.0%
*-rgt-identity0.0%
associate-/l*0.0%
exp-to-pow92.5%
Simplified92.5%
Taylor expanded in x around 0 100.0%
if -3.79999999999999995e-131 < x < 6.39999999999999976e-290Initial program 63.6%
Taylor expanded in x around 0 16.0%
*-rgt-identity16.0%
associate-*l/16.0%
associate-/l*16.0%
exp-to-pow63.6%
Simplified63.6%
add-cbrt-cube63.6%
pow363.6%
pow-pow74.2%
Applied egg-rr74.2%
associate-*l/74.2%
metadata-eval74.2%
Simplified74.2%
pow1/374.2%
pow-pow68.9%
Applied egg-rr68.9%
if 6.39999999999999976e-290 < x < 2.4999999999999999e-189 or 1.1500000000000001e-87 < x < 5.8000000000000005e-14Initial program 31.6%
Taylor expanded in x around 0 31.6%
*-rgt-identity31.6%
associate-*l/31.6%
associate-/l*31.6%
exp-to-pow31.6%
Simplified31.6%
Taylor expanded in n around inf 62.6%
associate-*r/62.6%
mul-1-neg62.6%
Simplified62.6%
if 2.4999999999999999e-189 < x < 1.1500000000000001e-87Initial program 53.4%
Taylor expanded in n around inf 33.5%
log1p-define33.5%
Simplified33.5%
Taylor expanded in x around -inf 61.1%
mul-1-neg61.1%
mul-1-neg61.1%
associate-*r/61.1%
metadata-eval61.1%
*-commutative61.1%
associate-*r/61.1%
metadata-eval61.1%
Simplified61.1%
if 5.8000000000000005e-14 < x Initial program 67.8%
Taylor expanded in x around inf 95.2%
log-rec95.2%
mul-1-neg95.2%
neg-mul-195.2%
mul-1-neg95.2%
distribute-frac-neg95.2%
remove-double-neg95.2%
*-rgt-identity95.2%
associate-/l*95.2%
exp-to-pow95.2%
*-commutative95.2%
Simplified95.2%
*-un-lft-identity95.2%
associate-/r*97.0%
pow197.0%
pow-div96.7%
Applied egg-rr96.7%
*-lft-identity96.7%
sub-neg96.7%
metadata-eval96.7%
Simplified96.7%
unpow-prod-up97.0%
unpow-197.0%
div-inv97.0%
Applied egg-rr97.0%
Final simplification80.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))))
(if (<= x -1.25e-130)
0.0
(if (<= x 2.8e-290)
(- 1.0 (pow x (* (/ 3.0 n) 0.3333333333333333)))
(if (<= x 2.15e-190)
t_0
(if (<= x 1.2e-87)
(/
(+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x))
x)
(if (<= x 0.7)
t_0
(if (<= x 5.2e+42)
(/
(/
(+
1.0
(/
(- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5)
x))
x)
n)
0.0))))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double tmp;
if (x <= -1.25e-130) {
tmp = 0.0;
} else if (x <= 2.8e-290) {
tmp = 1.0 - pow(x, ((3.0 / n) * 0.3333333333333333));
} else if (x <= 2.15e-190) {
tmp = t_0;
} else if (x <= 1.2e-87) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.7) {
tmp = t_0;
} else if (x <= 5.2e+42) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = log(x) / -n
if (x <= (-1.25d-130)) then
tmp = 0.0d0
else if (x <= 2.8d-290) then
tmp = 1.0d0 - (x ** ((3.0d0 / n) * 0.3333333333333333d0))
else if (x <= 2.15d-190) then
tmp = t_0
else if (x <= 1.2d-87) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
else if (x <= 0.7d0) then
tmp = t_0
else if (x <= 5.2d+42) then
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double tmp;
if (x <= -1.25e-130) {
tmp = 0.0;
} else if (x <= 2.8e-290) {
tmp = 1.0 - Math.pow(x, ((3.0 / n) * 0.3333333333333333));
} else if (x <= 2.15e-190) {
tmp = t_0;
} else if (x <= 1.2e-87) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.7) {
tmp = t_0;
} else if (x <= 5.2e+42) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n tmp = 0 if x <= -1.25e-130: tmp = 0.0 elif x <= 2.8e-290: tmp = 1.0 - math.pow(x, ((3.0 / n) * 0.3333333333333333)) elif x <= 2.15e-190: tmp = t_0 elif x <= 1.2e-87: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x elif x <= 0.7: tmp = t_0 elif x <= 5.2e+42: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) tmp = 0.0 if (x <= -1.25e-130) tmp = 0.0; elseif (x <= 2.8e-290) tmp = Float64(1.0 - (x ^ Float64(Float64(3.0 / n) * 0.3333333333333333))); elseif (x <= 2.15e-190) tmp = t_0; elseif (x <= 1.2e-87) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x); elseif (x <= 0.7) tmp = t_0; elseif (x <= 5.2e+42) 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); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; tmp = 0.0; if (x <= -1.25e-130) tmp = 0.0; elseif (x <= 2.8e-290) tmp = 1.0 - (x ^ ((3.0 / n) * 0.3333333333333333)); elseif (x <= 2.15e-190) tmp = t_0; elseif (x <= 1.2e-87) tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x; elseif (x <= 0.7) tmp = t_0; elseif (x <= 5.2e+42) tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, -1.25e-130], 0.0, If[LessEqual[x, 2.8e-290], N[(1.0 - N[Power[x, N[(N[(3.0 / n), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.15e-190], t$95$0, If[LessEqual[x, 1.2e-87], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.7], t$95$0, If[LessEqual[x, 5.2e+42], 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], 0.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq -1.25 \cdot 10^{-130}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-290}:\\
\;\;\;\;1 - {x}^{\left(\frac{3}{n} \cdot 0.3333333333333333\right)}\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{-190}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-87}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+42}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.2499999999999999e-130 or 5.1999999999999998e42 < x Initial program 70.4%
Taylor expanded in x around inf 48.0%
log-rec48.0%
mul-1-neg48.0%
neg-mul-148.0%
mul-1-neg48.0%
distribute-frac-neg48.0%
remove-double-neg48.0%
*-rgt-identity48.0%
associate-/l*48.0%
exp-to-pow80.7%
Simplified80.7%
Taylor expanded in x around 0 83.4%
if -1.2499999999999999e-130 < x < 2.79999999999999997e-290Initial program 63.6%
Taylor expanded in x around 0 16.0%
*-rgt-identity16.0%
associate-*l/16.0%
associate-/l*16.0%
exp-to-pow63.6%
Simplified63.6%
add-cbrt-cube63.6%
pow363.6%
pow-pow74.2%
Applied egg-rr74.2%
associate-*l/74.2%
metadata-eval74.2%
Simplified74.2%
pow1/374.2%
pow-pow68.9%
Applied egg-rr68.9%
if 2.79999999999999997e-290 < x < 2.15e-190 or 1.2e-87 < x < 0.69999999999999996Initial program 34.4%
Taylor expanded in x around 0 31.7%
*-rgt-identity31.7%
associate-*l/31.7%
associate-/l*31.7%
exp-to-pow31.7%
Simplified31.7%
Taylor expanded in n around inf 60.2%
associate-*r/60.2%
mul-1-neg60.2%
Simplified60.2%
if 2.15e-190 < x < 1.2e-87Initial program 53.4%
Taylor expanded in n around inf 33.5%
log1p-define33.5%
Simplified33.5%
Taylor expanded in x around -inf 61.1%
mul-1-neg61.1%
mul-1-neg61.1%
associate-*r/61.1%
metadata-eval61.1%
*-commutative61.1%
associate-*r/61.1%
metadata-eval61.1%
Simplified61.1%
if 0.69999999999999996 < x < 5.1999999999999998e42Initial program 20.7%
Taylor expanded in n around inf 26.8%
log1p-define26.8%
Simplified26.8%
Taylor expanded in x around -inf 76.5%
Final simplification72.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))))
(if (<= x -3.6e-131)
0.0
(if (<= x 6e-290)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 1.38e-189)
t_0
(if (<= x 8.2e-88)
(/
(+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x))
x)
(if (<= x 0.7)
t_0
(if (<= x 5.3e+42)
(/
(/
(+
1.0
(/
(- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5)
x))
x)
n)
0.0))))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double tmp;
if (x <= -3.6e-131) {
tmp = 0.0;
} else if (x <= 6e-290) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 1.38e-189) {
tmp = t_0;
} else if (x <= 8.2e-88) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.7) {
tmp = t_0;
} else if (x <= 5.3e+42) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = log(x) / -n
if (x <= (-3.6d-131)) then
tmp = 0.0d0
else if (x <= 6d-290) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 1.38d-189) then
tmp = t_0
else if (x <= 8.2d-88) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
else if (x <= 0.7d0) then
tmp = t_0
else if (x <= 5.3d+42) then
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double tmp;
if (x <= -3.6e-131) {
tmp = 0.0;
} else if (x <= 6e-290) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 1.38e-189) {
tmp = t_0;
} else if (x <= 8.2e-88) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.7) {
tmp = t_0;
} else if (x <= 5.3e+42) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n tmp = 0 if x <= -3.6e-131: tmp = 0.0 elif x <= 6e-290: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 1.38e-189: tmp = t_0 elif x <= 8.2e-88: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x elif x <= 0.7: tmp = t_0 elif x <= 5.3e+42: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) tmp = 0.0 if (x <= -3.6e-131) tmp = 0.0; elseif (x <= 6e-290) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 1.38e-189) tmp = t_0; elseif (x <= 8.2e-88) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x); elseif (x <= 0.7) tmp = t_0; elseif (x <= 5.3e+42) 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); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; tmp = 0.0; if (x <= -3.6e-131) tmp = 0.0; elseif (x <= 6e-290) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 1.38e-189) tmp = t_0; elseif (x <= 8.2e-88) tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x; elseif (x <= 0.7) tmp = t_0; elseif (x <= 5.3e+42) tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, -3.6e-131], 0.0, If[LessEqual[x, 6e-290], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.38e-189], t$95$0, If[LessEqual[x, 8.2e-88], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.7], t$95$0, If[LessEqual[x, 5.3e+42], 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], 0.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq -3.6 \cdot 10^{-131}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-290}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 1.38 \cdot 10^{-189}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-88}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.3 \cdot 10^{+42}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -3.5999999999999999e-131 or 5.30000000000000028e42 < x Initial program 70.4%
Taylor expanded in x around inf 48.0%
log-rec48.0%
mul-1-neg48.0%
neg-mul-148.0%
mul-1-neg48.0%
distribute-frac-neg48.0%
remove-double-neg48.0%
*-rgt-identity48.0%
associate-/l*48.0%
exp-to-pow80.7%
Simplified80.7%
Taylor expanded in x around 0 83.4%
if -3.5999999999999999e-131 < x < 5.99999999999999985e-290Initial program 63.6%
Taylor expanded in x around 0 16.0%
*-rgt-identity16.0%
associate-*l/16.0%
associate-/l*16.0%
exp-to-pow63.6%
Simplified63.6%
if 5.99999999999999985e-290 < x < 1.3800000000000001e-189 or 8.2000000000000002e-88 < x < 0.69999999999999996Initial program 34.4%
Taylor expanded in x around 0 31.7%
*-rgt-identity31.7%
associate-*l/31.7%
associate-/l*31.7%
exp-to-pow31.7%
Simplified31.7%
Taylor expanded in n around inf 60.2%
associate-*r/60.2%
mul-1-neg60.2%
Simplified60.2%
if 1.3800000000000001e-189 < x < 8.2000000000000002e-88Initial program 53.4%
Taylor expanded in n around inf 33.5%
log1p-define33.5%
Simplified33.5%
Taylor expanded in x around -inf 61.1%
mul-1-neg61.1%
mul-1-neg61.1%
associate-*r/61.1%
metadata-eval61.1%
*-commutative61.1%
associate-*r/61.1%
metadata-eval61.1%
Simplified61.1%
if 0.69999999999999996 < x < 5.30000000000000028e42Initial program 20.7%
Taylor expanded in n around inf 26.8%
log1p-define26.8%
Simplified26.8%
Taylor expanded in x around -inf 76.5%
Final simplification71.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))))
(if (<= x -1e-309)
0.0
(if (<= x 2.15e-190)
t_0
(if (<= x 8.8e-88)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x)) x)
(if (<= x 0.7)
t_0
(if (<= x 4.7e+42)
(/
(/
(+
1.0
(/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
x)
n)
0.0)))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double tmp;
if (x <= -1e-309) {
tmp = 0.0;
} else if (x <= 2.15e-190) {
tmp = t_0;
} else if (x <= 8.8e-88) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.7) {
tmp = t_0;
} else if (x <= 4.7e+42) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = log(x) / -n
if (x <= (-1d-309)) then
tmp = 0.0d0
else if (x <= 2.15d-190) then
tmp = t_0
else if (x <= 8.8d-88) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
else if (x <= 0.7d0) then
tmp = t_0
else if (x <= 4.7d+42) then
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double tmp;
if (x <= -1e-309) {
tmp = 0.0;
} else if (x <= 2.15e-190) {
tmp = t_0;
} else if (x <= 8.8e-88) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.7) {
tmp = t_0;
} else if (x <= 4.7e+42) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n tmp = 0 if x <= -1e-309: tmp = 0.0 elif x <= 2.15e-190: tmp = t_0 elif x <= 8.8e-88: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x elif x <= 0.7: tmp = t_0 elif x <= 4.7e+42: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) tmp = 0.0 if (x <= -1e-309) tmp = 0.0; elseif (x <= 2.15e-190) tmp = t_0; elseif (x <= 8.8e-88) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x); elseif (x <= 0.7) tmp = t_0; elseif (x <= 4.7e+42) 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); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; tmp = 0.0; if (x <= -1e-309) tmp = 0.0; elseif (x <= 2.15e-190) tmp = t_0; elseif (x <= 8.8e-88) tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x; elseif (x <= 0.7) tmp = t_0; elseif (x <= 4.7e+42) tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, -1e-309], 0.0, If[LessEqual[x, 2.15e-190], t$95$0, If[LessEqual[x, 8.8e-88], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.7], t$95$0, If[LessEqual[x, 4.7e+42], 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], 0.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-309}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{-190}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-88}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.7 \cdot 10^{+42}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.000000000000002e-309 or 4.69999999999999986e42 < x Initial program 69.2%
Taylor expanded in x around inf 42.3%
log-rec42.3%
mul-1-neg42.3%
neg-mul-142.3%
mul-1-neg42.3%
distribute-frac-neg42.3%
remove-double-neg42.3%
*-rgt-identity42.3%
associate-/l*42.3%
exp-to-pow73.0%
Simplified73.0%
Taylor expanded in x around 0 75.5%
if -1.000000000000002e-309 < x < 2.15e-190 or 8.8000000000000002e-88 < x < 0.69999999999999996Initial program 36.6%
Taylor expanded in x around 0 34.1%
*-rgt-identity34.1%
associate-*l/34.1%
associate-/l*34.1%
exp-to-pow34.1%
Simplified34.1%
Taylor expanded in n around inf 58.7%
associate-*r/58.7%
mul-1-neg58.7%
Simplified58.7%
if 2.15e-190 < x < 8.8000000000000002e-88Initial program 53.4%
Taylor expanded in n around inf 33.5%
log1p-define33.5%
Simplified33.5%
Taylor expanded in x around -inf 61.1%
mul-1-neg61.1%
mul-1-neg61.1%
associate-*r/61.1%
metadata-eval61.1%
*-commutative61.1%
associate-*r/61.1%
metadata-eval61.1%
Simplified61.1%
if 0.69999999999999996 < x < 4.69999999999999986e42Initial program 20.7%
Taylor expanded in n around inf 26.8%
log1p-define26.8%
Simplified26.8%
Taylor expanded in x around -inf 76.5%
Final simplification68.3%
(FPCore (x n)
:precision binary64
(if (<= x 7.2e-290)
0.0
(if (<= x 4.1e+42)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x)) x)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 7.2e-290) {
tmp = 0.0;
} else if (x <= 4.1e+42) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 7.2d-290) then
tmp = 0.0d0
else if (x <= 4.1d+42) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 7.2e-290) {
tmp = 0.0;
} else if (x <= 4.1e+42) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 7.2e-290: tmp = 0.0 elif x <= 4.1e+42: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 7.2e-290) tmp = 0.0; elseif (x <= 4.1e+42) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 7.2e-290) tmp = 0.0; elseif (x <= 4.1e+42) tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 7.2e-290], 0.0, If[LessEqual[x, 4.1e+42], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.2 \cdot 10^{-290}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{+42}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 7.19999999999999959e-290 or 4.1e42 < x Initial program 68.9%
Taylor expanded in x around inf 40.9%
log-rec40.9%
mul-1-neg40.9%
neg-mul-140.9%
mul-1-neg40.9%
distribute-frac-neg40.9%
remove-double-neg40.9%
*-rgt-identity40.9%
associate-/l*40.9%
exp-to-pow70.4%
Simplified70.4%
Taylor expanded in x around 0 72.8%
if 7.19999999999999959e-290 < x < 4.1e42Initial program 39.5%
Taylor expanded in n around inf 47.9%
log1p-define47.9%
Simplified47.9%
Taylor expanded in x around -inf 39.7%
mul-1-neg39.7%
mul-1-neg39.7%
associate-*r/39.7%
metadata-eval39.7%
*-commutative39.7%
associate-*r/39.7%
metadata-eval39.7%
Simplified39.7%
Final simplification56.9%
(FPCore (x n) :precision binary64 (if (or (<= n -2.8e-6) (not (<= n 3.6e-56))) (/ (/ 1.0 n) x) 0.0))
double code(double x, double n) {
double tmp;
if ((n <= -2.8e-6) || !(n <= 3.6e-56)) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2.8d-6)) .or. (.not. (n <= 3.6d-56))) then
tmp = (1.0d0 / n) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((n <= -2.8e-6) || !(n <= 3.6e-56)) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if (n <= -2.8e-6) or not (n <= 3.6e-56): tmp = (1.0 / n) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if ((n <= -2.8e-6) || !(n <= 3.6e-56)) tmp = Float64(Float64(1.0 / n) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((n <= -2.8e-6) || ~((n <= 3.6e-56))) tmp = (1.0 / n) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[Or[LessEqual[n, -2.8e-6], N[Not[LessEqual[n, 3.6e-56]], $MachinePrecision]], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{-6} \lor \neg \left(n \leq 3.6 \cdot 10^{-56}\right):\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -2.79999999999999987e-6 or 3.59999999999999978e-56 < n Initial program 31.7%
Taylor expanded in x around inf 46.7%
log-rec46.7%
mul-1-neg46.7%
neg-mul-146.7%
mul-1-neg46.7%
distribute-frac-neg46.7%
remove-double-neg46.7%
*-rgt-identity46.7%
associate-/l*46.7%
exp-to-pow46.7%
*-commutative46.7%
Simplified46.7%
*-un-lft-identity46.7%
associate-/r*47.9%
pow147.9%
pow-div47.7%
Applied egg-rr47.7%
*-lft-identity47.7%
sub-neg47.7%
metadata-eval47.7%
Simplified47.7%
Taylor expanded in n around inf 44.6%
associate-/r*45.8%
Simplified45.8%
if -2.79999999999999987e-6 < n < 3.59999999999999978e-56Initial program 76.5%
Taylor expanded in x around inf 22.3%
log-rec22.3%
mul-1-neg22.3%
neg-mul-122.3%
mul-1-neg22.3%
distribute-frac-neg22.3%
remove-double-neg22.3%
*-rgt-identity22.3%
associate-/l*22.3%
exp-to-pow52.1%
Simplified52.1%
Taylor expanded in x around 0 54.7%
Final simplification50.4%
(FPCore (x n) :precision binary64 (if (<= n -2.8e-6) (/ (/ 1.0 x) n) (if (<= n 3.2e-56) 0.0 (/ (/ 1.0 n) x))))
double code(double x, double n) {
double tmp;
if (n <= -2.8e-6) {
tmp = (1.0 / x) / n;
} else if (n <= 3.2e-56) {
tmp = 0.0;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.8d-6)) then
tmp = (1.0d0 / x) / n
else if (n <= 3.2d-56) then
tmp = 0.0d0
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -2.8e-6) {
tmp = (1.0 / x) / n;
} else if (n <= 3.2e-56) {
tmp = 0.0;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -2.8e-6: tmp = (1.0 / x) / n elif n <= 3.2e-56: tmp = 0.0 else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (n <= -2.8e-6) tmp = Float64(Float64(1.0 / x) / n); elseif (n <= 3.2e-56) tmp = 0.0; else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -2.8e-6) tmp = (1.0 / x) / n; elseif (n <= 3.2e-56) tmp = 0.0; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -2.8e-6], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, 3.2e-56], 0.0, N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;n \leq 3.2 \cdot 10^{-56}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if n < -2.79999999999999987e-6Initial program 22.6%
Taylor expanded in x around inf 48.1%
log-rec48.1%
mul-1-neg48.1%
neg-mul-148.1%
mul-1-neg48.1%
distribute-frac-neg48.1%
remove-double-neg48.1%
*-rgt-identity48.1%
associate-/l*48.1%
exp-to-pow48.1%
*-commutative48.1%
Simplified48.1%
*-un-lft-identity48.1%
associate-/r*50.6%
pow150.6%
pow-div50.3%
Applied egg-rr50.3%
*-lft-identity50.3%
sub-neg50.3%
metadata-eval50.3%
Simplified50.3%
Taylor expanded in n around inf 46.0%
if -2.79999999999999987e-6 < n < 3.19999999999999986e-56Initial program 76.5%
Taylor expanded in x around inf 22.3%
log-rec22.3%
mul-1-neg22.3%
neg-mul-122.3%
mul-1-neg22.3%
distribute-frac-neg22.3%
remove-double-neg22.3%
*-rgt-identity22.3%
associate-/l*22.3%
exp-to-pow52.1%
Simplified52.1%
Taylor expanded in x around 0 54.7%
if 3.19999999999999986e-56 < n Initial program 39.2%
Taylor expanded in x around inf 45.5%
log-rec45.5%
mul-1-neg45.5%
neg-mul-145.5%
mul-1-neg45.5%
distribute-frac-neg45.5%
remove-double-neg45.5%
*-rgt-identity45.5%
associate-/l*45.5%
exp-to-pow45.5%
*-commutative45.5%
Simplified45.5%
*-un-lft-identity45.5%
associate-/r*45.6%
pow145.6%
pow-div45.6%
Applied egg-rr45.6%
*-lft-identity45.6%
sub-neg45.6%
metadata-eval45.6%
Simplified45.6%
Taylor expanded in n around inf 45.6%
associate-/r*45.8%
Simplified45.8%
(FPCore (x n) :precision binary64 (if (<= x 3.05e-298) 0.0 (if (<= x 4.9e+42) (/ 1.0 (* n x)) 0.0)))
double code(double x, double n) {
double tmp;
if (x <= 3.05e-298) {
tmp = 0.0;
} else if (x <= 4.9e+42) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 3.05d-298) then
tmp = 0.0d0
else if (x <= 4.9d+42) then
tmp = 1.0d0 / (n * x)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 3.05e-298) {
tmp = 0.0;
} else if (x <= 4.9e+42) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 3.05e-298: tmp = 0.0 elif x <= 4.9e+42: tmp = 1.0 / (n * x) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 3.05e-298) tmp = 0.0; elseif (x <= 4.9e+42) tmp = Float64(1.0 / Float64(n * x)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 3.05e-298) tmp = 0.0; elseif (x <= 4.9e+42) tmp = 1.0 / (n * x); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 3.05e-298], 0.0, If[LessEqual[x, 4.9e+42], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.05 \cdot 10^{-298}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{+42}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3.05000000000000006e-298 or 4.9000000000000002e42 < x Initial program 69.2%
Taylor expanded in x around inf 41.5%
log-rec41.5%
mul-1-neg41.5%
neg-mul-141.5%
mul-1-neg41.5%
distribute-frac-neg41.5%
remove-double-neg41.5%
*-rgt-identity41.5%
associate-/l*41.5%
exp-to-pow71.4%
Simplified71.4%
Taylor expanded in x around 0 73.8%
if 3.05000000000000006e-298 < x < 4.9000000000000002e42Initial program 39.7%
Taylor expanded in x around inf 36.5%
log-rec36.5%
mul-1-neg36.5%
neg-mul-136.5%
mul-1-neg36.5%
distribute-frac-neg36.5%
remove-double-neg36.5%
*-rgt-identity36.5%
associate-/l*36.5%
exp-to-pow36.5%
*-commutative36.5%
Simplified36.5%
Taylor expanded in n around inf 25.3%
*-commutative25.3%
Simplified25.3%
Final simplification50.1%
(FPCore (x n) :precision binary64 0.0)
double code(double x, double n) {
return 0.0;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double x, double n) {
return 0.0;
}
def code(x, n): return 0.0
function code(x, n) return 0.0 end
function tmp = code(x, n) tmp = 0.0; end
code[x_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 54.8%
Taylor expanded in x around inf 23.5%
log-rec23.5%
mul-1-neg23.5%
neg-mul-123.5%
mul-1-neg23.5%
distribute-frac-neg23.5%
remove-double-neg23.5%
*-rgt-identity23.5%
associate-/l*23.5%
exp-to-pow38.9%
Simplified38.9%
Taylor expanded in x around 0 40.3%
herbie shell --seed 2024177
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))