
(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 17 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 (* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0)))))
(if (<= n -31000000.0)
(/ (+ (log1p x) (- (/ t_0 n) (log x))) n)
(if (<= n 8500000.0)
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))
(if (<= n 2.1e+95)
(/ (pow (pow x (/ 0.5 n)) 2.0) (* n x))
(/
(-
(+
(log1p x)
(/
(-
t_0
(/
(+
(*
-0.16666666666666666
(- (pow (log1p x) 3.0) (pow (log x) 3.0)))
(/
(*
-0.041666666666666664
(- (pow (log1p x) 4.0) (pow (log x) 4.0)))
n))
n))
n))
(+ (log (pow (cbrt x) 2.0)) (log (cbrt x))))
n))))))
double code(double x, double n) {
double t_0 = 0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0));
double tmp;
if (n <= -31000000.0) {
tmp = (log1p(x) + ((t_0 / n) - log(x))) / n;
} else if (n <= 8500000.0) {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
} else if (n <= 2.1e+95) {
tmp = pow(pow(x, (0.5 / n)), 2.0) / (n * x);
} else {
tmp = ((log1p(x) + ((t_0 - (((-0.16666666666666666 * (pow(log1p(x), 3.0) - pow(log(x), 3.0))) + ((-0.041666666666666664 * (pow(log1p(x), 4.0) - pow(log(x), 4.0))) / n)) / n)) / n)) - (log(pow(cbrt(x), 2.0)) + log(cbrt(x)))) / n;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = 0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0));
double tmp;
if (n <= -31000000.0) {
tmp = (Math.log1p(x) + ((t_0 / n) - Math.log(x))) / n;
} else if (n <= 8500000.0) {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
} else if (n <= 2.1e+95) {
tmp = Math.pow(Math.pow(x, (0.5 / n)), 2.0) / (n * x);
} else {
tmp = ((Math.log1p(x) + ((t_0 - (((-0.16666666666666666 * (Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0))) + ((-0.041666666666666664 * (Math.pow(Math.log1p(x), 4.0) - Math.pow(Math.log(x), 4.0))) / n)) / n)) / n)) - (Math.log(Math.pow(Math.cbrt(x), 2.0)) + Math.log(Math.cbrt(x)))) / n;
}
return tmp;
}
function code(x, n) t_0 = Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) tmp = 0.0 if (n <= -31000000.0) tmp = Float64(Float64(log1p(x) + Float64(Float64(t_0 / n) - log(x))) / n); elseif (n <= 8500000.0) tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); elseif (n <= 2.1e+95) tmp = Float64(((x ^ Float64(0.5 / n)) ^ 2.0) / Float64(n * x)); else tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(t_0 - Float64(Float64(Float64(-0.16666666666666666 * Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0))) + Float64(Float64(-0.041666666666666664 * Float64((log1p(x) ^ 4.0) - (log(x) ^ 4.0))) / n)) / n)) / n)) - Float64(log((cbrt(x) ^ 2.0)) + log(cbrt(x)))) / n); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -31000000.0], N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(t$95$0 / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, 8500000.0], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.1e+95], N[(N[Power[N[Power[x, N[(0.5 / n), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(t$95$0 - N[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.041666666666666664 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 4.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[(N[Log[N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision] + N[Log[N[Power[x, 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right)\\
\mathbf{if}\;n \leq -31000000:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(\frac{t\_0}{n} - \log x\right)}{n}\\
\mathbf{elif}\;n \leq 8500000:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;n \leq 2.1 \cdot 10^{+95}:\\
\;\;\;\;\frac{{\left({x}^{\left(\frac{0.5}{n}\right)}\right)}^{2}}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{t\_0 - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \frac{-0.041666666666666664 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{n}\right) - \left(\log \left({\left(\sqrt[3]{x}\right)}^{2}\right) + \log \left(\sqrt[3]{x}\right)\right)}{n}\\
\end{array}
\end{array}
if n < -3.1e7Initial program 42.5%
Taylor expanded in n around inf 93.7%
Simplified93.7%
if -3.1e7 < n < 8.5e6Initial program 88.4%
Taylor expanded in n around 0 88.4%
log1p-define98.9%
Simplified98.9%
if 8.5e6 < n < 2.1e95Initial program 8.2%
Taylor expanded in x around inf 61.4%
mul-1-neg61.4%
log-rec61.4%
mul-1-neg61.4%
distribute-neg-frac61.4%
mul-1-neg61.4%
remove-double-neg61.4%
*-commutative61.4%
Simplified61.4%
div-inv61.4%
pow-to-exp61.4%
sqr-pow61.5%
pow261.5%
Applied egg-rr61.5%
Taylor expanded in n around 0 61.5%
if 2.1e95 < n Initial program 21.7%
Taylor expanded in n around -inf 80.7%
Simplified80.7%
add-cube-cbrt80.7%
log-prod80.8%
pow280.8%
Applied egg-rr80.8%
Final simplification90.2%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -100.0)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) 2e-97)
(/
(+
(log1p x)
(- (/ (* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0))) n) (log x)))
n)
(if (<= (/ 1.0 n) 2e-7)
(/ (pow (pow x (/ 0.5 n)) 2.0) (* n x))
(exp
(pow (cbrt (log (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))) 3.0))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-97) {
tmp = (log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) / n) - log(x))) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = pow(pow(x, (0.5 / n)), 2.0) / (n * x);
} else {
tmp = exp(pow(cbrt(log((exp((log1p(x) / n)) - pow(x, (1.0 / n))))), 3.0));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-97) {
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 if ((1.0 / n) <= 2e-7) {
tmp = Math.pow(Math.pow(x, (0.5 / n)), 2.0) / (n * x);
} else {
tmp = Math.exp(Math.pow(Math.cbrt(Math.log((Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n))))), 3.0));
}
return tmp;
}
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -100.0) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= 2e-97) tmp = Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) / n) - log(x))) / n); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(((x ^ Float64(0.5 / n)) ^ 2.0) / Float64(n * x)); else tmp = exp((cbrt(log(Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))))) ^ 3.0)); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -100.0], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-97], N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[Power[N[Power[x, N[(0.5 / n), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], N[Exp[N[Power[N[Power[N[Log[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -100:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-97}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(\frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right)}{n} - \log x\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{{\left({x}^{\left(\frac{0.5}{n}\right)}\right)}^{2}}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;e^{{\left(\sqrt[3]{\log \left(e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\right)}\right)}^{3}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -100Initial program 100.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
associate-/r*100.0%
div-inv100.0%
pow-to-exp100.0%
pow1100.0%
pow-div100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
if -100 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000007e-97Initial program 33.7%
Taylor expanded in n around inf 88.2%
Simplified88.2%
if 2.00000000000000007e-97 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e-7Initial program 8.2%
Taylor expanded in x around inf 61.4%
mul-1-neg61.4%
log-rec61.4%
mul-1-neg61.4%
distribute-neg-frac61.4%
mul-1-neg61.4%
remove-double-neg61.4%
*-commutative61.4%
Simplified61.4%
div-inv61.4%
pow-to-exp61.4%
sqr-pow61.5%
pow261.5%
Applied egg-rr61.5%
Taylor expanded in n around 0 61.5%
if 1.9999999999999999e-7 < (/.f64 #s(literal 1 binary64) n) Initial program 68.4%
add-exp-log68.4%
pow-to-exp68.4%
un-div-inv68.4%
+-commutative68.4%
log1p-define97.1%
Applied egg-rr97.1%
add-cube-cbrt97.1%
pow397.1%
Applied egg-rr97.1%
Final simplification90.2%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -100.0)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) 2e-97)
(/
(+
(log1p x)
(- (/ (* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0))) n) (log x)))
n)
(if (<= (/ 1.0 n) 2e-7)
(/ (pow (pow x (/ 0.5 n)) 2.0) (* n x))
(pow
(pow (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))) 3.0)
0.3333333333333333)))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-97) {
tmp = (log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) / n) - log(x))) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = pow(pow(x, (0.5 / n)), 2.0) / (n * x);
} else {
tmp = pow(pow((exp((log1p(x) / n)) - pow(x, (1.0 / n))), 3.0), 0.3333333333333333);
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-97) {
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 if ((1.0 / n) <= 2e-7) {
tmp = Math.pow(Math.pow(x, (0.5 / n)), 2.0) / (n * x);
} else {
tmp = Math.pow(Math.pow((Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n))), 3.0), 0.3333333333333333);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -100.0: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n elif (1.0 / n) <= 2e-97: 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 elif (1.0 / n) <= 2e-7: tmp = math.pow(math.pow(x, (0.5 / n)), 2.0) / (n * x) else: tmp = math.pow(math.pow((math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n))), 3.0), 0.3333333333333333) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -100.0) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= 2e-97) tmp = Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) / n) - log(x))) / n); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(((x ^ Float64(0.5 / n)) ^ 2.0) / Float64(n * x)); else tmp = (Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))) ^ 3.0) ^ 0.3333333333333333; end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -100.0], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-97], N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[Power[N[Power[x, N[(0.5 / n), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -100:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-97}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(\frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right)}{n} - \log x\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{{\left({x}^{\left(\frac{0.5}{n}\right)}\right)}^{2}}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\right)}^{3}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -100Initial program 100.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
associate-/r*100.0%
div-inv100.0%
pow-to-exp100.0%
pow1100.0%
pow-div100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
if -100 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000007e-97Initial program 33.7%
Taylor expanded in n around inf 88.2%
Simplified88.2%
if 2.00000000000000007e-97 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e-7Initial program 8.2%
Taylor expanded in x around inf 61.4%
mul-1-neg61.4%
log-rec61.4%
mul-1-neg61.4%
distribute-neg-frac61.4%
mul-1-neg61.4%
remove-double-neg61.4%
*-commutative61.4%
Simplified61.4%
div-inv61.4%
pow-to-exp61.4%
sqr-pow61.5%
pow261.5%
Applied egg-rr61.5%
Taylor expanded in n around 0 61.5%
if 1.9999999999999999e-7 < (/.f64 #s(literal 1 binary64) n) Initial program 68.4%
add-cbrt-cube68.4%
pow1/368.4%
pow368.4%
pow-to-exp68.4%
un-div-inv68.4%
+-commutative68.4%
log1p-define97.1%
Applied egg-rr97.1%
Final simplification90.2%
(FPCore (x n)
:precision binary64
(if (<= n -15000000000.0)
(* (/ -1.0 n) (- (log x) (log1p x)))
(if (<= n 115000.0)
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))
(if (<= n 5.8e+94)
(/ (pow (pow x (/ 0.5 n)) 2.0) (* n x))
(/ (log (/ (+ x 1.0) x)) n)))))
double code(double x, double n) {
double tmp;
if (n <= -15000000000.0) {
tmp = (-1.0 / n) * (log(x) - log1p(x));
} else if (n <= 115000.0) {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
} else if (n <= 5.8e+94) {
tmp = pow(pow(x, (0.5 / n)), 2.0) / (n * x);
} else {
tmp = log(((x + 1.0) / x)) / n;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (n <= -15000000000.0) {
tmp = (-1.0 / n) * (Math.log(x) - Math.log1p(x));
} else if (n <= 115000.0) {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
} else if (n <= 5.8e+94) {
tmp = Math.pow(Math.pow(x, (0.5 / n)), 2.0) / (n * x);
} else {
tmp = Math.log(((x + 1.0) / x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -15000000000.0: tmp = (-1.0 / n) * (math.log(x) - math.log1p(x)) elif n <= 115000.0: tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) elif n <= 5.8e+94: tmp = math.pow(math.pow(x, (0.5 / n)), 2.0) / (n * x) else: tmp = math.log(((x + 1.0) / x)) / n return tmp
function code(x, n) tmp = 0.0 if (n <= -15000000000.0) tmp = Float64(Float64(-1.0 / n) * Float64(log(x) - log1p(x))); elseif (n <= 115000.0) tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); elseif (n <= 5.8e+94) tmp = Float64(((x ^ Float64(0.5 / n)) ^ 2.0) / Float64(n * x)); else tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); end return tmp end
code[x_, n_] := If[LessEqual[n, -15000000000.0], N[(N[(-1.0 / n), $MachinePrecision] * N[(N[Log[x], $MachinePrecision] - N[Log[1 + x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 115000.0], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.8e+94], N[(N[Power[N[Power[x, N[(0.5 / n), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -15000000000:\\
\;\;\;\;\frac{-1}{n} \cdot \left(\log x - \mathsf{log1p}\left(x\right)\right)\\
\mathbf{elif}\;n \leq 115000:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{+94}:\\
\;\;\;\;\frac{{\left({x}^{\left(\frac{0.5}{n}\right)}\right)}^{2}}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\end{array}
\end{array}
if n < -1.5e10Initial program 42.5%
Taylor expanded in n around inf 92.9%
log1p-define92.9%
Simplified92.9%
div-inv93.0%
Applied egg-rr93.0%
if -1.5e10 < n < 115000Initial program 88.4%
Taylor expanded in n around 0 88.4%
log1p-define98.9%
Simplified98.9%
if 115000 < n < 5.7999999999999997e94Initial program 8.2%
Taylor expanded in x around inf 61.4%
mul-1-neg61.4%
log-rec61.4%
mul-1-neg61.4%
distribute-neg-frac61.4%
mul-1-neg61.4%
remove-double-neg61.4%
*-commutative61.4%
Simplified61.4%
div-inv61.4%
pow-to-exp61.4%
sqr-pow61.5%
pow261.5%
Applied egg-rr61.5%
Taylor expanded in n around 0 61.5%
if 5.7999999999999997e94 < n Initial program 21.7%
Taylor expanded in n around inf 80.7%
log1p-define80.7%
Simplified80.7%
log1p-undefine80.7%
diff-log80.7%
Applied egg-rr80.7%
+-commutative80.7%
Simplified80.7%
Final simplification90.0%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -100.0)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) 2e-97)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 2e-7)
(/ (pow (pow x (/ 0.5 n)) 2.0) (* n x))
(if (<= (/ 1.0 n) 5e+225)
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n)))
(/ 1.0 (* n x)))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-97) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = pow(pow(x, (0.5 / n)), 2.0) / (n * x);
} else if ((1.0 / n) <= 5e+225) {
tmp = pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
} 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 ((1.0d0 / n) <= (-100.0d0)) then
tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
else if ((1.0d0 / n) <= 2d-97) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 2d-7) then
tmp = ((x ** (0.5d0 / n)) ** 2.0d0) / (n * x)
else if ((1.0d0 / n) <= 5d+225) then
tmp = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-97) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = Math.pow(Math.pow(x, (0.5 / n)), 2.0) / (n * x);
} else if ((1.0 / n) <= 5e+225) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -100.0: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n elif (1.0 / n) <= 2e-97: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 2e-7: tmp = math.pow(math.pow(x, (0.5 / n)), 2.0) / (n * x) elif (1.0 / n) <= 5e+225: tmp = math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -100.0) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= 2e-97) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(((x ^ Float64(0.5 / n)) ^ 2.0) / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e+225) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -100.0) tmp = (x ^ ((1.0 / n) + -1.0)) / n; elseif ((1.0 / n) <= 2e-97) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 2e-7) tmp = ((x ^ (0.5 / n)) ^ 2.0) / (n * x); elseif ((1.0 / n) <= 5e+225) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -100.0], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-97], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[Power[N[Power[x, N[(0.5 / n), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+225], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -100:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{{\left({x}^{\left(\frac{0.5}{n}\right)}\right)}^{2}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+225}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -100Initial program 100.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
associate-/r*100.0%
div-inv100.0%
pow-to-exp100.0%
pow1100.0%
pow-div100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
if -100 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000007e-97Initial program 33.7%
Taylor expanded in n around inf 87.7%
log1p-define87.7%
Simplified87.7%
log1p-undefine87.7%
diff-log87.7%
Applied egg-rr87.7%
+-commutative87.7%
Simplified87.7%
if 2.00000000000000007e-97 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e-7Initial program 8.2%
Taylor expanded in x around inf 61.4%
mul-1-neg61.4%
log-rec61.4%
mul-1-neg61.4%
distribute-neg-frac61.4%
mul-1-neg61.4%
remove-double-neg61.4%
*-commutative61.4%
Simplified61.4%
div-inv61.4%
pow-to-exp61.4%
sqr-pow61.5%
pow261.5%
Applied egg-rr61.5%
Taylor expanded in n around 0 61.5%
if 1.9999999999999999e-7 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999981e225Initial program 83.4%
if 4.99999999999999981e225 < (/.f64 #s(literal 1 binary64) n) Initial program 20.6%
Taylor expanded in x around inf 0.0%
mul-1-neg0.0%
log-rec0.0%
mul-1-neg0.0%
distribute-neg-frac0.0%
mul-1-neg0.0%
remove-double-neg0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in n around inf 80.6%
*-commutative80.6%
Simplified80.6%
Final simplification87.6%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -100.0)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) 2e-97)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 0.001)
(/ (pow (pow x (/ 0.5 n)) 2.0) (* n x))
(if (<= (/ 1.0 n) 4e+232)
(- (+ (/ x n) 1.0) (pow x (/ 1.0 n)))
(/ 1.0 (* n x)))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-97) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.001) {
tmp = pow(pow(x, (0.5 / n)), 2.0) / (n * x);
} else if ((1.0 / n) <= 4e+232) {
tmp = ((x / n) + 1.0) - pow(x, (1.0 / n));
} 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 ((1.0d0 / n) <= (-100.0d0)) then
tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
else if ((1.0d0 / n) <= 2d-97) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 0.001d0) then
tmp = ((x ** (0.5d0 / n)) ** 2.0d0) / (n * x)
else if ((1.0d0 / n) <= 4d+232) then
tmp = ((x / n) + 1.0d0) - (x ** (1.0d0 / n))
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-97) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.001) {
tmp = Math.pow(Math.pow(x, (0.5 / n)), 2.0) / (n * x);
} else if ((1.0 / n) <= 4e+232) {
tmp = ((x / n) + 1.0) - Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -100.0: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n elif (1.0 / n) <= 2e-97: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 0.001: tmp = math.pow(math.pow(x, (0.5 / n)), 2.0) / (n * x) elif (1.0 / n) <= 4e+232: tmp = ((x / n) + 1.0) - math.pow(x, (1.0 / n)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -100.0) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= 2e-97) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 0.001) tmp = Float64(((x ^ Float64(0.5 / n)) ^ 2.0) / Float64(n * x)); elseif (Float64(1.0 / n) <= 4e+232) tmp = Float64(Float64(Float64(x / n) + 1.0) - (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -100.0) tmp = (x ^ ((1.0 / n) + -1.0)) / n; elseif ((1.0 / n) <= 2e-97) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 0.001) tmp = ((x ^ (0.5 / n)) ^ 2.0) / (n * x); elseif ((1.0 / n) <= 4e+232) tmp = ((x / n) + 1.0) - (x ^ (1.0 / n)); else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -100.0], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-97], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.001], N[(N[Power[N[Power[x, N[(0.5 / n), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+232], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -100:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.001:\\
\;\;\;\;\frac{{\left({x}^{\left(\frac{0.5}{n}\right)}\right)}^{2}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+232}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -100Initial program 100.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
associate-/r*100.0%
div-inv100.0%
pow-to-exp100.0%
pow1100.0%
pow-div100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
if -100 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000007e-97Initial program 33.7%
Taylor expanded in n around inf 87.7%
log1p-define87.7%
Simplified87.7%
log1p-undefine87.7%
diff-log87.7%
Applied egg-rr87.7%
+-commutative87.7%
Simplified87.7%
if 2.00000000000000007e-97 < (/.f64 #s(literal 1 binary64) n) < 1e-3Initial program 10.7%
Taylor expanded in x around inf 60.1%
mul-1-neg60.1%
log-rec60.1%
mul-1-neg60.1%
distribute-neg-frac60.1%
mul-1-neg60.1%
remove-double-neg60.1%
*-commutative60.1%
Simplified60.1%
div-inv60.1%
pow-to-exp60.1%
sqr-pow60.2%
pow260.2%
Applied egg-rr60.2%
Taylor expanded in n around 0 60.2%
if 1e-3 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000023e232Initial program 81.6%
Taylor expanded in x around 0 73.7%
if 4.00000000000000023e232 < (/.f64 #s(literal 1 binary64) n) Initial program 12.8%
Taylor expanded in x around inf 0.0%
mul-1-neg0.0%
log-rec0.0%
mul-1-neg0.0%
distribute-neg-frac0.0%
mul-1-neg0.0%
remove-double-neg0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in n around inf 87.9%
*-commutative87.9%
Simplified87.9%
Final simplification86.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -100.0)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) 2e-97)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 0.001)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 4e+232)
(- (+ (/ x n) 1.0) t_0)
(/ 1.0 (* n x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-97) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.001) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 4e+232) {
tmp = ((x / n) + 1.0) - t_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) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-100.0d0)) then
tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
else if ((1.0d0 / n) <= 2d-97) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 0.001d0) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 4d+232) then
tmp = ((x / n) + 1.0d0) - t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-97) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.001) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 4e+232) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -100.0: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n elif (1.0 / n) <= 2e-97: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 0.001: tmp = t_0 / (n * x) elif (1.0 / n) <= 4e+232: tmp = ((x / n) + 1.0) - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -100.0) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= 2e-97) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 0.001) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 4e+232) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -100.0) tmp = (x ^ ((1.0 / n) + -1.0)) / n; elseif ((1.0 / n) <= 2e-97) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 0.001) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 4e+232) tmp = ((x / n) + 1.0) - t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -100.0], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-97], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.001], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+232], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -100:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.001:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+232}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -100Initial program 100.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
associate-/r*100.0%
div-inv100.0%
pow-to-exp100.0%
pow1100.0%
pow-div100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
if -100 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000007e-97Initial program 33.7%
Taylor expanded in n around inf 87.7%
log1p-define87.7%
Simplified87.7%
log1p-undefine87.7%
diff-log87.7%
Applied egg-rr87.7%
+-commutative87.7%
Simplified87.7%
if 2.00000000000000007e-97 < (/.f64 #s(literal 1 binary64) n) < 1e-3Initial program 10.7%
Taylor expanded in x around inf 60.1%
mul-1-neg60.1%
log-rec60.1%
mul-1-neg60.1%
distribute-neg-frac60.1%
mul-1-neg60.1%
remove-double-neg60.1%
*-commutative60.1%
Simplified60.1%
div-inv60.1%
div-inv60.1%
pow-to-exp60.1%
Applied egg-rr60.1%
associate-*r/60.1%
*-rgt-identity60.1%
Simplified60.1%
if 1e-3 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000023e232Initial program 81.6%
Taylor expanded in x around 0 73.7%
if 4.00000000000000023e232 < (/.f64 #s(literal 1 binary64) n) Initial program 12.8%
Taylor expanded in x around inf 0.0%
mul-1-neg0.0%
log-rec0.0%
mul-1-neg0.0%
distribute-neg-frac0.0%
mul-1-neg0.0%
remove-double-neg0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in n around inf 87.9%
*-commutative87.9%
Simplified87.9%
Final simplification86.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -1e+48)
t_0
(if (<= (/ 1.0 n) 2e-97)
(/ (log (/ (+ x 1.0) x)) n)
(if (or (<= (/ 1.0 n) 0.001) (not (<= (/ 1.0 n) 5e+225)))
(/ 1.0 (* n x))
t_0)))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e+48) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-97) {
tmp = log(((x + 1.0) / x)) / n;
} else if (((1.0 / n) <= 0.001) || !((1.0 / n) <= 5e+225)) {
tmp = 1.0 / (n * x);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-1d+48)) then
tmp = t_0
else if ((1.0d0 / n) <= 2d-97) then
tmp = log(((x + 1.0d0) / x)) / n
else if (((1.0d0 / n) <= 0.001d0) .or. (.not. ((1.0d0 / n) <= 5d+225))) then
tmp = 1.0d0 / (n * x)
else
tmp = t_0
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 ((1.0 / n) <= -1e+48) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-97) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if (((1.0 / n) <= 0.001) || !((1.0 / n) <= 5e+225)) {
tmp = 1.0 / (n * x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e+48: tmp = t_0 elif (1.0 / n) <= 2e-97: tmp = math.log(((x + 1.0) / x)) / n elif ((1.0 / n) <= 0.001) or not ((1.0 / n) <= 5e+225): tmp = 1.0 / (n * x) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -1e+48) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-97) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif ((Float64(1.0 / n) <= 0.001) || !(Float64(1.0 / n) <= 5e+225)) tmp = Float64(1.0 / Float64(n * x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -1e+48) tmp = t_0; elseif ((1.0 / n) <= 2e-97) tmp = log(((x + 1.0) / x)) / n; elseif (((1.0 / n) <= 0.001) || ~(((1.0 / n) <= 5e+225))) tmp = 1.0 / (n * x); else tmp = t_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[N[(1.0 / n), $MachinePrecision], -1e+48], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-97], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[Or[LessEqual[N[(1.0 / n), $MachinePrecision], 0.001], N[Not[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+225]], $MachinePrecision]], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+48}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.001 \lor \neg \left(\frac{1}{n} \leq 5 \cdot 10^{+225}\right):\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000004e48 or 1e-3 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999981e225Initial program 94.4%
Taylor expanded in x around 0 61.4%
if -1.00000000000000004e48 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000007e-97Initial program 39.9%
Taylor expanded in n around inf 86.6%
log1p-define86.6%
Simplified86.6%
log1p-undefine86.6%
diff-log86.6%
Applied egg-rr86.6%
+-commutative86.6%
Simplified86.6%
if 2.00000000000000007e-97 < (/.f64 #s(literal 1 binary64) n) < 1e-3 or 4.99999999999999981e225 < (/.f64 #s(literal 1 binary64) n) Initial program 13.3%
Taylor expanded in x around inf 44.3%
mul-1-neg44.3%
log-rec44.3%
mul-1-neg44.3%
distribute-neg-frac44.3%
mul-1-neg44.3%
remove-double-neg44.3%
*-commutative44.3%
Simplified44.3%
Taylor expanded in n around inf 62.9%
*-commutative62.9%
Simplified62.9%
Final simplification74.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -100.0)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) 2e-97)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 0.001)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 5e+225) (- 1.0 t_0) (/ 1.0 (* n x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-97) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.001) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e+225) {
tmp = 1.0 - t_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) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-100.0d0)) then
tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
else if ((1.0d0 / n) <= 2d-97) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 0.001d0) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 5d+225) then
tmp = 1.0d0 - t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-97) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.001) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e+225) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -100.0: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n elif (1.0 / n) <= 2e-97: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 0.001: tmp = t_0 / (n * x) elif (1.0 / n) <= 5e+225: tmp = 1.0 - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -100.0) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= 2e-97) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 0.001) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e+225) tmp = Float64(1.0 - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -100.0) tmp = (x ^ ((1.0 / n) + -1.0)) / n; elseif ((1.0 / n) <= 2e-97) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 0.001) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 5e+225) tmp = 1.0 - t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -100.0], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-97], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.001], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+225], N[(1.0 - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -100:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.001:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+225}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -100Initial program 100.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
associate-/r*100.0%
div-inv100.0%
pow-to-exp100.0%
pow1100.0%
pow-div100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
if -100 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000007e-97Initial program 33.7%
Taylor expanded in n around inf 87.7%
log1p-define87.7%
Simplified87.7%
log1p-undefine87.7%
diff-log87.7%
Applied egg-rr87.7%
+-commutative87.7%
Simplified87.7%
if 2.00000000000000007e-97 < (/.f64 #s(literal 1 binary64) n) < 1e-3Initial program 10.7%
Taylor expanded in x around inf 60.1%
mul-1-neg60.1%
log-rec60.1%
mul-1-neg60.1%
distribute-neg-frac60.1%
mul-1-neg60.1%
remove-double-neg60.1%
*-commutative60.1%
Simplified60.1%
div-inv60.1%
div-inv60.1%
pow-to-exp60.1%
Applied egg-rr60.1%
associate-*r/60.1%
*-rgt-identity60.1%
Simplified60.1%
if 1e-3 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999981e225Initial program 83.5%
Taylor expanded in x around 0 74.1%
if 4.99999999999999981e225 < (/.f64 #s(literal 1 binary64) n) Initial program 20.6%
Taylor expanded in x around inf 0.0%
mul-1-neg0.0%
log-rec0.0%
mul-1-neg0.0%
distribute-neg-frac0.0%
mul-1-neg0.0%
remove-double-neg0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in n around inf 80.6%
*-commutative80.6%
Simplified80.6%
Final simplification86.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (pow x (+ (/ 1.0 n) -1.0)) n)))
(if (<= (/ 1.0 n) -100.0)
t_0
(if (<= (/ 1.0 n) 2e-97)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 0.001)
t_0
(if (<= (/ 1.0 n) 5e+225)
(- 1.0 (pow x (/ 1.0 n)))
(/ 1.0 (* n x))))))))
double code(double x, double n) {
double t_0 = pow(x, ((1.0 / n) + -1.0)) / n;
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-97) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.001) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+225) {
tmp = 1.0 - pow(x, (1.0 / n));
} 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) :: t_0
real(8) :: tmp
t_0 = (x ** ((1.0d0 / n) + (-1.0d0))) / n
if ((1.0d0 / n) <= (-100.0d0)) then
tmp = t_0
else if ((1.0d0 / n) <= 2d-97) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 0.001d0) then
tmp = t_0
else if ((1.0d0 / n) <= 5d+225) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, ((1.0 / n) + -1.0)) / n;
double tmp;
if ((1.0 / n) <= -100.0) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-97) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.001) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+225) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, ((1.0 / n) + -1.0)) / n tmp = 0 if (1.0 / n) <= -100.0: tmp = t_0 elif (1.0 / n) <= 2e-97: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 0.001: tmp = t_0 elif (1.0 / n) <= 5e+225: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -100.0) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-97) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 0.001) tmp = t_0; elseif (Float64(1.0 / n) <= 5e+225) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = (x ^ ((1.0 / n) + -1.0)) / n; tmp = 0.0; if ((1.0 / n) <= -100.0) tmp = t_0; elseif ((1.0 / n) <= 2e-97) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 0.001) tmp = t_0; elseif ((1.0 / n) <= 5e+225) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -100.0], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-97], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.001], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+225], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -100:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-97}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.001:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+225}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -100 or 2.00000000000000007e-97 < (/.f64 #s(literal 1 binary64) n) < 1e-3Initial program 75.0%
Taylor expanded in x around inf 88.8%
mul-1-neg88.8%
log-rec88.8%
mul-1-neg88.8%
distribute-neg-frac88.8%
mul-1-neg88.8%
remove-double-neg88.8%
*-commutative88.8%
Simplified88.8%
*-un-lft-identity88.8%
associate-/r*88.8%
div-inv88.8%
pow-to-exp88.8%
pow188.8%
pow-div88.6%
Applied egg-rr88.6%
*-lft-identity88.6%
sub-neg88.6%
metadata-eval88.6%
Simplified88.6%
if -100 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000007e-97Initial program 33.7%
Taylor expanded in n around inf 87.7%
log1p-define87.7%
Simplified87.7%
log1p-undefine87.7%
diff-log87.7%
Applied egg-rr87.7%
+-commutative87.7%
Simplified87.7%
if 1e-3 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999981e225Initial program 83.5%
Taylor expanded in x around 0 74.1%
if 4.99999999999999981e225 < (/.f64 #s(literal 1 binary64) n) Initial program 20.6%
Taylor expanded in x around inf 0.0%
mul-1-neg0.0%
log-rec0.0%
mul-1-neg0.0%
distribute-neg-frac0.0%
mul-1-neg0.0%
remove-double-neg0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in n around inf 80.6%
*-commutative80.6%
Simplified80.6%
Final simplification86.2%
(FPCore (x n)
:precision binary64
(if (<= x 2e-161)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.85)
(/ (- x (log x)) n)
(if (<= x 2e+103)
(/ (- (/ 1.0 n) (/ (- (/ 0.5 n) (/ 0.3333333333333333 (* n x))) x)) x)
0.0))))
double code(double x, double n) {
double tmp;
if (x <= 2e-161) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.85) {
tmp = (x - log(x)) / n;
} else if (x <= 2e+103) {
tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / 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 <= 2d-161) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.85d0) then
tmp = (x - log(x)) / n
else if (x <= 2d+103) then
tmp = ((1.0d0 / n) - (((0.5d0 / n) - (0.3333333333333333d0 / (n * x))) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2e-161) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.85) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 2e+103) {
tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2e-161: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.85: tmp = (x - math.log(x)) / n elif x <= 2e+103: tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 2e-161) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.85) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 2e+103) tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(0.5 / n) - Float64(0.3333333333333333 / Float64(n * x))) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2e-161) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.85) tmp = (x - log(x)) / n; elseif (x <= 2e+103) tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2e-161], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.85], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 2e+103], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(0.5 / n), $MachinePrecision] - N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-161}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.85:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+103}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{0.5}{n} - \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.00000000000000006e-161Initial program 54.4%
Taylor expanded in x around 0 54.4%
if 2.00000000000000006e-161 < x < 0.849999999999999978Initial program 37.5%
Taylor expanded in n around inf 60.0%
log1p-define60.0%
Simplified60.0%
Taylor expanded in x around 0 58.4%
if 0.849999999999999978 < x < 2e103Initial program 41.5%
Taylor expanded in n around inf 35.4%
log1p-define35.4%
Simplified35.4%
Taylor expanded in x around -inf 65.5%
associate-*r/65.5%
mul-1-neg65.5%
associate-*r/65.5%
mul-1-neg65.5%
associate-*r/65.5%
metadata-eval65.5%
*-commutative65.5%
associate-*r/65.5%
metadata-eval65.5%
Simplified65.5%
if 2e103 < x Initial program 79.8%
Taylor expanded in x around 0 42.4%
Taylor expanded in n around inf 79.8%
metadata-eval79.8%
Applied egg-rr79.8%
Final simplification64.5%
(FPCore (x n)
:precision binary64
(if (<= x 0.85)
(/ (- x (log x)) n)
(if (<= x 1.32e+103)
(/ (- (/ 1.0 n) (/ (- (/ 0.5 n) (/ 0.3333333333333333 (* n x))) x)) x)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.85) {
tmp = (x - log(x)) / n;
} else if (x <= 1.32e+103) {
tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / 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 <= 0.85d0) then
tmp = (x - log(x)) / n
else if (x <= 1.32d+103) then
tmp = ((1.0d0 / n) - (((0.5d0 / n) - (0.3333333333333333d0 / (n * x))) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.85) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 1.32e+103) {
tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.85: tmp = (x - math.log(x)) / n elif x <= 1.32e+103: tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.85) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 1.32e+103) tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(0.5 / n) - Float64(0.3333333333333333 / Float64(n * x))) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.85) tmp = (x - log(x)) / n; elseif (x <= 1.32e+103) tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.85], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.32e+103], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(0.5 / n), $MachinePrecision] - N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.85:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+103}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{0.5}{n} - \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.849999999999999978Initial program 45.1%
Taylor expanded in n around inf 53.0%
log1p-define53.0%
Simplified53.0%
Taylor expanded in x around 0 52.1%
if 0.849999999999999978 < x < 1.31999999999999999e103Initial program 41.5%
Taylor expanded in n around inf 35.4%
log1p-define35.4%
Simplified35.4%
Taylor expanded in x around -inf 65.5%
associate-*r/65.5%
mul-1-neg65.5%
associate-*r/65.5%
mul-1-neg65.5%
associate-*r/65.5%
metadata-eval65.5%
*-commutative65.5%
associate-*r/65.5%
metadata-eval65.5%
Simplified65.5%
if 1.31999999999999999e103 < x Initial program 79.8%
Taylor expanded in x around 0 42.4%
Taylor expanded in n around inf 79.8%
metadata-eval79.8%
Applied egg-rr79.8%
Final simplification61.9%
(FPCore (x n)
:precision binary64
(if (<= x 0.58)
(/ (- (log x)) n)
(if (<= x 3.15e+103)
(/ (- (/ 1.0 n) (/ (- (/ 0.5 n) (/ 0.3333333333333333 (* n x))) x)) x)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.58) {
tmp = -log(x) / n;
} else if (x <= 3.15e+103) {
tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / 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 <= 0.58d0) then
tmp = -log(x) / n
else if (x <= 3.15d+103) then
tmp = ((1.0d0 / n) - (((0.5d0 / n) - (0.3333333333333333d0 / (n * x))) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.58) {
tmp = -Math.log(x) / n;
} else if (x <= 3.15e+103) {
tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.58: tmp = -math.log(x) / n elif x <= 3.15e+103: tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.58) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 3.15e+103) tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(0.5 / n) - Float64(0.3333333333333333 / Float64(n * x))) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.58) tmp = -log(x) / n; elseif (x <= 3.15e+103) tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.58], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 3.15e+103], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(0.5 / n), $MachinePrecision] - N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.58:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 3.15 \cdot 10^{+103}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{0.5}{n} - \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.57999999999999996Initial program 45.1%
Taylor expanded in x around 0 43.2%
Taylor expanded in n around inf 51.5%
associate-*r/51.5%
neg-mul-151.5%
Simplified51.5%
if 0.57999999999999996 < x < 3.14999999999999985e103Initial program 41.5%
Taylor expanded in n around inf 35.4%
log1p-define35.4%
Simplified35.4%
Taylor expanded in x around -inf 65.5%
associate-*r/65.5%
mul-1-neg65.5%
associate-*r/65.5%
mul-1-neg65.5%
associate-*r/65.5%
metadata-eval65.5%
*-commutative65.5%
associate-*r/65.5%
metadata-eval65.5%
Simplified65.5%
if 3.14999999999999985e103 < x Initial program 79.8%
Taylor expanded in x around 0 42.4%
Taylor expanded in n around inf 79.8%
metadata-eval79.8%
Applied egg-rr79.8%
Final simplification61.5%
(FPCore (x n) :precision binary64 (if (<= x 2.65e+103) (/ (- (/ 1.0 n) (/ (- (/ 0.5 n) (/ 0.3333333333333333 (* n x))) x)) x) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 2.65e+103) {
tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / 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 <= 2.65d+103) then
tmp = ((1.0d0 / n) - (((0.5d0 / n) - (0.3333333333333333d0 / (n * x))) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.65e+103) {
tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.65e+103: tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 2.65e+103) tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(0.5 / n) - Float64(0.3333333333333333 / Float64(n * x))) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.65e+103) tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.65e+103], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(0.5 / n), $MachinePrecision] - N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.65 \cdot 10^{+103}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{0.5}{n} - \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.64999999999999985e103Initial program 44.6%
Taylor expanded in n around inf 50.5%
log1p-define50.5%
Simplified50.5%
Taylor expanded in x around -inf 32.0%
associate-*r/32.0%
mul-1-neg32.0%
associate-*r/32.0%
mul-1-neg32.0%
associate-*r/32.0%
metadata-eval32.0%
*-commutative32.0%
associate-*r/32.0%
metadata-eval32.0%
Simplified32.0%
if 2.64999999999999985e103 < x Initial program 79.8%
Taylor expanded in x around 0 42.4%
Taylor expanded in n around inf 79.8%
metadata-eval79.8%
Applied egg-rr79.8%
Final simplification46.6%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -500.0) 0.0 (/ (/ 1.0 n) x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -500.0) {
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 ((1.0d0 / n) <= (-500.0d0)) 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 ((1.0 / n) <= -500.0) {
tmp = 0.0;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -500.0: tmp = 0.0 else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -500.0) 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 ((1.0 / n) <= -500.0) tmp = 0.0; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -500.0], 0.0, N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -500:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -500Initial program 100.0%
Taylor expanded in x around 0 49.5%
Taylor expanded in n around inf 52.9%
metadata-eval52.9%
Applied egg-rr52.9%
if -500 < (/.f64 #s(literal 1 binary64) n) Initial program 38.2%
Taylor expanded in n around inf 62.3%
log1p-define62.3%
Simplified62.3%
log1p-undefine62.3%
diff-log62.4%
Applied egg-rr62.4%
+-commutative62.4%
Simplified62.4%
Taylor expanded in x around inf 40.6%
associate-/r*41.2%
Simplified41.2%
(FPCore (x n) :precision binary64 (if (<= n -4.4e-268) 0.0 (/ 1.0 (* n x))))
double code(double x, double n) {
double tmp;
if (n <= -4.4e-268) {
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 <= (-4.4d-268)) 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 <= -4.4e-268) {
tmp = 0.0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -4.4e-268: tmp = 0.0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) tmp = 0.0 if (n <= -4.4e-268) tmp = 0.0; else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -4.4e-268) tmp = 0.0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -4.4e-268], 0.0, N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.4 \cdot 10^{-268}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if n < -4.40000000000000008e-268Initial program 71.3%
Taylor expanded in x around 0 45.6%
Taylor expanded in n around inf 47.3%
metadata-eval47.3%
Applied egg-rr47.3%
if -4.40000000000000008e-268 < n Initial program 38.4%
Taylor expanded in x around inf 35.6%
mul-1-neg35.6%
log-rec35.6%
mul-1-neg35.6%
distribute-neg-frac35.6%
mul-1-neg35.6%
remove-double-neg35.6%
*-commutative35.6%
Simplified35.6%
Taylor expanded in n around inf 38.7%
*-commutative38.7%
Simplified38.7%
Final simplification43.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 55.3%
Taylor expanded in x around 0 39.9%
Taylor expanded in n around inf 30.3%
metadata-eval30.3%
Applied egg-rr30.3%
herbie shell --seed 2024157
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))