
(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 16 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 (<= x -2.3e-56)
0.0
(if (<= x 1.2e-300)
(- (exp (/ x n)) t_0)
(if (<= x 20000.0)
(/
(log
(/
x
(exp
(+
(log1p x)
(/
(fma
0.5
(- (pow (log1p x) 2.0) (pow (log x) 2.0))
(*
0.16666666666666666
(/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n)))
n)))))
(- n))
(* t_0 (/ (/ 1.0 x) n)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= -2.3e-56) {
tmp = 0.0;
} else if (x <= 1.2e-300) {
tmp = exp((x / n)) - t_0;
} else if (x <= 20000.0) {
tmp = log((x / exp((log1p(x) + (fma(0.5, (pow(log1p(x), 2.0) - pow(log(x), 2.0)), (0.16666666666666666 * ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n))) / n))))) / -n;
} else {
tmp = t_0 * ((1.0 / x) / n);
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= -2.3e-56) tmp = 0.0; elseif (x <= 1.2e-300) tmp = Float64(exp(Float64(x / n)) - t_0); elseif (x <= 20000.0) tmp = Float64(log(Float64(x / exp(Float64(log1p(x) + Float64(fma(0.5, Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)), Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n))) / n))))) / Float64(-n)); else tmp = Float64(t_0 * Float64(Float64(1.0 / x) / n)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.3e-56], 0.0, If[LessEqual[x, 1.2e-300], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 20000.0], N[(N[Log[N[(x / N[Exp[N[(N[Log[1 + x], $MachinePrecision] + N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], N[(t$95$0 * N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq -2.3 \cdot 10^{-56}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-300}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\mathbf{elif}\;x \leq 20000:\\
\;\;\;\;\frac{\log \left(\frac{x}{e^{\mathsf{log1p}\left(x\right) + \frac{\mathsf{fma}\left(0.5, {\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}, 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}\right)}{n}}}\right)}{-n}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < -2.30000000000000002e-56Initial program 72.5%
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-pow88.0%
Simplified88.0%
Taylor expanded in x around 0 96.1%
if -2.30000000000000002e-56 < x < 1.2e-300Initial program 65.5%
Taylor expanded in n around 0 15.2%
log1p-define15.2%
*-rgt-identity15.2%
associate-*l/15.2%
associate-/l*15.2%
exp-to-pow95.2%
Simplified95.2%
Taylor expanded in x around 0 95.2%
if 1.2e-300 < x < 2e4Initial program 42.9%
Taylor expanded in n around -inf 79.3%
Simplified79.3%
add-log-exp87.1%
diff-log87.1%
Applied egg-rr87.1%
if 2e4 < x Initial program 69.8%
Taylor expanded in x around inf 97.9%
log-rec97.9%
mul-1-neg97.9%
neg-mul-197.9%
mul-1-neg97.9%
distribute-frac-neg97.9%
remove-double-neg97.9%
*-rgt-identity97.9%
associate-/l*97.9%
exp-to-pow97.9%
*-commutative97.9%
Simplified97.9%
div-inv97.9%
Applied egg-rr97.9%
associate-/r*99.5%
*-commutative99.5%
Simplified99.5%
Final simplification93.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x -1.95e-66)
0.0
(if (<= x 1.35e-300)
(- (exp (/ x n)) t_0)
(if (<= x 33000.0)
(/
(-
(+
(log1p x)
(/
(+
(* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0)))
(/
(*
0.16666666666666666
(- (pow (log1p x) 3.0) (pow (log x) 3.0)))
n))
n))
(log x))
n)
(* t_0 (/ (/ 1.0 x) n)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= -1.95e-66) {
tmp = 0.0;
} else if (x <= 1.35e-300) {
tmp = exp((x / n)) - t_0;
} else if (x <= 33000.0) {
tmp = ((log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) + ((0.16666666666666666 * (pow(log1p(x), 3.0) - pow(log(x), 3.0))) / n)) / n)) - log(x)) / n;
} else {
tmp = t_0 * ((1.0 / x) / n);
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= -1.95e-66) {
tmp = 0.0;
} else if (x <= 1.35e-300) {
tmp = Math.exp((x / n)) - t_0;
} else if (x <= 33000.0) {
tmp = ((Math.log1p(x) + (((0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) + ((0.16666666666666666 * (Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0))) / n)) / n)) - Math.log(x)) / n;
} else {
tmp = t_0 * ((1.0 / x) / n);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= -1.95e-66: tmp = 0.0 elif x <= 1.35e-300: tmp = math.exp((x / n)) - t_0 elif x <= 33000.0: tmp = ((math.log1p(x) + (((0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0))) + ((0.16666666666666666 * (math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0))) / n)) / n)) - math.log(x)) / n else: tmp = t_0 * ((1.0 / x) / n) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= -1.95e-66) tmp = 0.0; elseif (x <= 1.35e-300) tmp = Float64(exp(Float64(x / n)) - t_0); elseif (x <= 33000.0) tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) + Float64(Float64(0.16666666666666666 * Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0))) / n)) / n)) - log(x)) / n); else tmp = Float64(t_0 * Float64(Float64(1.0 / x) / n)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.95e-66], 0.0, If[LessEqual[x, 1.35e-300], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 33000.0], N[(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[(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), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(t$95$0 * N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{-66}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-300}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\mathbf{elif}\;x \leq 33000:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + \frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{n}}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < -1.94999999999999991e-66Initial program 72.5%
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-pow88.0%
Simplified88.0%
Taylor expanded in x around 0 96.1%
if -1.94999999999999991e-66 < x < 1.34999999999999998e-300Initial program 65.5%
Taylor expanded in n around 0 15.2%
log1p-define15.2%
*-rgt-identity15.2%
associate-*l/15.2%
associate-/l*15.2%
exp-to-pow95.2%
Simplified95.2%
Taylor expanded in x around 0 95.2%
if 1.34999999999999998e-300 < x < 33000Initial program 42.9%
Taylor expanded in n around -inf 79.3%
Simplified79.3%
if 33000 < x Initial program 69.8%
Taylor expanded in x around inf 97.9%
log-rec97.9%
mul-1-neg97.9%
neg-mul-197.9%
mul-1-neg97.9%
distribute-frac-neg97.9%
remove-double-neg97.9%
*-rgt-identity97.9%
associate-/l*97.9%
exp-to-pow97.9%
*-commutative97.9%
Simplified97.9%
div-inv97.9%
Applied egg-rr97.9%
associate-/r*99.5%
*-commutative99.5%
Simplified99.5%
Final simplification90.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-62)
(* t_0 (/ (/ 1.0 x) n))
(if (<= (/ 1.0 n) 1e-22)
(/ (log (/ x (+ x 1.0))) (- n))
(pow (pow (- (exp (/ (log1p x) n)) t_0) 3.0) 0.3333333333333333)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 1e-22) {
tmp = log((x / (x + 1.0))) / -n;
} else {
tmp = pow(pow((exp((log1p(x) / n)) - t_0), 3.0), 0.3333333333333333);
}
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) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 1e-22) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else {
tmp = Math.pow(Math.pow((Math.exp((Math.log1p(x) / n)) - t_0), 3.0), 0.3333333333333333);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-62: tmp = t_0 * ((1.0 / x) / n) elif (1.0 / n) <= 1e-22: tmp = math.log((x / (x + 1.0))) / -n else: tmp = math.pow(math.pow((math.exp((math.log1p(x) / n)) - t_0), 3.0), 0.3333333333333333) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-62) tmp = Float64(t_0 * Float64(Float64(1.0 / x) / n)); elseif (Float64(1.0 / n) <= 1e-22) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); else tmp = (Float64(exp(Float64(log1p(x) / n)) - t_0) ^ 3.0) ^ 0.3333333333333333; 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], -1e-62], N[(t$95$0 * N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-22], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], N[Power[N[Power[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-62}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-22}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\right)}^{3}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-62Initial program 86.6%
Taylor expanded in x around inf 75.3%
log-rec75.3%
mul-1-neg75.3%
neg-mul-175.3%
mul-1-neg75.3%
distribute-frac-neg75.3%
remove-double-neg75.3%
*-rgt-identity75.3%
associate-/l*75.3%
exp-to-pow94.2%
*-commutative94.2%
Simplified94.2%
div-inv94.2%
Applied egg-rr94.2%
associate-/r*95.0%
*-commutative95.0%
Simplified95.0%
if -1e-62 < (/.f64 #s(literal 1 binary64) n) < 1e-22Initial program 40.1%
Taylor expanded in n around -inf 79.9%
Simplified79.9%
add-log-exp79.9%
diff-log47.9%
Applied egg-rr47.9%
Taylor expanded in n around inf 80.3%
associate-*r/80.3%
mul-1-neg80.3%
+-commutative80.3%
Simplified80.3%
if 1e-22 < (/.f64 #s(literal 1 binary64) n) Initial program 50.0%
add-cbrt-cube50.0%
pow1/350.0%
pow350.0%
pow-to-exp50.0%
un-div-inv50.0%
+-commutative50.0%
log1p-define91.5%
Applied egg-rr91.5%
Final simplification88.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-62)
(* t_0 (/ (/ 1.0 x) n))
(if (<= (/ 1.0 n) 1e-22)
(/ (log (/ x (+ x 1.0))) (- n))
(exp (log (- (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) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 1e-22) {
tmp = log((x / (x + 1.0))) / -n;
} else {
tmp = exp(log((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) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 1e-22) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else {
tmp = Math.exp(Math.log((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) <= -1e-62: tmp = t_0 * ((1.0 / x) / n) elif (1.0 / n) <= 1e-22: tmp = math.log((x / (x + 1.0))) / -n else: tmp = math.exp(math.log((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) <= -1e-62) tmp = Float64(t_0 * Float64(Float64(1.0 / x) / n)); elseif (Float64(1.0 / n) <= 1e-22) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); else tmp = exp(log(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], -1e-62], N[(t$95$0 * N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-22], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], N[Exp[N[Log[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-62}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-22}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{else}:\\
\;\;\;\;e^{\log \left(e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-62Initial program 86.6%
Taylor expanded in x around inf 75.3%
log-rec75.3%
mul-1-neg75.3%
neg-mul-175.3%
mul-1-neg75.3%
distribute-frac-neg75.3%
remove-double-neg75.3%
*-rgt-identity75.3%
associate-/l*75.3%
exp-to-pow94.2%
*-commutative94.2%
Simplified94.2%
div-inv94.2%
Applied egg-rr94.2%
associate-/r*95.0%
*-commutative95.0%
Simplified95.0%
if -1e-62 < (/.f64 #s(literal 1 binary64) n) < 1e-22Initial program 40.1%
Taylor expanded in n around -inf 79.9%
Simplified79.9%
add-log-exp79.9%
diff-log47.9%
Applied egg-rr47.9%
Taylor expanded in n around inf 80.3%
associate-*r/80.3%
mul-1-neg80.3%
+-commutative80.3%
Simplified80.3%
if 1e-22 < (/.f64 #s(literal 1 binary64) n) Initial program 50.0%
add-exp-log50.0%
pow-to-exp50.0%
un-div-inv50.0%
+-commutative50.0%
log1p-define91.5%
Applied egg-rr91.5%
Final simplification88.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-62)
(* t_0 (/ (/ 1.0 x) n))
(if (<= (/ 1.0 n) 1e-22)
(/ (log (/ x (+ x 1.0))) (- 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) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 1e-22) {
tmp = log((x / (x + 1.0))) / -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) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 1e-22) {
tmp = Math.log((x / (x + 1.0))) / -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) <= -1e-62: tmp = t_0 * ((1.0 / x) / n) elif (1.0 / n) <= 1e-22: tmp = math.log((x / (x + 1.0))) / -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) <= -1e-62) tmp = Float64(t_0 * Float64(Float64(1.0 / x) / n)); elseif (Float64(1.0 / n) <= 1e-22) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-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], -1e-62], N[(t$95$0 * N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-22], N[(N[Log[N[(x / N[(x + 1.0), $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 -1 \cdot 10^{-62}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-22}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\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) < -1e-62Initial program 86.6%
Taylor expanded in x around inf 75.3%
log-rec75.3%
mul-1-neg75.3%
neg-mul-175.3%
mul-1-neg75.3%
distribute-frac-neg75.3%
remove-double-neg75.3%
*-rgt-identity75.3%
associate-/l*75.3%
exp-to-pow94.2%
*-commutative94.2%
Simplified94.2%
div-inv94.2%
Applied egg-rr94.2%
associate-/r*95.0%
*-commutative95.0%
Simplified95.0%
if -1e-62 < (/.f64 #s(literal 1 binary64) n) < 1e-22Initial program 40.1%
Taylor expanded in n around -inf 79.9%
Simplified79.9%
add-log-exp79.9%
diff-log47.9%
Applied egg-rr47.9%
Taylor expanded in n around inf 80.3%
associate-*r/80.3%
mul-1-neg80.3%
+-commutative80.3%
Simplified80.3%
if 1e-22 < (/.f64 #s(literal 1 binary64) n) Initial program 50.0%
Taylor expanded in n around 0 31.7%
log1p-define57.1%
*-rgt-identity57.1%
associate-*l/57.1%
associate-/l*57.1%
exp-to-pow91.5%
Simplified91.5%
Final simplification88.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-62)
(* t_0 (/ (/ 1.0 x) n))
(if (<= (/ 1.0 n) 2e-12)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 5e+179)
(- (+ (/ x n) 1.0) t_0)
(log (pow (/ 1.0 x) (/ 1.0 n))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 2e-12) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 5e+179) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = log(pow((1.0 / x), (1.0 / n)));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-62)) then
tmp = t_0 * ((1.0d0 / x) / n)
else if ((1.0d0 / n) <= 2d-12) then
tmp = log((x / (x + 1.0d0))) / -n
else if ((1.0d0 / n) <= 5d+179) then
tmp = ((x / n) + 1.0d0) - t_0
else
tmp = log(((1.0d0 / x) ** (1.0d0 / n)))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 2e-12) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 5e+179) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = Math.log(Math.pow((1.0 / x), (1.0 / n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-62: tmp = t_0 * ((1.0 / x) / n) elif (1.0 / n) <= 2e-12: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 5e+179: tmp = ((x / n) + 1.0) - t_0 else: tmp = math.log(math.pow((1.0 / x), (1.0 / n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-62) tmp = Float64(t_0 * Float64(Float64(1.0 / x) / n)); elseif (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 5e+179) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); else tmp = log((Float64(1.0 / x) ^ Float64(1.0 / n))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-62) tmp = t_0 * ((1.0 / x) / n); elseif ((1.0 / n) <= 2e-12) tmp = log((x / (x + 1.0))) / -n; elseif ((1.0 / n) <= 5e+179) tmp = ((x / n) + 1.0) - t_0; else tmp = log(((1.0 / x) ^ (1.0 / n))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-62], N[(t$95$0 * N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+179], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[N[Power[N[(1.0 / x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-62}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+179}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\log \left({\left(\frac{1}{x}\right)}^{\left(\frac{1}{n}\right)}\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-62Initial program 86.6%
Taylor expanded in x around inf 75.3%
log-rec75.3%
mul-1-neg75.3%
neg-mul-175.3%
mul-1-neg75.3%
distribute-frac-neg75.3%
remove-double-neg75.3%
*-rgt-identity75.3%
associate-/l*75.3%
exp-to-pow94.2%
*-commutative94.2%
Simplified94.2%
div-inv94.2%
Applied egg-rr94.2%
associate-/r*95.0%
*-commutative95.0%
Simplified95.0%
if -1e-62 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 39.4%
Taylor expanded in n around -inf 78.5%
Simplified78.5%
add-log-exp78.5%
diff-log47.1%
Applied egg-rr47.1%
Taylor expanded in n around inf 78.8%
associate-*r/78.8%
mul-1-neg78.8%
+-commutative78.8%
Simplified78.8%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 5e179Initial program 72.9%
Taylor expanded in x around 0 67.6%
if 5e179 < (/.f64 #s(literal 1 binary64) n) Initial program 22.5%
Taylor expanded in x around 0 5.6%
*-rgt-identity5.6%
associate-*l/5.6%
associate-/l*5.6%
exp-to-pow18.6%
Simplified18.6%
Taylor expanded in n around inf 8.0%
associate-*r/8.0%
neg-mul-18.0%
Simplified8.0%
add-log-exp52.1%
div-inv52.1%
neg-log52.1%
exp-to-pow53.0%
Applied egg-rr53.0%
Final simplification80.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-62)
(* t_0 (/ (/ 1.0 x) n))
(if (<= (/ 1.0 n) 2e-12)
(/ (log (/ x (+ x 1.0))) (- n))
(- (exp (/ x n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 2e-12) {
tmp = log((x / (x + 1.0))) / -n;
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-62)) then
tmp = t_0 * ((1.0d0 / x) / n)
else if ((1.0d0 / n) <= 2d-12) then
tmp = log((x / (x + 1.0d0))) / -n
else
tmp = exp((x / n)) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 2e-12) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-62: tmp = t_0 * ((1.0 / x) / n) elif (1.0 / n) <= 2e-12: tmp = math.log((x / (x + 1.0))) / -n else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-62) tmp = Float64(t_0 * Float64(Float64(1.0 / x) / n)); elseif (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-62) tmp = t_0 * ((1.0 / x) / n); elseif ((1.0 / n) <= 2e-12) tmp = log((x / (x + 1.0))) / -n; else tmp = exp((x / n)) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-62], N[(t$95$0 * N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-62}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-62Initial program 86.6%
Taylor expanded in x around inf 75.3%
log-rec75.3%
mul-1-neg75.3%
neg-mul-175.3%
mul-1-neg75.3%
distribute-frac-neg75.3%
remove-double-neg75.3%
*-rgt-identity75.3%
associate-/l*75.3%
exp-to-pow94.2%
*-commutative94.2%
Simplified94.2%
div-inv94.2%
Applied egg-rr94.2%
associate-/r*95.0%
*-commutative95.0%
Simplified95.0%
if -1e-62 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 39.4%
Taylor expanded in n around -inf 78.5%
Simplified78.5%
add-log-exp78.5%
diff-log47.1%
Applied egg-rr47.1%
Taylor expanded in n around inf 78.8%
associate-*r/78.8%
mul-1-neg78.8%
+-commutative78.8%
Simplified78.8%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) Initial program 51.5%
Taylor expanded in n around 0 32.6%
log1p-define58.9%
*-rgt-identity58.9%
associate-*l/58.9%
associate-/l*58.9%
exp-to-pow94.5%
Simplified94.5%
Taylor expanded in x around 0 94.4%
Final simplification88.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-62)
(* t_0 (/ (/ 1.0 x) n))
(if (<= (/ 1.0 n) 2e-12)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 2e+267) (- (+ (/ x n) 1.0) t_0) (/ 1.0 (* x n)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 2e-12) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e+267) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-62)) then
tmp = t_0 * ((1.0d0 / x) / n)
else if ((1.0d0 / n) <= 2d-12) then
tmp = log((x / (x + 1.0d0))) / -n
else if ((1.0d0 / n) <= 2d+267) then
tmp = ((x / n) + 1.0d0) - t_0
else
tmp = 1.0d0 / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 2e-12) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e+267) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-62: tmp = t_0 * ((1.0 / x) / n) elif (1.0 / n) <= 2e-12: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 2e+267: tmp = ((x / n) + 1.0) - t_0 else: tmp = 1.0 / (x * n) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-62) tmp = Float64(t_0 * Float64(Float64(1.0 / x) / n)); elseif (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e+267) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); else tmp = Float64(1.0 / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-62) tmp = t_0 * ((1.0 / x) / n); elseif ((1.0 / n) <= 2e-12) tmp = log((x / (x + 1.0))) / -n; elseif ((1.0 / n) <= 2e+267) tmp = ((x / n) + 1.0) - t_0; else tmp = 1.0 / (x * n); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-62], N[(t$95$0 * N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+267], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-62}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+267}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-62Initial program 86.6%
Taylor expanded in x around inf 75.3%
log-rec75.3%
mul-1-neg75.3%
neg-mul-175.3%
mul-1-neg75.3%
distribute-frac-neg75.3%
remove-double-neg75.3%
*-rgt-identity75.3%
associate-/l*75.3%
exp-to-pow94.2%
*-commutative94.2%
Simplified94.2%
div-inv94.2%
Applied egg-rr94.2%
associate-/r*95.0%
*-commutative95.0%
Simplified95.0%
if -1e-62 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 39.4%
Taylor expanded in n around -inf 78.5%
Simplified78.5%
add-log-exp78.5%
diff-log47.1%
Applied egg-rr47.1%
Taylor expanded in n around inf 78.8%
associate-*r/78.8%
mul-1-neg78.8%
+-commutative78.8%
Simplified78.8%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e267Initial program 62.6%
Taylor expanded in x around 0 57.0%
if 1.9999999999999999e267 < (/.f64 #s(literal 1 binary64) n) Initial program 3.1%
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-pow0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in n around inf 73.2%
Final simplification80.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-62)
(* t_0 (/ (/ 1.0 x) n))
(if (<= (/ 1.0 n) 2e-12)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 2e+267) (- 1.0 t_0) (/ 1.0 (* x n)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 2e-12) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e+267) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-62)) then
tmp = t_0 * ((1.0d0 / x) / n)
else if ((1.0d0 / n) <= 2d-12) then
tmp = log((x / (x + 1.0d0))) / -n
else if ((1.0d0 / n) <= 2d+267) then
tmp = 1.0d0 - t_0
else
tmp = 1.0d0 / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-62) {
tmp = t_0 * ((1.0 / x) / n);
} else if ((1.0 / n) <= 2e-12) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e+267) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-62: tmp = t_0 * ((1.0 / x) / n) elif (1.0 / n) <= 2e-12: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 2e+267: tmp = 1.0 - t_0 else: tmp = 1.0 / (x * n) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-62) tmp = Float64(t_0 * Float64(Float64(1.0 / x) / n)); elseif (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e+267) tmp = Float64(1.0 - t_0); else tmp = Float64(1.0 / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-62) tmp = t_0 * ((1.0 / x) / n); elseif ((1.0 / n) <= 2e-12) tmp = log((x / (x + 1.0))) / -n; elseif ((1.0 / n) <= 2e+267) tmp = 1.0 - t_0; else tmp = 1.0 / (x * n); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-62], N[(t$95$0 * N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+267], N[(1.0 - t$95$0), $MachinePrecision], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-62}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+267}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-62Initial program 86.6%
Taylor expanded in x around inf 75.3%
log-rec75.3%
mul-1-neg75.3%
neg-mul-175.3%
mul-1-neg75.3%
distribute-frac-neg75.3%
remove-double-neg75.3%
*-rgt-identity75.3%
associate-/l*75.3%
exp-to-pow94.2%
*-commutative94.2%
Simplified94.2%
div-inv94.2%
Applied egg-rr94.2%
associate-/r*95.0%
*-commutative95.0%
Simplified95.0%
if -1e-62 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 39.4%
Taylor expanded in n around -inf 78.5%
Simplified78.5%
add-log-exp78.5%
diff-log47.1%
Applied egg-rr47.1%
Taylor expanded in n around inf 78.8%
associate-*r/78.8%
mul-1-neg78.8%
+-commutative78.8%
Simplified78.8%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e267Initial program 62.6%
Taylor expanded in x around 0 35.4%
*-rgt-identity35.4%
associate-*l/35.4%
associate-/l*35.4%
exp-to-pow56.5%
Simplified56.5%
if 1.9999999999999999e267 < (/.f64 #s(literal 1 binary64) n) Initial program 3.1%
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-pow0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in n around inf 73.2%
Final simplification80.1%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -1e-62)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) 2e-12)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 2e+267) (- 1.0 (pow x (/ 1.0 n))) (/ 1.0 (* x n))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e-62) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-12) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e+267) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= (-1d-62)) then
tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
else if ((1.0d0 / n) <= 2d-12) then
tmp = log((x / (x + 1.0d0))) / -n
else if ((1.0d0 / n) <= 2d+267) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = 1.0d0 / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e-62) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-12) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e+267) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1e-62: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n elif (1.0 / n) <= 2e-12: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 2e+267: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = 1.0 / (x * n) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-62) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e+267) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1e-62) tmp = (x ^ ((1.0 / n) + -1.0)) / n; elseif ((1.0 / n) <= 2e-12) tmp = log((x / (x + 1.0))) / -n; elseif ((1.0 / n) <= 2e+267) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = 1.0 / (x * n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-62], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+267], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-62}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+267}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e-62Initial program 86.6%
Taylor expanded in x around inf 75.3%
log-rec75.3%
mul-1-neg75.3%
neg-mul-175.3%
mul-1-neg75.3%
distribute-frac-neg75.3%
remove-double-neg75.3%
*-rgt-identity75.3%
associate-/l*75.3%
exp-to-pow94.2%
*-commutative94.2%
Simplified94.2%
*-un-lft-identity94.2%
associate-/r*95.0%
pow195.0%
pow-div94.9%
Applied egg-rr94.9%
*-lft-identity94.9%
sub-neg94.9%
metadata-eval94.9%
Simplified94.9%
if -1e-62 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 39.4%
Taylor expanded in n around -inf 78.5%
Simplified78.5%
add-log-exp78.5%
diff-log47.1%
Applied egg-rr47.1%
Taylor expanded in n around inf 78.8%
associate-*r/78.8%
mul-1-neg78.8%
+-commutative78.8%
Simplified78.8%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e267Initial program 62.6%
Taylor expanded in x around 0 35.4%
*-rgt-identity35.4%
associate-*l/35.4%
associate-/l*35.4%
exp-to-pow56.5%
Simplified56.5%
if 1.9999999999999999e267 < (/.f64 #s(literal 1 binary64) n) Initial program 3.1%
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-pow0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in n around inf 73.2%
Final simplification80.0%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) 2e-12) (/ (log (/ x (+ x 1.0))) (- n)) (if (<= (/ 1.0 n) 2e+267) (- 1.0 (pow x (/ 1.0 n))) (/ 1.0 (* x n)))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2e-12) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e+267) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= 2d-12) then
tmp = log((x / (x + 1.0d0))) / -n
else if ((1.0d0 / n) <= 2d+267) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = 1.0d0 / (x * n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2e-12) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e+267) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (x * n);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= 2e-12: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 2e+267: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = 1.0 / (x * n) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e+267) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(x * n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= 2e-12) tmp = log((x / (x + 1.0))) / -n; elseif ((1.0 / n) <= 2e+267) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = 1.0 / (x * n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+267], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+267}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 61.0%
Taylor expanded in n around -inf 71.6%
Simplified71.6%
add-log-exp74.9%
diff-log40.8%
Applied egg-rr40.8%
Taylor expanded in n around inf 72.3%
associate-*r/72.3%
mul-1-neg72.3%
+-commutative72.3%
Simplified72.3%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e267Initial program 62.6%
Taylor expanded in x around 0 35.4%
*-rgt-identity35.4%
associate-*l/35.4%
associate-/l*35.4%
exp-to-pow56.5%
Simplified56.5%
if 1.9999999999999999e267 < (/.f64 #s(literal 1 binary64) n) Initial program 3.1%
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-pow0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in n around inf 73.2%
Final simplification69.4%
(FPCore (x n)
:precision binary64
(if (<= x -2e-208)
0.0
(if (<= x 4.6e-137)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.55)
(/ (log x) (- n))
(if (<= x 2.9e+136) (/ (/ 1.0 x) n) 0.0)))))
double code(double x, double n) {
double tmp;
if (x <= -2e-208) {
tmp = 0.0;
} else if (x <= 4.6e-137) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.55) {
tmp = log(x) / -n;
} else if (x <= 2.9e+136) {
tmp = (1.0 / 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) :: tmp
if (x <= (-2d-208)) then
tmp = 0.0d0
else if (x <= 4.6d-137) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.55d0) then
tmp = log(x) / -n
else if (x <= 2.9d+136) then
tmp = (1.0d0 / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= -2e-208) {
tmp = 0.0;
} else if (x <= 4.6e-137) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.55) {
tmp = Math.log(x) / -n;
} else if (x <= 2.9e+136) {
tmp = (1.0 / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= -2e-208: tmp = 0.0 elif x <= 4.6e-137: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.55: tmp = math.log(x) / -n elif x <= 2.9e+136: tmp = (1.0 / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= -2e-208) tmp = 0.0; elseif (x <= 4.6e-137) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.55) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 2.9e+136) tmp = Float64(Float64(1.0 / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= -2e-208) tmp = 0.0; elseif (x <= 4.6e-137) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.55) tmp = log(x) / -n; elseif (x <= 2.9e+136) tmp = (1.0 / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, -2e-208], 0.0, If[LessEqual[x, 4.6e-137], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.55], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 2.9e+136], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-208}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-137}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.55:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+136}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.0000000000000002e-208 or 2.89999999999999974e136 < x Initial program 79.2%
Taylor expanded in x around inf 56.0%
log-rec56.0%
mul-1-neg56.0%
neg-mul-156.0%
mul-1-neg56.0%
distribute-frac-neg56.0%
remove-double-neg56.0%
*-rgt-identity56.0%
associate-/l*56.0%
exp-to-pow85.3%
Simplified85.3%
Taylor expanded in x around 0 87.4%
if -2.0000000000000002e-208 < x < 4.60000000000000016e-137Initial program 63.5%
Taylor expanded in x around 0 54.0%
*-rgt-identity54.0%
associate-*l/54.0%
associate-/l*54.0%
exp-to-pow63.5%
Simplified63.5%
if 4.60000000000000016e-137 < x < 0.55000000000000004Initial program 28.6%
Taylor expanded in x around 0 24.5%
*-rgt-identity24.5%
associate-*l/24.5%
associate-/l*24.5%
exp-to-pow24.5%
Simplified24.5%
Taylor expanded in n around inf 49.6%
associate-*r/49.6%
neg-mul-149.6%
Simplified49.6%
if 0.55000000000000004 < x < 2.89999999999999974e136Initial program 41.4%
Taylor expanded in x around inf 92.0%
log-rec92.0%
mul-1-neg92.0%
neg-mul-192.0%
mul-1-neg92.0%
distribute-frac-neg92.0%
remove-double-neg92.0%
*-rgt-identity92.0%
associate-/l*92.0%
exp-to-pow92.1%
*-commutative92.1%
Simplified92.1%
Taylor expanded in n around inf 68.6%
*-commutative68.6%
associate-/r*69.9%
Simplified69.9%
Final simplification71.2%
(FPCore (x n)
:precision binary64
(if (<= x -4e-310)
0.0
(if (<= x 0.55)
(/ (log x) (- n))
(if (<= x 3.1e+136) (/ (/ 1.0 x) n) 0.0))))
double code(double x, double n) {
double tmp;
if (x <= -4e-310) {
tmp = 0.0;
} else if (x <= 0.55) {
tmp = log(x) / -n;
} else if (x <= 3.1e+136) {
tmp = (1.0 / 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) :: tmp
if (x <= (-4d-310)) then
tmp = 0.0d0
else if (x <= 0.55d0) then
tmp = log(x) / -n
else if (x <= 3.1d+136) then
tmp = (1.0d0 / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= -4e-310) {
tmp = 0.0;
} else if (x <= 0.55) {
tmp = Math.log(x) / -n;
} else if (x <= 3.1e+136) {
tmp = (1.0 / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= -4e-310: tmp = 0.0 elif x <= 0.55: tmp = math.log(x) / -n elif x <= 3.1e+136: tmp = (1.0 / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= -4e-310) tmp = 0.0; elseif (x <= 0.55) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 3.1e+136) tmp = Float64(Float64(1.0 / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= -4e-310) tmp = 0.0; elseif (x <= 0.55) tmp = log(x) / -n; elseif (x <= 3.1e+136) tmp = (1.0 / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, -4e-310], 0.0, If[LessEqual[x, 0.55], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 3.1e+136], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-310}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 0.55:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+136}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -3.999999999999988e-310 or 3.09999999999999983e136 < x Initial program 80.4%
Taylor expanded in x around inf 52.7%
log-rec52.7%
mul-1-neg52.7%
neg-mul-152.7%
mul-1-neg52.7%
distribute-frac-neg52.7%
remove-double-neg52.7%
*-rgt-identity52.7%
associate-/l*52.7%
exp-to-pow80.5%
Simplified80.5%
Taylor expanded in x around 0 82.5%
if -3.999999999999988e-310 < x < 0.55000000000000004Initial program 45.6%
Taylor expanded in x around 0 43.8%
*-rgt-identity43.8%
associate-*l/43.8%
associate-/l*43.8%
exp-to-pow43.8%
Simplified43.8%
Taylor expanded in n around inf 46.0%
associate-*r/46.0%
neg-mul-146.0%
Simplified46.0%
if 0.55000000000000004 < x < 3.09999999999999983e136Initial program 41.4%
Taylor expanded in x around inf 92.0%
log-rec92.0%
mul-1-neg92.0%
neg-mul-192.0%
mul-1-neg92.0%
distribute-frac-neg92.0%
remove-double-neg92.0%
*-rgt-identity92.0%
associate-/l*92.0%
exp-to-pow92.1%
*-commutative92.1%
Simplified92.1%
Taylor expanded in n around inf 68.6%
*-commutative68.6%
associate-/r*69.9%
Simplified69.9%
Final simplification65.3%
(FPCore (x n) :precision binary64 (if (<= x 4.5e-304) 0.0 (if (<= x 3.6e+137) (/ (/ 1.0 x) n) 0.0)))
double code(double x, double n) {
double tmp;
if (x <= 4.5e-304) {
tmp = 0.0;
} else if (x <= 3.6e+137) {
tmp = (1.0 / 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) :: tmp
if (x <= 4.5d-304) then
tmp = 0.0d0
else if (x <= 3.6d+137) then
tmp = (1.0d0 / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 4.5e-304) {
tmp = 0.0;
} else if (x <= 3.6e+137) {
tmp = (1.0 / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 4.5e-304: tmp = 0.0 elif x <= 3.6e+137: tmp = (1.0 / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 4.5e-304) tmp = 0.0; elseif (x <= 3.6e+137) tmp = Float64(Float64(1.0 / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 4.5e-304) tmp = 0.0; elseif (x <= 3.6e+137) tmp = (1.0 / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 4.5e-304], 0.0, If[LessEqual[x, 3.6e+137], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{-304}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+137}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 4.4999999999999998e-304 or 3.6e137 < x Initial program 79.9%
Taylor expanded in x around inf 51.8%
log-rec51.8%
mul-1-neg51.8%
neg-mul-151.8%
mul-1-neg51.8%
distribute-frac-neg51.8%
remove-double-neg51.8%
*-rgt-identity51.8%
associate-/l*51.8%
exp-to-pow79.1%
Simplified79.1%
Taylor expanded in x around 0 81.0%
if 4.4999999999999998e-304 < x < 3.6e137Initial program 44.2%
Taylor expanded in x around inf 49.0%
log-rec49.0%
mul-1-neg49.0%
neg-mul-149.0%
mul-1-neg49.0%
distribute-frac-neg49.0%
remove-double-neg49.0%
*-rgt-identity49.0%
associate-/l*49.0%
exp-to-pow49.0%
*-commutative49.0%
Simplified49.0%
Taylor expanded in n around inf 42.8%
*-commutative42.8%
associate-/r*43.2%
Simplified43.2%
(FPCore (x n) :precision binary64 (if (<= x 4.5e-304) 0.0 (if (<= x 1.16e+137) (/ 1.0 (* x n)) 0.0)))
double code(double x, double n) {
double tmp;
if (x <= 4.5e-304) {
tmp = 0.0;
} else if (x <= 1.16e+137) {
tmp = 1.0 / (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) :: tmp
if (x <= 4.5d-304) then
tmp = 0.0d0
else if (x <= 1.16d+137) then
tmp = 1.0d0 / (x * n)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 4.5e-304) {
tmp = 0.0;
} else if (x <= 1.16e+137) {
tmp = 1.0 / (x * n);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 4.5e-304: tmp = 0.0 elif x <= 1.16e+137: tmp = 1.0 / (x * n) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 4.5e-304) tmp = 0.0; elseif (x <= 1.16e+137) tmp = Float64(1.0 / Float64(x * n)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 4.5e-304) tmp = 0.0; elseif (x <= 1.16e+137) tmp = 1.0 / (x * n); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 4.5e-304], 0.0, If[LessEqual[x, 1.16e+137], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{-304}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.16 \cdot 10^{+137}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 4.4999999999999998e-304 or 1.1599999999999999e137 < x Initial program 79.9%
Taylor expanded in x around inf 51.8%
log-rec51.8%
mul-1-neg51.8%
neg-mul-151.8%
mul-1-neg51.8%
distribute-frac-neg51.8%
remove-double-neg51.8%
*-rgt-identity51.8%
associate-/l*51.8%
exp-to-pow79.1%
Simplified79.1%
Taylor expanded in x around 0 81.0%
if 4.4999999999999998e-304 < x < 1.1599999999999999e137Initial program 44.2%
Taylor expanded in x around inf 49.0%
log-rec49.0%
mul-1-neg49.0%
neg-mul-149.0%
mul-1-neg49.0%
distribute-frac-neg49.0%
remove-double-neg49.0%
*-rgt-identity49.0%
associate-/l*49.0%
exp-to-pow49.0%
*-commutative49.0%
Simplified49.0%
Taylor expanded in n around inf 42.8%
Final simplification58.5%
(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 58.8%
Taylor expanded in x around inf 30.4%
log-rec30.4%
mul-1-neg30.4%
neg-mul-130.4%
mul-1-neg30.4%
distribute-frac-neg30.4%
remove-double-neg30.4%
*-rgt-identity30.4%
associate-/l*30.4%
exp-to-pow41.5%
Simplified41.5%
Taylor expanded in x around 0 42.5%
herbie shell --seed 2024180
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))