
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(if (<= x 35000.0)
(/
(log
(/
x
(exp
(+
(log1p x)
(/
(fma
0.5
(- (pow (log1p x) 2.0) (pow (log x) 2.0))
(*
0.16666666666666666
(/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n)))
n)))))
(- n))
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 35000.0) {
tmp = log((x / exp((log1p(x) + (fma(0.5, (pow(log1p(x), 2.0) - pow(log(x), 2.0)), (0.16666666666666666 * ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n))) / n))))) / -n;
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
function code(x, n) tmp = 0.0 if (x <= 35000.0) tmp = Float64(log(Float64(x / exp(Float64(log1p(x) + Float64(fma(0.5, Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)), Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n))) / n))))) / Float64(-n)); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
code[x_, n_] := If[LessEqual[x, 35000.0], N[(N[Log[N[(x / N[Exp[N[(N[Log[1 + x], $MachinePrecision] + N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 35000:\\
\;\;\;\;\frac{\log \left(\frac{x}{e^{\mathsf{log1p}\left(x\right) + \frac{\mathsf{fma}\left(0.5, {\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}, 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}\right)}{n}}}\right)}{-n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 35000Initial program 36.2%
Taylor expanded in n around -inf 84.5%
Simplified84.5%
add-log-exp89.2%
diff-log89.3%
fma-define89.3%
Applied egg-rr89.3%
if 35000 < x Initial program 68.0%
Taylor expanded in x around inf 96.9%
associate-/r*99.0%
mul-1-neg99.0%
log-rec99.0%
mul-1-neg99.0%
distribute-neg-frac99.0%
mul-1-neg99.0%
remove-double-neg99.0%
*-rgt-identity99.0%
associate-/l*99.0%
exp-to-pow99.0%
Simplified99.0%
Final simplification93.9%
(FPCore (x n)
:precision binary64
(if (<= x 28000.0)
(/
(-
(+
(log1p x)
(/
(+
(* 0.16666666666666666 (/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n))
(* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0))))
n))
(log x))
n)
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 28000.0) {
tmp = ((log1p(x) + (((0.16666666666666666 * ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n)) + (0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0)))) / n)) - log(x)) / n;
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (x <= 28000.0) {
tmp = ((Math.log1p(x) + (((0.16666666666666666 * ((Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0)) / n)) + (0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)))) / n)) - Math.log(x)) / n;
} else {
tmp = (Math.pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 28000.0: tmp = ((math.log1p(x) + (((0.16666666666666666 * ((math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0)) / n)) + (0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0)))) / n)) - math.log(x)) / n else: tmp = (math.pow(x, (1.0 / n)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 28000.0) tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n)) + Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)))) / n)) - log(x)) / n); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
code[x_, n_] := If[LessEqual[x, 28000.0], N[(N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 28000:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n} + 0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right)}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 28000Initial program 36.2%
Taylor expanded in n around -inf 84.5%
Simplified84.5%
if 28000 < x Initial program 68.0%
Taylor expanded in x around inf 96.9%
associate-/r*99.0%
mul-1-neg99.0%
log-rec99.0%
mul-1-neg99.0%
distribute-neg-frac99.0%
mul-1-neg99.0%
remove-double-neg99.0%
*-rgt-identity99.0%
associate-/l*99.0%
exp-to-pow99.0%
Simplified99.0%
Final simplification91.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0)))
(if (<= t_1 -4e-6)
(log (* E (exp (- (exp (/ (log x) n))))))
(if (<= t_1 2e-16)
(/ (log (/ (+ x 1.0) x)) 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 t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -4e-6) {
tmp = log((((double) M_E) * exp(-exp((log(x) / n)))));
} else if (t_1 <= 2e-16) {
tmp = log(((x + 1.0) / x)) / 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 t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -4e-6) {
tmp = Math.log((Math.E * Math.exp(-Math.exp((Math.log(x) / n)))));
} else if (t_1 <= 2e-16) {
tmp = Math.log(((x + 1.0) / x)) / 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)) t_1 = math.pow((x + 1.0), (1.0 / n)) - t_0 tmp = 0 if t_1 <= -4e-6: tmp = math.log((math.e * math.exp(-math.exp((math.log(x) / n))))) elif t_1 <= 2e-16: tmp = math.log(((x + 1.0) / x)) / 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) t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0) tmp = 0.0 if (t_1 <= -4e-6) tmp = log(Float64(exp(1) * exp(Float64(-exp(Float64(log(x) / n)))))); elseif (t_1 <= 2e-16) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / 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]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-6], N[Log[N[(E * N[Exp[(-N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 2e-16], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $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)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-6}:\\
\;\;\;\;\log \left(e \cdot e^{-e^{\frac{\log x}{n}}}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\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 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -3.99999999999999982e-6Initial program 98.5%
sub-neg98.5%
+-commutative98.5%
add-log-exp98.5%
add-log-exp98.5%
sum-log98.7%
pow-to-exp98.7%
un-div-inv98.7%
+-commutative98.7%
log1p-define98.7%
Applied egg-rr98.7%
Taylor expanded in x around 0 98.7%
if -3.99999999999999982e-6 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 2e-16Initial program 45.7%
Taylor expanded in n around inf 79.3%
log1p-define79.3%
Simplified79.3%
log1p-undefine79.3%
diff-log79.4%
Applied egg-rr79.4%
+-commutative79.4%
Simplified79.4%
if 2e-16 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 46.1%
add-cbrt-cube46.1%
pow1/346.1%
pow346.1%
pow-to-exp46.1%
un-div-inv46.1%
+-commutative46.1%
log1p-define95.9%
Applied egg-rr95.9%
Final simplification83.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0)))
(if (<= t_1 -4e-6)
(log (* E (exp (- (exp (/ (log x) n))))))
(if (<= t_1 2e-16)
(/ (log (/ (+ x 1.0) x)) n)
(exp (log (- (exp (/ (log1p x) n)) t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -4e-6) {
tmp = log((((double) M_E) * exp(-exp((log(x) / n)))));
} else if (t_1 <= 2e-16) {
tmp = log(((x + 1.0) / x)) / 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 t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -4e-6) {
tmp = Math.log((Math.E * Math.exp(-Math.exp((Math.log(x) / n)))));
} else if (t_1 <= 2e-16) {
tmp = Math.log(((x + 1.0) / x)) / 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)) t_1 = math.pow((x + 1.0), (1.0 / n)) - t_0 tmp = 0 if t_1 <= -4e-6: tmp = math.log((math.e * math.exp(-math.exp((math.log(x) / n))))) elif t_1 <= 2e-16: tmp = math.log(((x + 1.0) / x)) / 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) t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0) tmp = 0.0 if (t_1 <= -4e-6) tmp = log(Float64(exp(1) * exp(Float64(-exp(Float64(log(x) / n)))))); elseif (t_1 <= 2e-16) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / 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]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-6], N[Log[N[(E * N[Exp[(-N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 2e-16], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $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)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-6}:\\
\;\;\;\;\log \left(e \cdot e^{-e^{\frac{\log x}{n}}}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\log \left(e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\right)}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -3.99999999999999982e-6Initial program 98.5%
sub-neg98.5%
+-commutative98.5%
add-log-exp98.5%
add-log-exp98.5%
sum-log98.7%
pow-to-exp98.7%
un-div-inv98.7%
+-commutative98.7%
log1p-define98.7%
Applied egg-rr98.7%
Taylor expanded in x around 0 98.7%
if -3.99999999999999982e-6 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 2e-16Initial program 45.7%
Taylor expanded in n around inf 79.3%
log1p-define79.3%
Simplified79.3%
log1p-undefine79.3%
diff-log79.4%
Applied egg-rr79.4%
+-commutative79.4%
Simplified79.4%
if 2e-16 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 46.1%
add-exp-log46.1%
pow-to-exp46.1%
un-div-inv46.1%
+-commutative46.1%
log1p-define95.9%
Applied egg-rr95.9%
Final simplification83.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0)))
(if (<= t_1 -1e-8)
(log (exp (- 1.0 t_0)))
(if (<= t_1 2e-16)
(/ (log (/ (+ x 1.0) x)) n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -1e-8) {
tmp = log(exp((1.0 - t_0)));
} else if (t_1 <= 2e-16) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -1e-8) {
tmp = Math.log(Math.exp((1.0 - t_0)));
} else if (t_1 <= 2e-16) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.pow((x + 1.0), (1.0 / n)) - t_0 tmp = 0 if t_1 <= -1e-8: tmp = math.log(math.exp((1.0 - t_0))) elif t_1 <= 2e-16: tmp = math.log(((x + 1.0) / x)) / n else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0) tmp = 0.0 if (t_1 <= -1e-8) tmp = log(exp(Float64(1.0 - t_0))); elseif (t_1 <= 2e-16) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-8], N[Log[N[Exp[N[(1.0 - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 2e-16], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-8}:\\
\;\;\;\;\log \left(e^{1 - t\_0}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -1e-8Initial program 97.2%
sub-neg97.2%
+-commutative97.2%
add-log-exp97.2%
add-log-exp97.2%
sum-log97.3%
pow-to-exp97.3%
un-div-inv97.3%
+-commutative97.3%
log1p-define97.3%
Applied egg-rr97.3%
Taylor expanded in x around 0 97.3%
*-commutative97.3%
prod-exp97.3%
*-rgt-identity97.3%
associate-*r/97.3%
exp-to-pow97.3%
+-commutative97.3%
sub-neg97.3%
Simplified97.3%
if -1e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 2e-16Initial program 45.6%
Taylor expanded in n around inf 79.4%
log1p-define79.4%
Simplified79.4%
log1p-undefine79.4%
diff-log79.5%
Applied egg-rr79.5%
+-commutative79.5%
Simplified79.5%
if 2e-16 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 46.1%
Taylor expanded in n around 0 46.1%
log1p-define95.9%
*-rgt-identity95.9%
associate-*l/95.9%
associate-/l*95.9%
exp-to-pow95.9%
Simplified95.9%
Final simplification83.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0)))
(if (<= t_1 -4e-6)
(log (* E (exp (- (exp (/ (log x) n))))))
(if (<= t_1 2e-16)
(/ (log (/ (+ x 1.0) x)) n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -4e-6) {
tmp = log((((double) M_E) * exp(-exp((log(x) / n)))));
} else if (t_1 <= 2e-16) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -4e-6) {
tmp = Math.log((Math.E * Math.exp(-Math.exp((Math.log(x) / n)))));
} else if (t_1 <= 2e-16) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.pow((x + 1.0), (1.0 / n)) - t_0 tmp = 0 if t_1 <= -4e-6: tmp = math.log((math.e * math.exp(-math.exp((math.log(x) / n))))) elif t_1 <= 2e-16: tmp = math.log(((x + 1.0) / x)) / n else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0) tmp = 0.0 if (t_1 <= -4e-6) tmp = log(Float64(exp(1) * exp(Float64(-exp(Float64(log(x) / n)))))); elseif (t_1 <= 2e-16) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-6], N[Log[N[(E * N[Exp[(-N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 2e-16], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-6}:\\
\;\;\;\;\log \left(e \cdot e^{-e^{\frac{\log x}{n}}}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -3.99999999999999982e-6Initial program 98.5%
sub-neg98.5%
+-commutative98.5%
add-log-exp98.5%
add-log-exp98.5%
sum-log98.7%
pow-to-exp98.7%
un-div-inv98.7%
+-commutative98.7%
log1p-define98.7%
Applied egg-rr98.7%
Taylor expanded in x around 0 98.7%
if -3.99999999999999982e-6 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 2e-16Initial program 45.7%
Taylor expanded in n around inf 79.3%
log1p-define79.3%
Simplified79.3%
log1p-undefine79.3%
diff-log79.4%
Applied egg-rr79.4%
+-commutative79.4%
Simplified79.4%
if 2e-16 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 46.1%
Taylor expanded in n around 0 46.1%
log1p-define95.9%
*-rgt-identity95.9%
associate-*l/95.9%
associate-/l*95.9%
exp-to-pow95.9%
Simplified95.9%
Final simplification83.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0)))
(if (<= t_1 -1e-8)
(- 1.0 t_0)
(if (<= t_1 2e-16)
(/ (log (/ (+ x 1.0) x)) n)
(-
(+ 1.0 (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))))
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -1e-8) {
tmp = 1.0 - t_0;
} else if (t_1 <= 2e-16) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = ((x + 1.0d0) ** (1.0d0 / n)) - t_0
if (t_1 <= (-1d-8)) then
tmp = 1.0d0 - t_0
else if (t_1 <= 2d-16) then
tmp = log(((x + 1.0d0) / x)) / n
else
tmp = (1.0d0 + (x * ((1.0d0 / n) + (((x * (-0.5d0)) + (0.5d0 * (x / n))) / n)))) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -1e-8) {
tmp = 1.0 - t_0;
} else if (t_1 <= 2e-16) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.pow((x + 1.0), (1.0 / n)) - t_0 tmp = 0 if t_1 <= -1e-8: tmp = 1.0 - t_0 elif t_1 <= 2e-16: tmp = math.log(((x + 1.0) / x)) / n else: tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0) tmp = 0.0 if (t_1 <= -1e-8) tmp = Float64(1.0 - t_0); elseif (t_1 <= 2e-16) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n)))) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = ((x + 1.0) ^ (1.0 / n)) - t_0; tmp = 0.0; if (t_1 <= -1e-8) tmp = 1.0 - t_0; elseif (t_1 <= 2e-16) tmp = log(((x + 1.0) / x)) / n; else tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-8], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 2e-16], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-8}:\\
\;\;\;\;1 - t\_0\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - t\_0\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -1e-8Initial program 97.2%
Taylor expanded in x around 0 97.2%
*-rgt-identity97.2%
associate-*l/97.2%
associate-/l*97.2%
exp-to-pow97.2%
Simplified97.2%
if -1e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 2e-16Initial program 45.6%
Taylor expanded in n around inf 79.4%
log1p-define79.4%
Simplified79.4%
log1p-undefine79.4%
diff-log79.5%
Applied egg-rr79.5%
+-commutative79.5%
Simplified79.5%
if 2e-16 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 46.1%
Taylor expanded in x around 0 72.5%
Taylor expanded in n around inf 72.5%
Final simplification80.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0)))
(if (<= t_1 -1e-8)
(log (exp (- 1.0 t_0)))
(if (<= t_1 2e-16)
(/ (log (/ (+ x 1.0) x)) n)
(-
(+ 1.0 (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))))
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -1e-8) {
tmp = log(exp((1.0 - t_0)));
} else if (t_1 <= 2e-16) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = ((x + 1.0d0) ** (1.0d0 / n)) - t_0
if (t_1 <= (-1d-8)) then
tmp = log(exp((1.0d0 - t_0)))
else if (t_1 <= 2d-16) then
tmp = log(((x + 1.0d0) / x)) / n
else
tmp = (1.0d0 + (x * ((1.0d0 / n) + (((x * (-0.5d0)) + (0.5d0 * (x / n))) / n)))) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -1e-8) {
tmp = Math.log(Math.exp((1.0 - t_0)));
} else if (t_1 <= 2e-16) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.pow((x + 1.0), (1.0 / n)) - t_0 tmp = 0 if t_1 <= -1e-8: tmp = math.log(math.exp((1.0 - t_0))) elif t_1 <= 2e-16: tmp = math.log(((x + 1.0) / x)) / n else: tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0) tmp = 0.0 if (t_1 <= -1e-8) tmp = log(exp(Float64(1.0 - t_0))); elseif (t_1 <= 2e-16) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n)))) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = ((x + 1.0) ^ (1.0 / n)) - t_0; tmp = 0.0; if (t_1 <= -1e-8) tmp = log(exp((1.0 - t_0))); elseif (t_1 <= 2e-16) tmp = log(((x + 1.0) / x)) / n; else tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-8], N[Log[N[Exp[N[(1.0 - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 2e-16], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-8}:\\
\;\;\;\;\log \left(e^{1 - t\_0}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - t\_0\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -1e-8Initial program 97.2%
sub-neg97.2%
+-commutative97.2%
add-log-exp97.2%
add-log-exp97.2%
sum-log97.3%
pow-to-exp97.3%
un-div-inv97.3%
+-commutative97.3%
log1p-define97.3%
Applied egg-rr97.3%
Taylor expanded in x around 0 97.3%
*-commutative97.3%
prod-exp97.3%
*-rgt-identity97.3%
associate-*r/97.3%
exp-to-pow97.3%
+-commutative97.3%
sub-neg97.3%
Simplified97.3%
if -1e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 2e-16Initial program 45.6%
Taylor expanded in n around inf 79.4%
log1p-define79.4%
Simplified79.4%
log1p-undefine79.4%
diff-log79.5%
Applied egg-rr79.5%
+-commutative79.5%
Simplified79.5%
if 2e-16 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 46.1%
Taylor expanded in x around 0 72.5%
Taylor expanded in n around inf 72.5%
Final simplification80.5%
(FPCore (x n)
:precision binary64
(if (<= x 0.0003)
(/
(-
(/
(+
(* -0.16666666666666666 (/ (pow (log x) 3.0) n))
(* (pow (log x) 2.0) -0.5))
n)
(log x))
n)
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 0.0003) {
tmp = ((((-0.16666666666666666 * (pow(log(x), 3.0) / n)) + (pow(log(x), 2.0) * -0.5)) / n) - log(x)) / n;
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.0003d0) then
tmp = (((((-0.16666666666666666d0) * ((log(x) ** 3.0d0) / n)) + ((log(x) ** 2.0d0) * (-0.5d0))) / n) - log(x)) / n
else
tmp = ((x ** (1.0d0 / n)) / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.0003) {
tmp = ((((-0.16666666666666666 * (Math.pow(Math.log(x), 3.0) / n)) + (Math.pow(Math.log(x), 2.0) * -0.5)) / n) - Math.log(x)) / n;
} else {
tmp = (Math.pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.0003: tmp = ((((-0.16666666666666666 * (math.pow(math.log(x), 3.0) / n)) + (math.pow(math.log(x), 2.0) * -0.5)) / n) - math.log(x)) / n else: tmp = (math.pow(x, (1.0 / n)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 0.0003) tmp = Float64(Float64(Float64(Float64(Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) / n)) + Float64((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.0003) tmp = ((((-0.16666666666666666 * ((log(x) ^ 3.0) / n)) + ((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n; else tmp = ((x ^ (1.0 / n)) / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.0003], N[(N[(N[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0003:\\
\;\;\;\;\frac{\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} + {\log x}^{2} \cdot -0.5}{n} - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 2.99999999999999974e-4Initial program 35.4%
Taylor expanded in x around 0 34.7%
*-rgt-identity34.7%
associate-*l/34.7%
associate-/l*34.7%
exp-to-pow34.7%
Simplified34.7%
Taylor expanded in n around -inf 84.0%
mul-1-neg84.0%
Simplified84.0%
if 2.99999999999999974e-4 < x Initial program 67.3%
Taylor expanded in x around inf 95.2%
associate-/r*97.2%
mul-1-neg97.2%
log-rec97.2%
mul-1-neg97.2%
distribute-neg-frac97.2%
mul-1-neg97.2%
remove-double-neg97.2%
*-rgt-identity97.2%
associate-/l*97.2%
exp-to-pow97.2%
Simplified97.2%
Final simplification90.6%
(FPCore (x n)
:precision binary64
(let* ((t_0
(/ (/ (+ 1.0 (/ (- (* 0.3333333333333333 (/ 1.0 x)) 0.5) x)) x) n))
(t_1 (pow x (/ 1.0 n)))
(t_2 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= (/ 1.0 n) -0.2)
(/ (/ t_1 n) x)
(if (<= (/ 1.0 n) 1e-142)
t_2
(if (<= (/ 1.0 n) 1e-78)
t_0
(if (<= (/ 1.0 n) 5e-19)
t_2
(if (<= (/ 1.0 n) 5e+131) (+ (- 1.0 t_1) (/ x n)) t_0)))))))
double code(double x, double n) {
double t_0 = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
double t_1 = pow(x, (1.0 / n));
double t_2 = log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -0.2) {
tmp = (t_1 / n) / x;
} else if ((1.0 / n) <= 1e-142) {
tmp = t_2;
} else if ((1.0 / n) <= 1e-78) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-19) {
tmp = t_2;
} else if ((1.0 / n) <= 5e+131) {
tmp = (1.0 - t_1) + (x / n);
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = ((1.0d0 + (((0.3333333333333333d0 * (1.0d0 / x)) - 0.5d0) / x)) / x) / n
t_1 = x ** (1.0d0 / n)
t_2 = log(((x + 1.0d0) / x)) / n
if ((1.0d0 / n) <= (-0.2d0)) then
tmp = (t_1 / n) / x
else if ((1.0d0 / n) <= 1d-142) then
tmp = t_2
else if ((1.0d0 / n) <= 1d-78) then
tmp = t_0
else if ((1.0d0 / n) <= 5d-19) then
tmp = t_2
else if ((1.0d0 / n) <= 5d+131) then
tmp = (1.0d0 - t_1) + (x / n)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
double t_1 = Math.pow(x, (1.0 / n));
double t_2 = Math.log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -0.2) {
tmp = (t_1 / n) / x;
} else if ((1.0 / n) <= 1e-142) {
tmp = t_2;
} else if ((1.0 / n) <= 1e-78) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-19) {
tmp = t_2;
} else if ((1.0 / n) <= 5e+131) {
tmp = (1.0 - t_1) + (x / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n t_1 = math.pow(x, (1.0 / n)) t_2 = math.log(((x + 1.0) / x)) / n tmp = 0 if (1.0 / n) <= -0.2: tmp = (t_1 / n) / x elif (1.0 / n) <= 1e-142: tmp = t_2 elif (1.0 / n) <= 1e-78: tmp = t_0 elif (1.0 / n) <= 5e-19: tmp = t_2 elif (1.0 / n) <= 5e+131: tmp = (1.0 - t_1) + (x / n) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 0.5) / x)) / x) / n) t_1 = x ^ Float64(1.0 / n) t_2 = Float64(log(Float64(Float64(x + 1.0) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.2) tmp = Float64(Float64(t_1 / n) / x); elseif (Float64(1.0 / n) <= 1e-142) tmp = t_2; elseif (Float64(1.0 / n) <= 1e-78) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-19) tmp = t_2; elseif (Float64(1.0 / n) <= 5e+131) tmp = Float64(Float64(1.0 - t_1) + Float64(x / n)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n; t_1 = x ^ (1.0 / n); t_2 = log(((x + 1.0) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -0.2) tmp = (t_1 / n) / x; elseif ((1.0 / n) <= 1e-142) tmp = t_2; elseif ((1.0 / n) <= 1e-78) tmp = t_0; elseif ((1.0 / n) <= 5e-19) tmp = t_2; elseif ((1.0 / n) <= 5e+131) tmp = (1.0 - t_1) + (x / n); else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.2], N[(N[(t$95$1 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-142], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-78], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-19], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+131], N[(N[(1.0 - t$95$1), $MachinePrecision] + N[(x / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -0.2:\\
\;\;\;\;\frac{\frac{t\_1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-142}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-19}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+131}:\\
\;\;\;\;\left(1 - t\_1\right) + \frac{x}{n}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -0.20000000000000001Initial program 98.5%
Taylor expanded in x around inf 99.9%
associate-/r*99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.9%
exp-to-pow99.9%
Simplified99.9%
if -0.20000000000000001 < (/.f64 #s(literal 1 binary64) n) < 1e-142 or 9.99999999999999999e-79 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000004e-19Initial program 34.1%
Taylor expanded in n around inf 79.4%
log1p-define79.4%
Simplified79.4%
log1p-undefine79.4%
diff-log79.5%
Applied egg-rr79.5%
+-commutative79.5%
Simplified79.5%
if 1e-142 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999999e-79 or 4.99999999999999995e131 < (/.f64 #s(literal 1 binary64) n) Initial program 26.0%
Taylor expanded in n around inf 30.0%
log1p-define30.0%
Simplified30.0%
Taylor expanded in x around -inf 77.6%
if 5.0000000000000004e-19 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999995e131Initial program 78.4%
sub-neg78.4%
+-commutative78.4%
add-log-exp78.0%
add-log-exp78.0%
sum-log77.8%
pow-to-exp77.8%
un-div-inv77.8%
+-commutative77.8%
log1p-define83.8%
Applied egg-rr83.8%
Taylor expanded in x around 0 72.0%
prod-exp72.0%
sub-neg72.0%
rem-log-exp72.5%
*-rgt-identity72.5%
associate-*r/72.5%
exp-to-pow72.5%
Simplified72.5%
Final simplification83.8%
(FPCore (x n)
:precision binary64
(let* ((t_0
(/ (/ (+ 1.0 (/ (- (* 0.3333333333333333 (/ 1.0 x)) 0.5) x)) x) n))
(t_1 (pow x (/ 1.0 n)))
(t_2 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= (/ 1.0 n) -0.2)
(/ (/ t_1 n) x)
(if (<= (/ 1.0 n) 1e-142)
t_2
(if (<= (/ 1.0 n) 1e-78)
t_0
(if (<= (/ 1.0 n) 2e-8)
t_2
(if (<= (/ 1.0 n) 5e+131) (- 1.0 t_1) t_0)))))))
double code(double x, double n) {
double t_0 = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
double t_1 = pow(x, (1.0 / n));
double t_2 = log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -0.2) {
tmp = (t_1 / n) / x;
} else if ((1.0 / n) <= 1e-142) {
tmp = t_2;
} else if ((1.0 / n) <= 1e-78) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-8) {
tmp = t_2;
} else if ((1.0 / n) <= 5e+131) {
tmp = 1.0 - t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = ((1.0d0 + (((0.3333333333333333d0 * (1.0d0 / x)) - 0.5d0) / x)) / x) / n
t_1 = x ** (1.0d0 / n)
t_2 = log(((x + 1.0d0) / x)) / n
if ((1.0d0 / n) <= (-0.2d0)) then
tmp = (t_1 / n) / x
else if ((1.0d0 / n) <= 1d-142) then
tmp = t_2
else if ((1.0d0 / n) <= 1d-78) then
tmp = t_0
else if ((1.0d0 / n) <= 2d-8) then
tmp = t_2
else if ((1.0d0 / n) <= 5d+131) then
tmp = 1.0d0 - t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
double t_1 = Math.pow(x, (1.0 / n));
double t_2 = Math.log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -0.2) {
tmp = (t_1 / n) / x;
} else if ((1.0 / n) <= 1e-142) {
tmp = t_2;
} else if ((1.0 / n) <= 1e-78) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-8) {
tmp = t_2;
} else if ((1.0 / n) <= 5e+131) {
tmp = 1.0 - t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n t_1 = math.pow(x, (1.0 / n)) t_2 = math.log(((x + 1.0) / x)) / n tmp = 0 if (1.0 / n) <= -0.2: tmp = (t_1 / n) / x elif (1.0 / n) <= 1e-142: tmp = t_2 elif (1.0 / n) <= 1e-78: tmp = t_0 elif (1.0 / n) <= 2e-8: tmp = t_2 elif (1.0 / n) <= 5e+131: tmp = 1.0 - t_1 else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 0.5) / x)) / x) / n) t_1 = x ^ Float64(1.0 / n) t_2 = Float64(log(Float64(Float64(x + 1.0) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.2) tmp = Float64(Float64(t_1 / n) / x); elseif (Float64(1.0 / n) <= 1e-142) tmp = t_2; elseif (Float64(1.0 / n) <= 1e-78) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-8) tmp = t_2; elseif (Float64(1.0 / n) <= 5e+131) tmp = Float64(1.0 - t_1); else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n; t_1 = x ^ (1.0 / n); t_2 = log(((x + 1.0) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -0.2) tmp = (t_1 / n) / x; elseif ((1.0 / n) <= 1e-142) tmp = t_2; elseif ((1.0 / n) <= 1e-78) tmp = t_0; elseif ((1.0 / n) <= 2e-8) tmp = t_2; elseif ((1.0 / n) <= 5e+131) tmp = 1.0 - t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.2], N[(N[(t$95$1 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-142], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-78], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+131], N[(1.0 - t$95$1), $MachinePrecision], t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -0.2:\\
\;\;\;\;\frac{\frac{t\_1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-142}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+131}:\\
\;\;\;\;1 - t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -0.20000000000000001Initial program 98.5%
Taylor expanded in x around inf 99.9%
associate-/r*99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.9%
exp-to-pow99.9%
Simplified99.9%
if -0.20000000000000001 < (/.f64 #s(literal 1 binary64) n) < 1e-142 or 9.99999999999999999e-79 < (/.f64 #s(literal 1 binary64) n) < 2e-8Initial program 34.1%
Taylor expanded in n around inf 78.7%
log1p-define78.7%
Simplified78.7%
log1p-undefine78.7%
diff-log78.9%
Applied egg-rr78.9%
+-commutative78.9%
Simplified78.9%
if 1e-142 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999999e-79 or 4.99999999999999995e131 < (/.f64 #s(literal 1 binary64) n) Initial program 26.0%
Taylor expanded in n around inf 30.0%
log1p-define30.0%
Simplified30.0%
Taylor expanded in x around -inf 77.6%
if 2e-8 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999995e131Initial program 84.9%
Taylor expanded in x around 0 78.0%
*-rgt-identity78.0%
associate-*l/78.0%
associate-/l*78.0%
exp-to-pow78.0%
Simplified78.0%
Final simplification83.8%
(FPCore (x n)
:precision binary64
(let* ((t_0
(/ (/ (+ 1.0 (/ (- (* 0.3333333333333333 (/ 1.0 x)) 0.5) x)) x) n))
(t_1 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= (/ 1.0 n) 1e-142)
t_1
(if (<= (/ 1.0 n) 1e-78)
t_0
(if (<= (/ 1.0 n) 2e-8)
t_1
(if (<= (/ 1.0 n) 5e+131) (- 1.0 (pow x (/ 1.0 n))) t_0))))))
double code(double x, double n) {
double t_0 = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
double t_1 = log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= 1e-142) {
tmp = t_1;
} else if ((1.0 / n) <= 1e-78) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-8) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+131) {
tmp = 1.0 - pow(x, (1.0 / n));
} 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) :: t_1
real(8) :: tmp
t_0 = ((1.0d0 + (((0.3333333333333333d0 * (1.0d0 / x)) - 0.5d0) / x)) / x) / n
t_1 = log(((x + 1.0d0) / x)) / n
if ((1.0d0 / n) <= 1d-142) then
tmp = t_1
else if ((1.0d0 / n) <= 1d-78) then
tmp = t_0
else if ((1.0d0 / n) <= 2d-8) then
tmp = t_1
else if ((1.0d0 / n) <= 5d+131) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
double t_1 = Math.log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= 1e-142) {
tmp = t_1;
} else if ((1.0 / n) <= 1e-78) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-8) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+131) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n t_1 = math.log(((x + 1.0) / x)) / n tmp = 0 if (1.0 / n) <= 1e-142: tmp = t_1 elif (1.0 / n) <= 1e-78: tmp = t_0 elif (1.0 / n) <= 2e-8: tmp = t_1 elif (1.0 / n) <= 5e+131: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 0.5) / x)) / x) / n) t_1 = Float64(log(Float64(Float64(x + 1.0) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= 1e-142) tmp = t_1; elseif (Float64(1.0 / n) <= 1e-78) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-8) tmp = t_1; elseif (Float64(1.0 / n) <= 5e+131) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n; t_1 = log(((x + 1.0) / x)) / n; tmp = 0.0; if ((1.0 / n) <= 1e-142) tmp = t_1; elseif ((1.0 / n) <= 1e-78) tmp = t_0; elseif ((1.0 / n) <= 2e-8) tmp = t_1; elseif ((1.0 / n) <= 5e+131) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-142], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-78], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+131], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}\\
t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+131}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < 1e-142 or 9.99999999999999999e-79 < (/.f64 #s(literal 1 binary64) n) < 2e-8Initial program 54.5%
Taylor expanded in n around inf 72.2%
log1p-define72.2%
Simplified72.2%
log1p-undefine72.2%
diff-log72.3%
Applied egg-rr72.3%
+-commutative72.3%
Simplified72.3%
if 1e-142 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999999e-79 or 4.99999999999999995e131 < (/.f64 #s(literal 1 binary64) n) Initial program 26.0%
Taylor expanded in n around inf 30.0%
log1p-define30.0%
Simplified30.0%
Taylor expanded in x around -inf 77.6%
if 2e-8 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999995e131Initial program 84.9%
Taylor expanded in x around 0 78.0%
*-rgt-identity78.0%
associate-*l/78.0%
associate-/l*78.0%
exp-to-pow78.0%
Simplified78.0%
Final simplification73.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))) (t_1 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x 1.85e-266)
t_0
(if (<= x 5.4e-217)
t_1
(if (<= x 1.4e-176)
t_0
(if (<= x 9e-152)
t_1
(if (<= x 0.88)
(- (/ x n) (/ (log x) n))
(if (<= x 7.4e+135)
(/
(/
(+
1.0
(/
(- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5)
x))
x)
n)
0.0))))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double t_1 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= 1.85e-266) {
tmp = t_0;
} else if (x <= 5.4e-217) {
tmp = t_1;
} else if (x <= 1.4e-176) {
tmp = t_0;
} else if (x <= 9e-152) {
tmp = t_1;
} else if (x <= 0.88) {
tmp = (x / n) - (log(x) / n);
} else if (x <= 7.4e+135) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = log(x) / -n
t_1 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= 1.85d-266) then
tmp = t_0
else if (x <= 5.4d-217) then
tmp = t_1
else if (x <= 1.4d-176) then
tmp = t_0
else if (x <= 9d-152) then
tmp = t_1
else if (x <= 0.88d0) then
tmp = (x / n) - (log(x) / n)
else if (x <= 7.4d+135) then
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double t_1 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if (x <= 1.85e-266) {
tmp = t_0;
} else if (x <= 5.4e-217) {
tmp = t_1;
} else if (x <= 1.4e-176) {
tmp = t_0;
} else if (x <= 9e-152) {
tmp = t_1;
} else if (x <= 0.88) {
tmp = (x / n) - (Math.log(x) / n);
} else if (x <= 7.4e+135) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n t_1 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if x <= 1.85e-266: tmp = t_0 elif x <= 5.4e-217: tmp = t_1 elif x <= 1.4e-176: tmp = t_0 elif x <= 9e-152: tmp = t_1 elif x <= 0.88: tmp = (x / n) - (math.log(x) / n) elif x <= 7.4e+135: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) t_1 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (x <= 1.85e-266) tmp = t_0; elseif (x <= 5.4e-217) tmp = t_1; elseif (x <= 1.4e-176) tmp = t_0; elseif (x <= 9e-152) tmp = t_1; elseif (x <= 0.88) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); elseif (x <= 7.4e+135) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; t_1 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= 1.85e-266) tmp = t_0; elseif (x <= 5.4e-217) tmp = t_1; elseif (x <= 1.4e-176) tmp = t_0; elseif (x <= 9e-152) tmp = t_1; elseif (x <= 0.88) tmp = (x / n) - (log(x) / n); elseif (x <= 7.4e+135) tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.85e-266], t$95$0, If[LessEqual[x, 5.4e-217], t$95$1, If[LessEqual[x, 1.4e-176], t$95$0, If[LessEqual[x, 9e-152], t$95$1, If[LessEqual[x, 0.88], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.4e+135], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 1.85 \cdot 10^{-266}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{-217}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-176}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-152}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{+135}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.8500000000000001e-266 or 5.40000000000000032e-217 < x < 1.4000000000000001e-176Initial program 20.8%
Taylor expanded in x around 0 20.8%
*-rgt-identity20.8%
associate-*l/20.8%
associate-/l*20.8%
exp-to-pow20.8%
Simplified20.8%
Taylor expanded in n around inf 72.3%
mul-1-neg72.3%
Simplified72.3%
if 1.8500000000000001e-266 < x < 5.40000000000000032e-217 or 1.4000000000000001e-176 < x < 9.0000000000000008e-152Initial program 64.6%
Taylor expanded in x around 0 64.6%
*-rgt-identity64.6%
associate-*l/64.6%
associate-/l*64.6%
exp-to-pow64.6%
Simplified64.6%
if 9.0000000000000008e-152 < x < 0.880000000000000004Initial program 30.3%
Taylor expanded in n around inf 59.2%
log1p-define59.2%
Simplified59.2%
Taylor expanded in x around 0 58.2%
+-commutative58.2%
mul-1-neg58.2%
unsub-neg58.2%
Simplified58.2%
if 0.880000000000000004 < x < 7.39999999999999994e135Initial program 46.7%
Taylor expanded in n around inf 49.3%
log1p-define49.3%
Simplified49.3%
Taylor expanded in x around -inf 71.5%
if 7.39999999999999994e135 < x Initial program 81.6%
sub-neg81.6%
+-commutative81.6%
add-log-exp81.6%
add-log-exp81.6%
sum-log81.6%
pow-to-exp81.6%
un-div-inv81.6%
+-commutative81.6%
log1p-define81.6%
Applied egg-rr81.6%
Taylor expanded in x around inf 81.6%
exp-neg81.6%
rgt-mult-inverse81.6%
metadata-eval81.6%
Simplified81.6%
Final simplification70.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))) (t_1 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x 5.2e-267)
t_0
(if (<= x 1.32e-216)
t_1
(if (<= x 1.15e-176)
t_0
(if (<= x 9e-152)
t_1
(if (<= x 0.88)
(/ (- x (log x)) n)
(if (<= x 4.9e+135)
(/
(/
(+
1.0
(/
(- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5)
x))
x)
n)
0.0))))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double t_1 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= 5.2e-267) {
tmp = t_0;
} else if (x <= 1.32e-216) {
tmp = t_1;
} else if (x <= 1.15e-176) {
tmp = t_0;
} else if (x <= 9e-152) {
tmp = t_1;
} else if (x <= 0.88) {
tmp = (x - log(x)) / n;
} else if (x <= 4.9e+135) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = log(x) / -n
t_1 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= 5.2d-267) then
tmp = t_0
else if (x <= 1.32d-216) then
tmp = t_1
else if (x <= 1.15d-176) then
tmp = t_0
else if (x <= 9d-152) then
tmp = t_1
else if (x <= 0.88d0) then
tmp = (x - log(x)) / n
else if (x <= 4.9d+135) then
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double t_1 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if (x <= 5.2e-267) {
tmp = t_0;
} else if (x <= 1.32e-216) {
tmp = t_1;
} else if (x <= 1.15e-176) {
tmp = t_0;
} else if (x <= 9e-152) {
tmp = t_1;
} else if (x <= 0.88) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 4.9e+135) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n t_1 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if x <= 5.2e-267: tmp = t_0 elif x <= 1.32e-216: tmp = t_1 elif x <= 1.15e-176: tmp = t_0 elif x <= 9e-152: tmp = t_1 elif x <= 0.88: tmp = (x - math.log(x)) / n elif x <= 4.9e+135: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) t_1 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (x <= 5.2e-267) tmp = t_0; elseif (x <= 1.32e-216) tmp = t_1; elseif (x <= 1.15e-176) tmp = t_0; elseif (x <= 9e-152) tmp = t_1; elseif (x <= 0.88) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 4.9e+135) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; t_1 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= 5.2e-267) tmp = t_0; elseif (x <= 1.32e-216) tmp = t_1; elseif (x <= 1.15e-176) tmp = t_0; elseif (x <= 9e-152) tmp = t_1; elseif (x <= 0.88) tmp = (x - log(x)) / n; elseif (x <= 4.9e+135) tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 5.2e-267], t$95$0, If[LessEqual[x, 1.32e-216], t$95$1, If[LessEqual[x, 1.15e-176], t$95$0, If[LessEqual[x, 9e-152], t$95$1, If[LessEqual[x, 0.88], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 4.9e+135], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 5.2 \cdot 10^{-267}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{-216}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-176}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-152}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{+135}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 5.2000000000000003e-267 or 1.31999999999999997e-216 < x < 1.1500000000000001e-176Initial program 20.8%
Taylor expanded in x around 0 20.8%
*-rgt-identity20.8%
associate-*l/20.8%
associate-/l*20.8%
exp-to-pow20.8%
Simplified20.8%
Taylor expanded in n around inf 72.3%
mul-1-neg72.3%
Simplified72.3%
if 5.2000000000000003e-267 < x < 1.31999999999999997e-216 or 1.1500000000000001e-176 < x < 9.0000000000000008e-152Initial program 64.6%
Taylor expanded in x around 0 64.6%
*-rgt-identity64.6%
associate-*l/64.6%
associate-/l*64.6%
exp-to-pow64.6%
Simplified64.6%
if 9.0000000000000008e-152 < x < 0.880000000000000004Initial program 30.3%
Taylor expanded in n around inf 59.2%
log1p-define59.2%
Simplified59.2%
Taylor expanded in x around 0 58.2%
if 0.880000000000000004 < x < 4.9000000000000001e135Initial program 46.7%
Taylor expanded in n around inf 49.3%
log1p-define49.3%
Simplified49.3%
Taylor expanded in x around -inf 71.5%
if 4.9000000000000001e135 < x Initial program 81.6%
sub-neg81.6%
+-commutative81.6%
add-log-exp81.6%
add-log-exp81.6%
sum-log81.6%
pow-to-exp81.6%
un-div-inv81.6%
+-commutative81.6%
log1p-define81.6%
Applied egg-rr81.6%
Taylor expanded in x around inf 81.6%
exp-neg81.6%
rgt-mult-inverse81.6%
metadata-eval81.6%
Simplified81.6%
Final simplification70.0%
(FPCore (x n)
:precision binary64
(if (<= x 2.9e-183)
(/ (log x) (- n))
(if (<= x 3.4e-160)
(/
(+
(/ 1.0 n)
(/ (+ (* 0.3333333333333333 (/ 1.0 (* x n))) (* 0.5 (/ -1.0 n))) x))
x)
(if (<= x 0.88)
(/ (- x (log x)) n)
(if (<= x 8.4e+135)
(/
(/
(+
1.0
(/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
x)
n)
0.0)))))
double code(double x, double n) {
double tmp;
if (x <= 2.9e-183) {
tmp = log(x) / -n;
} else if (x <= 3.4e-160) {
tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x;
} else if (x <= 0.88) {
tmp = (x - log(x)) / n;
} else if (x <= 8.4e+135) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2.9d-183) then
tmp = log(x) / -n
else if (x <= 3.4d-160) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 * (1.0d0 / (x * n))) + (0.5d0 * ((-1.0d0) / n))) / x)) / x
else if (x <= 0.88d0) then
tmp = (x - log(x)) / n
else if (x <= 8.4d+135) then
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.9e-183) {
tmp = Math.log(x) / -n;
} else if (x <= 3.4e-160) {
tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x;
} else if (x <= 0.88) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 8.4e+135) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.9e-183: tmp = math.log(x) / -n elif x <= 3.4e-160: tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x elif x <= 0.88: tmp = (x - math.log(x)) / n elif x <= 8.4e+135: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 2.9e-183) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 3.4e-160) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / Float64(x * n))) + Float64(0.5 * Float64(-1.0 / n))) / x)) / x); elseif (x <= 0.88) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 8.4e+135) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.9e-183) tmp = log(x) / -n; elseif (x <= 3.4e-160) tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x; elseif (x <= 0.88) tmp = (x - log(x)) / n; elseif (x <= 8.4e+135) tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.9e-183], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 3.4e-160], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 * N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 8.4e+135], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.9 \cdot 10^{-183}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-160}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{0.3333333333333333 \cdot \frac{1}{x \cdot n} + 0.5 \cdot \frac{-1}{n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 8.4 \cdot 10^{+135}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.9e-183Initial program 39.6%
Taylor expanded in x around 0 39.6%
*-rgt-identity39.6%
associate-*l/39.6%
associate-/l*39.6%
exp-to-pow39.6%
Simplified39.6%
Taylor expanded in n around inf 61.3%
mul-1-neg61.3%
Simplified61.3%
if 2.9e-183 < x < 3.40000000000000021e-160Initial program 44.8%
Taylor expanded in n around inf 26.3%
log1p-define26.3%
Simplified26.3%
Taylor expanded in x around -inf 65.2%
if 3.40000000000000021e-160 < x < 0.880000000000000004Initial program 33.1%
Taylor expanded in n around inf 57.4%
log1p-define57.4%
Simplified57.4%
Taylor expanded in x around 0 56.5%
if 0.880000000000000004 < x < 8.40000000000000039e135Initial program 46.7%
Taylor expanded in n around inf 49.3%
log1p-define49.3%
Simplified49.3%
Taylor expanded in x around -inf 71.5%
if 8.40000000000000039e135 < x Initial program 81.6%
sub-neg81.6%
+-commutative81.6%
add-log-exp81.6%
add-log-exp81.6%
sum-log81.6%
pow-to-exp81.6%
un-div-inv81.6%
+-commutative81.6%
log1p-define81.6%
Applied egg-rr81.6%
Taylor expanded in x around inf 81.6%
exp-neg81.6%
rgt-mult-inverse81.6%
metadata-eval81.6%
Simplified81.6%
Final simplification68.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))))
(if (<= x 2.9e-183)
t_0
(if (<= x 2.05e-160)
(/
(+
(/ 1.0 n)
(/ (+ (* 0.3333333333333333 (/ 1.0 (* x n))) (* 0.5 (/ -1.0 n))) x))
x)
(if (<= x 0.7)
t_0
(if (<= x 7e+135)
(/
(/
(+
1.0
(/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
x)
n)
0.0))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double tmp;
if (x <= 2.9e-183) {
tmp = t_0;
} else if (x <= 2.05e-160) {
tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x;
} else if (x <= 0.7) {
tmp = t_0;
} else if (x <= 7e+135) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = log(x) / -n
if (x <= 2.9d-183) then
tmp = t_0
else if (x <= 2.05d-160) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 * (1.0d0 / (x * n))) + (0.5d0 * ((-1.0d0) / n))) / x)) / x
else if (x <= 0.7d0) then
tmp = t_0
else if (x <= 7d+135) then
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double tmp;
if (x <= 2.9e-183) {
tmp = t_0;
} else if (x <= 2.05e-160) {
tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x;
} else if (x <= 0.7) {
tmp = t_0;
} else if (x <= 7e+135) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n tmp = 0 if x <= 2.9e-183: tmp = t_0 elif x <= 2.05e-160: tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x elif x <= 0.7: tmp = t_0 elif x <= 7e+135: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) tmp = 0.0 if (x <= 2.9e-183) tmp = t_0; elseif (x <= 2.05e-160) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / Float64(x * n))) + Float64(0.5 * Float64(-1.0 / n))) / x)) / x); elseif (x <= 0.7) tmp = t_0; elseif (x <= 7e+135) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; tmp = 0.0; if (x <= 2.9e-183) tmp = t_0; elseif (x <= 2.05e-160) tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x; elseif (x <= 0.7) tmp = t_0; elseif (x <= 7e+135) tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 2.9e-183], t$95$0, If[LessEqual[x, 2.05e-160], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 * N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.7], t$95$0, If[LessEqual[x, 7e+135], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 2.9 \cdot 10^{-183}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{-160}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{0.3333333333333333 \cdot \frac{1}{x \cdot n} + 0.5 \cdot \frac{-1}{n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+135}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.9e-183 or 2.05000000000000001e-160 < x < 0.69999999999999996Initial program 35.7%
Taylor expanded in x around 0 34.9%
*-rgt-identity34.9%
associate-*l/34.9%
associate-/l*34.9%
exp-to-pow34.9%
Simplified34.9%
Taylor expanded in n around inf 58.0%
mul-1-neg58.0%
Simplified58.0%
if 2.9e-183 < x < 2.05000000000000001e-160Initial program 44.8%
Taylor expanded in n around inf 26.3%
log1p-define26.3%
Simplified26.3%
Taylor expanded in x around -inf 65.2%
if 0.69999999999999996 < x < 7.0000000000000005e135Initial program 46.7%
Taylor expanded in n around inf 49.3%
log1p-define49.3%
Simplified49.3%
Taylor expanded in x around -inf 71.5%
if 7.0000000000000005e135 < x Initial program 81.6%
sub-neg81.6%
+-commutative81.6%
add-log-exp81.6%
add-log-exp81.6%
sum-log81.6%
pow-to-exp81.6%
un-div-inv81.6%
+-commutative81.6%
log1p-define81.6%
Applied egg-rr81.6%
Taylor expanded in x around inf 81.6%
exp-neg81.6%
rgt-mult-inverse81.6%
metadata-eval81.6%
Simplified81.6%
Final simplification67.8%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -50000000.0)
0.0
(/
(+
(/ 1.0 n)
(/ (+ (* 0.3333333333333333 (/ 1.0 (* x n))) (* 0.5 (/ -1.0 n))) x))
x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -50000000.0) {
tmp = 0.0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / 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) <= (-50000000.0d0)) then
tmp = 0.0d0
else
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 * (1.0d0 / (x * n))) + (0.5d0 * ((-1.0d0) / n))) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -50000000.0) {
tmp = 0.0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -50000000.0: tmp = 0.0 else: tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -50000000.0) tmp = 0.0; else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / Float64(x * n))) + Float64(0.5 * Float64(-1.0 / n))) / x)) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -50000000.0) tmp = 0.0; else tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -50000000.0], 0.0, N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 * N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -50000000:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{0.3333333333333333 \cdot \frac{1}{x \cdot n} + 0.5 \cdot \frac{-1}{n}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5e7Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
add-log-exp100.0%
add-log-exp100.0%
sum-log100.0%
pow-to-exp100.0%
un-div-inv100.0%
+-commutative100.0%
log1p-define100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 59.7%
exp-neg59.7%
rgt-mult-inverse60.3%
metadata-eval60.3%
Simplified60.3%
if -5e7 < (/.f64 #s(literal 1 binary64) n) Initial program 35.8%
Taylor expanded in n around inf 62.5%
log1p-define62.5%
Simplified62.5%
Taylor expanded in x around -inf 53.2%
Final simplification54.9%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -50000000.0) 0.0 (/ (/ (+ 1.0 (/ (- (* 0.3333333333333333 (/ 1.0 x)) 0.5) x)) x) n)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -50000000.0) {
tmp = 0.0;
} else {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= (-50000000.0d0)) then
tmp = 0.0d0
else
tmp = ((1.0d0 + (((0.3333333333333333d0 * (1.0d0 / x)) - 0.5d0) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -50000000.0) {
tmp = 0.0;
} else {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -50000000.0: tmp = 0.0 else: tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -50000000.0) tmp = 0.0; else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 0.5) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -50000000.0) tmp = 0.0; else tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -50000000.0], 0.0, N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -50000000:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5e7Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
add-log-exp100.0%
add-log-exp100.0%
sum-log100.0%
pow-to-exp100.0%
un-div-inv100.0%
+-commutative100.0%
log1p-define100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 59.7%
exp-neg59.7%
rgt-mult-inverse60.3%
metadata-eval60.3%
Simplified60.3%
if -5e7 < (/.f64 #s(literal 1 binary64) n) Initial program 35.8%
Taylor expanded in n around inf 62.5%
log1p-define62.5%
Simplified62.5%
Taylor expanded in x around -inf 53.2%
Final simplification54.9%
(FPCore (x n) :precision binary64 (if (or (<= n -2.4) (not (<= n -2.8e-293))) (/ 1.0 (* x n)) 0.0))
double code(double x, double n) {
double tmp;
if ((n <= -2.4) || !(n <= -2.8e-293)) {
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 ((n <= (-2.4d0)) .or. (.not. (n <= (-2.8d-293)))) 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 ((n <= -2.4) || !(n <= -2.8e-293)) {
tmp = 1.0 / (x * n);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if (n <= -2.4) or not (n <= -2.8e-293): tmp = 1.0 / (x * n) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if ((n <= -2.4) || !(n <= -2.8e-293)) 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 ((n <= -2.4) || ~((n <= -2.8e-293))) tmp = 1.0 / (x * n); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[Or[LessEqual[n, -2.4], N[Not[LessEqual[n, -2.8e-293]], $MachinePrecision]], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.4 \lor \neg \left(n \leq -2.8 \cdot 10^{-293}\right):\\
\;\;\;\;\frac{1}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -2.39999999999999991 or -2.80000000000000025e-293 < n Initial program 36.8%
Taylor expanded in x around inf 45.3%
mul-1-neg45.3%
log-rec45.3%
mul-1-neg45.3%
distribute-neg-frac45.3%
mul-1-neg45.3%
remove-double-neg45.3%
*-commutative45.3%
Simplified45.3%
Taylor expanded in n around inf 49.0%
*-commutative49.0%
Simplified49.0%
if -2.39999999999999991 < n < -2.80000000000000025e-293Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
add-log-exp100.0%
add-log-exp100.0%
sum-log100.0%
pow-to-exp100.0%
un-div-inv100.0%
+-commutative100.0%
log1p-define100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 61.0%
exp-neg61.0%
rgt-mult-inverse61.6%
metadata-eval61.6%
Simplified61.6%
Final simplification51.9%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -50000000.0) 0.0 (/ (/ 1.0 x) n)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -50000000.0) {
tmp = 0.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) :: tmp
if ((1.0d0 / n) <= (-50000000.0d0)) then
tmp = 0.0d0
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) <= -50000000.0) {
tmp = 0.0;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -50000000.0: tmp = 0.0 else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -50000000.0) tmp = 0.0; else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -50000000.0) tmp = 0.0; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -50000000.0], 0.0, N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -50000000:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5e7Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
add-log-exp100.0%
add-log-exp100.0%
sum-log100.0%
pow-to-exp100.0%
un-div-inv100.0%
+-commutative100.0%
log1p-define100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 59.7%
exp-neg59.7%
rgt-mult-inverse60.3%
metadata-eval60.3%
Simplified60.3%
if -5e7 < (/.f64 #s(literal 1 binary64) n) Initial program 35.8%
Taylor expanded in n around inf 62.5%
log1p-define62.5%
Simplified62.5%
Taylor expanded in x around inf 50.1%
Final simplification52.6%
(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 51.3%
sub-neg51.3%
+-commutative51.3%
add-log-exp51.3%
add-log-exp51.3%
sum-log51.3%
pow-to-exp51.3%
un-div-inv51.3%
+-commutative51.3%
log1p-define58.5%
Applied egg-rr58.5%
Taylor expanded in x around inf 34.2%
exp-neg34.1%
rgt-mult-inverse34.3%
metadata-eval34.3%
Simplified34.3%
Final simplification34.3%
herbie shell --seed 2024075
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))