
(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 14000000.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)
(* (/ 1.0 x) (/ (pow x (/ 1.0 n)) n))))
double code(double x, double n) {
double tmp;
if (x <= 14000000.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 = (1.0 / x) * (pow(x, (1.0 / n)) / n);
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (x <= 14000000.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 = (1.0 / x) * (Math.pow(x, (1.0 / n)) / n);
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 14000000.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 = (1.0 / x) * (math.pow(x, (1.0 / n)) / n) return tmp
function code(x, n) tmp = 0.0 if (x <= 14000000.0) tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(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)) - log(x)) / n); else tmp = Float64(Float64(1.0 / x) * Float64((x ^ Float64(1.0 / n)) / n)); end return tmp end
code[x_, n_] := If[LessEqual[x, 14000000.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[(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] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] * N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 14000000:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\\
\end{array}
\end{array}
if x < 1.4e7Initial program 48.1%
Taylor expanded in n around -inf 77.9%
Simplified77.9%
if 1.4e7 < x Initial program 71.8%
Taylor expanded in x around inf 97.5%
mul-1-neg97.5%
log-rec97.5%
mul-1-neg97.5%
distribute-neg-frac97.5%
mul-1-neg97.5%
remove-double-neg97.5%
*-commutative97.5%
Simplified97.5%
div-inv97.5%
pow-to-exp97.5%
*-un-lft-identity97.5%
times-frac98.7%
Applied egg-rr98.7%
Final simplification87.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -2e-10)
(log (exp t_0))
(if (<= (/ 1.0 n) 5e-17)
(/ (log (/ (+ x 1.0) x)) n)
(pow (pow t_0 6.0) 0.16666666666666666)))))
double code(double x, double n) {
double t_0 = exp((log1p(x) / n)) - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-10) {
tmp = log(exp(t_0));
} else if ((1.0 / n) <= 5e-17) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = pow(pow(t_0, 6.0), 0.16666666666666666);
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-10) {
tmp = Math.log(Math.exp(t_0));
} else if ((1.0 / n) <= 5e-17) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = Math.pow(Math.pow(t_0, 6.0), 0.16666666666666666);
}
return tmp;
}
def code(x, n): t_0 = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-10: tmp = math.log(math.exp(t_0)) elif (1.0 / n) <= 5e-17: tmp = math.log(((x + 1.0) / x)) / n else: tmp = math.pow(math.pow(t_0, 6.0), 0.16666666666666666) return tmp
function code(x, n) t_0 = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -2e-10) tmp = log(exp(t_0)); elseif (Float64(1.0 / n) <= 5e-17) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = (t_0 ^ 6.0) ^ 0.16666666666666666; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-10], N[Log[N[Exp[t$95$0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-17], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[Power[N[Power[t$95$0, 6.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-10}:\\
\;\;\;\;\log \left(e^{t\_0}\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;{\left({t\_0}^{6}\right)}^{0.16666666666666666}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000007e-10Initial program 99.5%
add-log-exp99.5%
pow-to-exp99.5%
un-div-inv99.5%
+-commutative99.5%
log1p-define99.5%
Applied egg-rr99.5%
if -2.00000000000000007e-10 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999999e-17Initial program 35.0%
Taylor expanded in n around inf 78.5%
log1p-define78.5%
Simplified78.5%
log1p-undefine78.5%
diff-log78.8%
Applied egg-rr78.8%
if 4.9999999999999999e-17 < (/.f64 #s(literal 1 binary64) n) Initial program 70.2%
add-log-exp69.0%
pow-to-exp69.0%
un-div-inv69.0%
+-commutative69.0%
log1p-define90.1%
Applied egg-rr90.1%
rem-log-exp93.2%
rem-cbrt-cube93.1%
unpow1/393.2%
metadata-eval93.2%
pow-prod-up93.2%
pow-prod-down93.2%
pow-prod-up93.2%
metadata-eval93.2%
Applied egg-rr93.2%
Final simplification87.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -2e-10)
(log (exp t_0))
(if (<= (/ 1.0 n) 5e-17)
(/ (log (/ (+ x 1.0) x)) n)
(pow (pow t_0 3.0) 0.3333333333333333)))))
double code(double x, double n) {
double t_0 = exp((log1p(x) / n)) - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-10) {
tmp = log(exp(t_0));
} else if ((1.0 / n) <= 5e-17) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = pow(pow(t_0, 3.0), 0.3333333333333333);
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-10) {
tmp = Math.log(Math.exp(t_0));
} else if ((1.0 / n) <= 5e-17) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = Math.pow(Math.pow(t_0, 3.0), 0.3333333333333333);
}
return tmp;
}
def code(x, n): t_0 = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-10: tmp = math.log(math.exp(t_0)) elif (1.0 / n) <= 5e-17: tmp = math.log(((x + 1.0) / x)) / n else: tmp = math.pow(math.pow(t_0, 3.0), 0.3333333333333333) return tmp
function code(x, n) t_0 = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -2e-10) tmp = log(exp(t_0)); elseif (Float64(1.0 / n) <= 5e-17) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = (t_0 ^ 3.0) ^ 0.3333333333333333; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-10], N[Log[N[Exp[t$95$0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-17], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[Power[N[Power[t$95$0, 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-10}:\\
\;\;\;\;\log \left(e^{t\_0}\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;{\left({t\_0}^{3}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000007e-10Initial program 99.5%
add-log-exp99.5%
pow-to-exp99.5%
un-div-inv99.5%
+-commutative99.5%
log1p-define99.5%
Applied egg-rr99.5%
if -2.00000000000000007e-10 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999999e-17Initial program 35.0%
Taylor expanded in n around inf 78.5%
log1p-define78.5%
Simplified78.5%
log1p-undefine78.5%
diff-log78.8%
Applied egg-rr78.8%
if 4.9999999999999999e-17 < (/.f64 #s(literal 1 binary64) n) Initial program 70.2%
add-cbrt-cube70.2%
pow1/370.2%
pow370.2%
pow-to-exp70.2%
un-div-inv70.2%
+-commutative70.2%
log1p-define93.2%
Applied egg-rr93.2%
Final simplification87.0%
(FPCore (x n)
:precision binary64
(if (<= x 0.64)
(/
(-
(/
(+
(* -0.16666666666666666 (/ (pow (log x) 3.0) n))
(* (pow (log x) 2.0) -0.5))
n)
(log x))
n)
(* (/ 1.0 x) (/ (pow x (/ 1.0 n)) n))))
double code(double x, double n) {
double tmp;
if (x <= 0.64) {
tmp = ((((-0.16666666666666666 * (pow(log(x), 3.0) / n)) + (pow(log(x), 2.0) * -0.5)) / n) - log(x)) / n;
} else {
tmp = (1.0 / x) * (pow(x, (1.0 / n)) / n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.64d0) then
tmp = (((((-0.16666666666666666d0) * ((log(x) ** 3.0d0) / n)) + ((log(x) ** 2.0d0) * (-0.5d0))) / n) - log(x)) / n
else
tmp = (1.0d0 / x) * ((x ** (1.0d0 / n)) / n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.64) {
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 = (1.0 / x) * (Math.pow(x, (1.0 / n)) / n);
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.64: 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 = (1.0 / x) * (math.pow(x, (1.0 / n)) / n) return tmp
function code(x, n) tmp = 0.0 if (x <= 0.64) 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(1.0 / x) * Float64((x ^ Float64(1.0 / n)) / n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.64) tmp = ((((-0.16666666666666666 * ((log(x) ^ 3.0) / n)) + ((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n; else tmp = (1.0 / x) * ((x ^ (1.0 / n)) / n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.64], 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[(1.0 / x), $MachinePrecision] * N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.64:\\
\;\;\;\;\frac{\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} + {\log x}^{2} \cdot -0.5}{n} - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\\
\end{array}
\end{array}
if x < 0.640000000000000013Initial program 48.5%
Taylor expanded in x around 0 48.2%
Taylor expanded in n around -inf 75.9%
mul-1-neg75.9%
Simplified75.9%
if 0.640000000000000013 < x Initial program 71.2%
Taylor expanded in x around inf 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%
*-commutative97.2%
Simplified97.2%
div-inv97.2%
pow-to-exp97.2%
*-un-lft-identity97.2%
times-frac98.4%
Applied egg-rr98.4%
Final simplification86.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -2e-10)
(log (exp t_0))
(if (<= (/ 1.0 n) 5e-17) (/ (log (/ (+ x 1.0) x)) n) t_0))))
double code(double x, double n) {
double t_0 = exp((log1p(x) / n)) - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-10) {
tmp = log(exp(t_0));
} else if ((1.0 / n) <= 5e-17) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-10) {
tmp = Math.log(Math.exp(t_0));
} else if ((1.0 / n) <= 5e-17) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-10: tmp = math.log(math.exp(t_0)) elif (1.0 / n) <= 5e-17: tmp = math.log(((x + 1.0) / x)) / n else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -2e-10) tmp = log(exp(t_0)); elseif (Float64(1.0 / n) <= 5e-17) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = t_0; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-10], N[Log[N[Exp[t$95$0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-17], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-10}:\\
\;\;\;\;\log \left(e^{t\_0}\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000007e-10Initial program 99.5%
add-log-exp99.5%
pow-to-exp99.5%
un-div-inv99.5%
+-commutative99.5%
log1p-define99.5%
Applied egg-rr99.5%
if -2.00000000000000007e-10 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999999e-17Initial program 35.0%
Taylor expanded in n around inf 78.5%
log1p-define78.5%
Simplified78.5%
log1p-undefine78.5%
diff-log78.8%
Applied egg-rr78.8%
if 4.9999999999999999e-17 < (/.f64 #s(literal 1 binary64) n) Initial program 70.2%
Taylor expanded in n around 0 70.2%
log1p-define93.2%
Simplified93.2%
Final simplification87.0%
(FPCore (x n) :precision binary64 (if (or (<= n -23000000000.0) (not (<= n 27500.0))) (/ (log (/ (+ x 1.0) x)) n) (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))))
double code(double x, double n) {
double tmp;
if ((n <= -23000000000.0) || !(n <= 27500.0)) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((n <= -23000000000.0) || !(n <= 27500.0)) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): tmp = 0 if (n <= -23000000000.0) or not (n <= 27500.0): tmp = math.log(((x + 1.0) / x)) / n else: tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) tmp = 0.0 if ((n <= -23000000000.0) || !(n <= 27500.0)) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := If[Or[LessEqual[n, -23000000000.0], N[Not[LessEqual[n, 27500.0]], $MachinePrecision]], 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] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -23000000000 \lor \neg \left(n \leq 27500\right):\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if n < -2.3e10 or 27500 < n Initial program 34.6%
Taylor expanded in n around inf 77.6%
log1p-define77.6%
Simplified77.6%
log1p-undefine77.6%
diff-log77.9%
Applied egg-rr77.9%
if -2.3e10 < n < 27500Initial program 93.6%
Taylor expanded in n around 0 93.6%
log1p-define99.5%
Simplified99.5%
Final simplification87.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-10)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(if (<= (/ 1.0 n) 2000000000000.0)
(/ (log (/ (+ x 1.0) x)) n)
(-
(+
(*
x
(+
(/ 1.0 n)
(* x (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n))))))
1.0)
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-10) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 2000000000000.0) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = ((x * ((1.0 / n) + (x * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n)))))) + 1.0) - 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) <= (-2d-10)) then
tmp = ((x + 1.0d0) ** (1.0d0 / n)) - t_0
else if ((1.0d0 / n) <= 2000000000000.0d0) then
tmp = log(((x + 1.0d0) / x)) / n
else
tmp = ((x * ((1.0d0 / n) + (x * ((0.5d0 * (1.0d0 / (n ** 2.0d0))) + (0.5d0 * ((-1.0d0) / n)))))) + 1.0d0) - 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) <= -2e-10) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 2000000000000.0) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = ((x * ((1.0 / n) + (x * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n)))))) + 1.0) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-10: tmp = math.pow((x + 1.0), (1.0 / n)) - t_0 elif (1.0 / n) <= 2000000000000.0: tmp = math.log(((x + 1.0) / x)) / n else: tmp = ((x * ((1.0 / n) + (x * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n)))))) + 1.0) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-10) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); elseif (Float64(1.0 / n) <= 2000000000000.0) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(Float64(Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n)))))) + 1.0) - 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) <= -2e-10) tmp = ((x + 1.0) ^ (1.0 / n)) - t_0; elseif ((1.0 / n) <= 2000000000000.0) tmp = log(((x + 1.0) / x)) / n; else tmp = ((x * ((1.0 / n) + (x * ((0.5 * (1.0 / (n ^ 2.0))) + (0.5 * (-1.0 / n)))))) + 1.0) - 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], -2e-10], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2000000000000.0], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(x * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-10}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2000000000000:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right) + 1\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000007e-10Initial program 99.5%
if -2.00000000000000007e-10 < (/.f64 #s(literal 1 binary64) n) < 2e12Initial program 34.7%
Taylor expanded in n around inf 77.1%
log1p-define77.1%
Simplified77.1%
log1p-undefine77.1%
diff-log77.4%
Applied egg-rr77.4%
if 2e12 < (/.f64 #s(literal 1 binary64) n) Initial program 76.4%
Taylor expanded in x around 0 84.5%
Final simplification85.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-10)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(if (<= (/ 1.0 n) 2000000000000.0)
(/ (log (/ (+ x 1.0) x)) n)
(- (+ (/ x n) 1.0) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-10) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 2000000000000.0) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = ((x / n) + 1.0) - 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) <= (-2d-10)) then
tmp = ((x + 1.0d0) ** (1.0d0 / n)) - t_0
else if ((1.0d0 / n) <= 2000000000000.0d0) then
tmp = log(((x + 1.0d0) / x)) / n
else
tmp = ((x / n) + 1.0d0) - 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) <= -2e-10) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 2000000000000.0) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = ((x / n) + 1.0) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-10: tmp = math.pow((x + 1.0), (1.0 / n)) - t_0 elif (1.0 / n) <= 2000000000000.0: tmp = math.log(((x + 1.0) / x)) / n else: tmp = ((x / n) + 1.0) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-10) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); elseif (Float64(1.0 / n) <= 2000000000000.0) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(Float64(Float64(x / n) + 1.0) - 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) <= -2e-10) tmp = ((x + 1.0) ^ (1.0 / n)) - t_0; elseif ((1.0 / n) <= 2000000000000.0) tmp = log(((x + 1.0) / x)) / n; else tmp = ((x / n) + 1.0) - 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], -2e-10], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2000000000000.0], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-10}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2000000000000:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000007e-10Initial program 99.5%
if -2.00000000000000007e-10 < (/.f64 #s(literal 1 binary64) n) < 2e12Initial program 34.7%
Taylor expanded in n around inf 77.1%
log1p-define77.1%
Simplified77.1%
log1p-undefine77.1%
diff-log77.4%
Applied egg-rr77.4%
if 2e12 < (/.f64 #s(literal 1 binary64) n) Initial program 76.4%
Taylor expanded in x around 0 80.5%
Final simplification84.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-83)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 2000000000000.0)
(/ (log (/ (+ x 1.0) x)) n)
(- (+ (/ x n) 1.0) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-83) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2000000000000.0) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = ((x / n) + 1.0) - 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) <= (-5d-83)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 2000000000000.0d0) then
tmp = log(((x + 1.0d0) / x)) / n
else
tmp = ((x / n) + 1.0d0) - 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) <= -5e-83) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2000000000000.0) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = ((x / n) + 1.0) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-83: tmp = (t_0 / n) / x elif (1.0 / n) <= 2000000000000.0: tmp = math.log(((x + 1.0) / x)) / n else: tmp = ((x / n) + 1.0) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-83) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 2000000000000.0) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(Float64(Float64(x / n) + 1.0) - 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) <= -5e-83) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 2000000000000.0) tmp = log(((x + 1.0) / x)) / n; else tmp = ((x / n) + 1.0) - 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], -5e-83], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2000000000000.0], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $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 -5 \cdot 10^{-83}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2000000000000:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5e-83Initial program 89.4%
Taylor expanded in x around inf 92.8%
mul-1-neg92.8%
log-rec92.8%
mul-1-neg92.8%
distribute-neg-frac92.8%
mul-1-neg92.8%
remove-double-neg92.8%
*-commutative92.8%
Simplified92.8%
div-inv92.8%
pow-to-exp92.8%
*-un-lft-identity92.8%
times-frac93.0%
Applied egg-rr93.0%
associate-*l/93.0%
*-un-lft-identity93.0%
Applied egg-rr93.0%
if -5e-83 < (/.f64 #s(literal 1 binary64) n) < 2e12Initial program 35.5%
Taylor expanded in n around inf 79.2%
log1p-define79.2%
Simplified79.2%
log1p-undefine79.2%
diff-log79.5%
Applied egg-rr79.5%
if 2e12 < (/.f64 #s(literal 1 binary64) n) Initial program 76.4%
Taylor expanded in x around 0 80.5%
Final simplification84.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-83)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 2000000000000.0)
(/ (log (/ (+ x 1.0) x)) n)
(- 1.0 t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-83) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2000000000000.0) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = 1.0 - 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) <= (-5d-83)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 2000000000000.0d0) then
tmp = log(((x + 1.0d0) / x)) / n
else
tmp = 1.0d0 - 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) <= -5e-83) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2000000000000.0) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = 1.0 - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-83: tmp = (t_0 / n) / x elif (1.0 / n) <= 2000000000000.0: tmp = math.log(((x + 1.0) / x)) / n else: tmp = 1.0 - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-83) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 2000000000000.0) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(1.0 - 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) <= -5e-83) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 2000000000000.0) tmp = log(((x + 1.0) / x)) / n; else tmp = 1.0 - 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], -5e-83], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2000000000000.0], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(1.0 - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-83}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2000000000000:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;1 - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5e-83Initial program 89.4%
Taylor expanded in x around inf 92.8%
mul-1-neg92.8%
log-rec92.8%
mul-1-neg92.8%
distribute-neg-frac92.8%
mul-1-neg92.8%
remove-double-neg92.8%
*-commutative92.8%
Simplified92.8%
div-inv92.8%
pow-to-exp92.8%
*-un-lft-identity92.8%
times-frac93.0%
Applied egg-rr93.0%
associate-*l/93.0%
*-un-lft-identity93.0%
Applied egg-rr93.0%
if -5e-83 < (/.f64 #s(literal 1 binary64) n) < 2e12Initial program 35.5%
Taylor expanded in n around inf 79.2%
log1p-define79.2%
Simplified79.2%
log1p-undefine79.2%
diff-log79.5%
Applied egg-rr79.5%
if 2e12 < (/.f64 #s(literal 1 binary64) n) Initial program 76.4%
Taylor expanded in x around 0 76.4%
Final simplification84.2%
(FPCore (x n)
:precision binary64
(if (<= x 9.2e-248)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.85)
(/ (- x (log x)) n)
(if (<= x 2.15e+167)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x)
0.0))))
double code(double x, double n) {
double tmp;
if (x <= 9.2e-248) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.85) {
tmp = (x - log(x)) / n;
} else if (x <= 2.15e+167) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 9.2d-248) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.85d0) then
tmp = (x - log(x)) / n
else if (x <= 2.15d+167) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) - (0.5d0 / n)) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 9.2e-248) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.85) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 2.15e+167) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 9.2e-248: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.85: tmp = (x - math.log(x)) / n elif x <= 2.15e+167: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 9.2e-248) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.85) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 2.15e+167) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) - Float64(0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 9.2e-248) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.85) tmp = (x - log(x)) / n; elseif (x <= 2.15e+167) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 9.2e-248], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.85], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 2.15e+167], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.2 \cdot 10^{-248}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.85:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{+167}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 9.2000000000000001e-248Initial program 65.9%
Taylor expanded in x around 0 65.9%
if 9.2000000000000001e-248 < x < 0.849999999999999978Initial program 44.4%
Taylor expanded in n around inf 57.3%
log1p-define57.3%
Simplified57.3%
Taylor expanded in x around 0 55.5%
if 0.849999999999999978 < x < 2.1500000000000001e167Initial program 49.1%
Taylor expanded in n around inf 48.8%
log1p-define48.8%
Simplified48.8%
Taylor expanded in x around -inf 71.0%
mul-1-neg71.0%
mul-1-neg71.0%
associate-*r/71.0%
metadata-eval71.0%
*-commutative71.0%
associate-*r/71.0%
metadata-eval71.0%
Simplified71.0%
if 2.1500000000000001e167 < x Initial program 93.4%
Taylor expanded in x around 0 57.2%
Taylor expanded in n around inf 93.4%
metadata-eval93.4%
Applied egg-rr93.4%
Final simplification69.4%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) 2000000000000.0) (/ (log (/ (+ x 1.0) x)) n) (- 1.0 (pow x (/ 1.0 n)))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2000000000000.0) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = 1.0 - pow(x, (1.0 / 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) <= 2000000000000.0d0) then
tmp = log(((x + 1.0d0) / x)) / n
else
tmp = 1.0d0 - (x ** (1.0d0 / n))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2000000000000.0) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = 1.0 - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= 2000000000000.0: tmp = math.log(((x + 1.0) / x)) / n else: tmp = 1.0 - math.pow(x, (1.0 / n)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= 2000000000000.0) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= 2000000000000.0) tmp = log(((x + 1.0) / x)) / n; else tmp = 1.0 - (x ^ (1.0 / n)); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], 2000000000000.0], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq 2000000000000:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < 2e12Initial program 57.7%
Taylor expanded in n around inf 68.4%
log1p-define68.4%
Simplified68.4%
log1p-undefine68.4%
diff-log68.6%
Applied egg-rr68.6%
if 2e12 < (/.f64 #s(literal 1 binary64) n) Initial program 76.4%
Taylor expanded in x around 0 76.4%
Final simplification69.4%
(FPCore (x n)
:precision binary64
(if (<= x 0.85)
(/ (- x (log x)) n)
(if (<= x 2.7e+167)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.85) {
tmp = (x - log(x)) / n;
} else if (x <= 2.7e+167) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.85d0) then
tmp = (x - log(x)) / n
else if (x <= 2.7d+167) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) - (0.5d0 / n)) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.85) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 2.7e+167) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.85: tmp = (x - math.log(x)) / n elif x <= 2.7e+167: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.85) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 2.7e+167) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) - Float64(0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.85) tmp = (x - log(x)) / n; elseif (x <= 2.7e+167) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.85], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 2.7e+167], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.85:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+167}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.849999999999999978Initial program 48.5%
Taylor expanded in n around inf 54.2%
log1p-define54.2%
Simplified54.2%
Taylor expanded in x around 0 52.7%
if 0.849999999999999978 < x < 2.70000000000000005e167Initial program 49.1%
Taylor expanded in n around inf 48.8%
log1p-define48.8%
Simplified48.8%
Taylor expanded in x around -inf 71.0%
mul-1-neg71.0%
mul-1-neg71.0%
associate-*r/71.0%
metadata-eval71.0%
*-commutative71.0%
associate-*r/71.0%
metadata-eval71.0%
Simplified71.0%
if 2.70000000000000005e167 < x Initial program 93.4%
Taylor expanded in x around 0 57.2%
Taylor expanded in n around inf 93.4%
metadata-eval93.4%
Applied egg-rr93.4%
Final simplification67.0%
(FPCore (x n)
:precision binary64
(if (<= x 0.62)
(/ (log x) (- n))
(if (<= x 2.4e+167)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.62) {
tmp = log(x) / -n;
} else if (x <= 2.4e+167) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.62d0) then
tmp = log(x) / -n
else if (x <= 2.4d+167) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) - (0.5d0 / n)) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.62) {
tmp = Math.log(x) / -n;
} else if (x <= 2.4e+167) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.62: tmp = math.log(x) / -n elif x <= 2.4e+167: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.62) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 2.4e+167) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) - Float64(0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.62) tmp = log(x) / -n; elseif (x <= 2.4e+167) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.62], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 2.4e+167], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.62:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+167}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.619999999999999996Initial program 48.5%
Taylor expanded in x around 0 48.2%
Taylor expanded in n around inf 52.1%
associate-*r/52.1%
neg-mul-152.1%
Simplified52.1%
if 0.619999999999999996 < x < 2.39999999999999999e167Initial program 49.1%
Taylor expanded in n around inf 48.8%
log1p-define48.8%
Simplified48.8%
Taylor expanded in x around -inf 71.0%
mul-1-neg71.0%
mul-1-neg71.0%
associate-*r/71.0%
metadata-eval71.0%
*-commutative71.0%
associate-*r/71.0%
metadata-eval71.0%
Simplified71.0%
if 2.39999999999999999e167 < x Initial program 93.4%
Taylor expanded in x around 0 57.2%
Taylor expanded in n around inf 93.4%
metadata-eval93.4%
Applied egg-rr93.4%
Final simplification66.7%
(FPCore (x n) :precision binary64 (if (<= x 2.35e+167) (/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 2.35e+167) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2.35d+167) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) - (0.5d0 / n)) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.35e+167) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.35e+167: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 2.35e+167) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) - Float64(0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.35e+167) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.35e+167], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.35 \cdot 10^{+167}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.35000000000000006e167Initial program 48.7%
Taylor expanded in n around inf 52.5%
log1p-define52.5%
Simplified52.5%
Taylor expanded in x around -inf 44.6%
mul-1-neg44.6%
mul-1-neg44.6%
associate-*r/44.6%
metadata-eval44.6%
*-commutative44.6%
associate-*r/44.6%
metadata-eval44.6%
Simplified44.6%
if 2.35000000000000006e167 < x Initial program 93.4%
Taylor expanded in x around 0 57.2%
Taylor expanded in n around inf 93.4%
metadata-eval93.4%
Applied egg-rr93.4%
Final simplification56.4%
(FPCore (x n) :precision binary64 (if (<= n -1.85e-29) (/ 1.0 (* x (+ n (* 0.5 (/ n x))))) (if (<= n -2.3e-226) 0.0 (/ (/ 1.0 x) n))))
double code(double x, double n) {
double tmp;
if (n <= -1.85e-29) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if (n <= -2.3e-226) {
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 (n <= (-1.85d-29)) then
tmp = 1.0d0 / (x * (n + (0.5d0 * (n / x))))
else if (n <= (-2.3d-226)) 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 (n <= -1.85e-29) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if (n <= -2.3e-226) {
tmp = 0.0;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -1.85e-29: tmp = 1.0 / (x * (n + (0.5 * (n / x)))) elif n <= -2.3e-226: tmp = 0.0 else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (n <= -1.85e-29) tmp = Float64(1.0 / Float64(x * Float64(n + Float64(0.5 * Float64(n / x))))); elseif (n <= -2.3e-226) 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 (n <= -1.85e-29) tmp = 1.0 / (x * (n + (0.5 * (n / x)))); elseif (n <= -2.3e-226) tmp = 0.0; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -1.85e-29], N[(1.0 / N[(x * N[(n + N[(0.5 * N[(n / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -2.3e-226], 0.0, N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.85 \cdot 10^{-29}:\\
\;\;\;\;\frac{1}{x \cdot \left(n + 0.5 \cdot \frac{n}{x}\right)}\\
\mathbf{elif}\;n \leq -2.3 \cdot 10^{-226}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if n < -1.8499999999999999e-29Initial program 37.4%
Taylor expanded in n around inf 70.7%
log1p-define70.7%
Simplified70.7%
clear-num70.6%
inv-pow70.6%
Applied egg-rr70.6%
unpow-170.6%
Simplified70.6%
Taylor expanded in x around inf 55.7%
if -1.8499999999999999e-29 < n < -2.3e-226Initial program 100.0%
Taylor expanded in x around 0 42.2%
Taylor expanded in n around inf 60.2%
metadata-eval60.2%
Applied egg-rr60.2%
if -2.3e-226 < n Initial program 56.0%
Taylor expanded in n around inf 58.7%
log1p-define58.7%
Simplified58.7%
Taylor expanded in x around inf 48.2%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -2e+32) 0.0 (* (/ 1.0 x) (/ 1.0 n))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e+32) {
tmp = 0.0;
} else {
tmp = (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) :: tmp
if ((1.0d0 / n) <= (-2d+32)) then
tmp = 0.0d0
else
tmp = (1.0d0 / x) * (1.0d0 / n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e+32) {
tmp = 0.0;
} else {
tmp = (1.0 / x) * (1.0 / n);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -2e+32: tmp = 0.0 else: tmp = (1.0 / x) * (1.0 / n) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -2e+32) tmp = 0.0; else tmp = Float64(Float64(1.0 / x) * Float64(1.0 / n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -2e+32) tmp = 0.0; else tmp = (1.0 / x) * (1.0 / n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+32], 0.0, N[(N[(1.0 / x), $MachinePrecision] * N[(1.0 / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{+32}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{1}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000011e32Initial program 100.0%
Taylor expanded in x around 0 47.7%
Taylor expanded in n around inf 54.7%
metadata-eval54.7%
Applied egg-rr54.7%
if -2.00000000000000011e32 < (/.f64 #s(literal 1 binary64) n) Initial program 42.4%
Taylor expanded in x around inf 48.3%
mul-1-neg48.3%
log-rec48.3%
mul-1-neg48.3%
distribute-neg-frac48.3%
mul-1-neg48.3%
remove-double-neg48.3%
*-commutative48.3%
Simplified48.3%
div-inv48.3%
pow-to-exp48.3%
*-un-lft-identity48.3%
times-frac49.2%
Applied egg-rr49.2%
Taylor expanded in n around inf 49.5%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -2e+32) 0.0 (/ (/ 1.0 x) n)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e+32) {
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) <= (-2d+32)) 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) <= -2e+32) {
tmp = 0.0;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -2e+32: tmp = 0.0 else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -2e+32) 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) <= -2e+32) tmp = 0.0; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+32], 0.0, N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{+32}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000011e32Initial program 100.0%
Taylor expanded in x around 0 47.7%
Taylor expanded in n around inf 54.7%
metadata-eval54.7%
Applied egg-rr54.7%
if -2.00000000000000011e32 < (/.f64 #s(literal 1 binary64) n) Initial program 42.4%
Taylor expanded in n around inf 65.4%
log1p-define65.4%
Simplified65.4%
Taylor expanded in x around inf 49.4%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -2e+32) 0.0 (/ (/ 1.0 n) x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e+32) {
tmp = 0.0;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= (-2d+32)) then
tmp = 0.0d0
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e+32) {
tmp = 0.0;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -2e+32: tmp = 0.0 else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -2e+32) tmp = 0.0; else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -2e+32) tmp = 0.0; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+32], 0.0, N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{+32}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000011e32Initial program 100.0%
Taylor expanded in x around 0 47.7%
Taylor expanded in n around inf 54.7%
metadata-eval54.7%
Applied egg-rr54.7%
if -2.00000000000000011e32 < (/.f64 #s(literal 1 binary64) n) Initial program 42.4%
Taylor expanded in n around inf 65.4%
log1p-define65.4%
Simplified65.4%
Taylor expanded in x around inf 48.7%
associate-/r*49.4%
Simplified49.4%
(FPCore (x n) :precision binary64 (if (<= x 2.5e+167) (/ 1.0 (* x n)) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 2.5e+167) {
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 <= 2.5d+167) 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 <= 2.5e+167) {
tmp = 1.0 / (x * n);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.5e+167: tmp = 1.0 / (x * n) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 2.5e+167) 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 <= 2.5e+167) tmp = 1.0 / (x * n); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.5e+167], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.5 \cdot 10^{+167}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.4999999999999998e167Initial program 48.7%
Taylor expanded in x around inf 52.3%
mul-1-neg52.3%
log-rec52.3%
mul-1-neg52.3%
distribute-neg-frac52.3%
mul-1-neg52.3%
remove-double-neg52.3%
*-commutative52.3%
Simplified52.3%
Taylor expanded in n around inf 36.8%
*-commutative36.8%
Simplified36.8%
if 2.4999999999999998e167 < x Initial program 93.4%
Taylor expanded in x around 0 57.2%
Taylor expanded in n around inf 93.4%
metadata-eval93.4%
Applied egg-rr93.4%
(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 59.5%
Taylor expanded in x around 0 43.8%
Taylor expanded in n around inf 36.5%
metadata-eval36.5%
Applied egg-rr36.5%
herbie shell --seed 2024185
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))