
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-75)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 4e-6)
(/
(+
(log1p x)
(- (* 0.5 (/ (- (pow (log1p x) 2.0) (pow (log x) 2.0)) n)) (log x)))
n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-75) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 4e-6) {
tmp = (log1p(x) + ((0.5 * ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) / n)) - log(x))) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-75) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 4e-6) {
tmp = (Math.log1p(x) + ((0.5 * ((Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)) / n)) - Math.log(x))) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-75: tmp = (t_0 / n) / x elif (1.0 / n) <= 4e-6: tmp = (math.log1p(x) + ((0.5 * ((math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0)) / n)) - math.log(x))) / n else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-75) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 4e-6) tmp = Float64(Float64(log1p(x) + Float64(Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) / n)) - log(x))) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-75], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-6], N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-75}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-75Initial program 85.0%
Taylor expanded in x around inf 74.0%
log-rec74.0%
mul-1-neg74.0%
neg-mul-174.0%
mul-1-neg74.0%
distribute-frac-neg74.0%
remove-double-neg74.0%
*-rgt-identity74.0%
associate-/l*74.0%
exp-to-pow96.5%
*-commutative96.5%
Simplified96.5%
*-un-lft-identity96.5%
times-frac96.6%
Applied egg-rr96.6%
associate-*l/96.6%
*-un-lft-identity96.6%
Applied egg-rr96.6%
if -1.9999999999999999e-75 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999982e-6Initial program 29.2%
Taylor expanded in n around inf 79.9%
associate--l+79.9%
log1p-define79.9%
+-commutative79.9%
associate--r+79.9%
distribute-lft-out--79.9%
div-sub79.9%
log1p-define79.9%
Simplified79.9%
if 3.99999999999999982e-6 < (/.f64 #s(literal 1 binary64) n) Initial program 51.1%
Taylor expanded in n around 0 34.6%
log1p-define56.1%
*-rgt-identity56.1%
associate-*l/56.1%
associate-/l*56.1%
exp-to-pow93.0%
Simplified93.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-75)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 4e-6)
(/ (- (log1p x) (log x)) n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-75) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 4e-6) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-75) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 4e-6) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-75: tmp = (t_0 / n) / x elif (1.0 / n) <= 4e-6: tmp = (math.log1p(x) - math.log(x)) / n else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-75) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 4e-6) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-75], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-6], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-75}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-75Initial program 85.0%
Taylor expanded in x around inf 74.0%
log-rec74.0%
mul-1-neg74.0%
neg-mul-174.0%
mul-1-neg74.0%
distribute-frac-neg74.0%
remove-double-neg74.0%
*-rgt-identity74.0%
associate-/l*74.0%
exp-to-pow96.5%
*-commutative96.5%
Simplified96.5%
*-un-lft-identity96.5%
times-frac96.6%
Applied egg-rr96.6%
associate-*l/96.6%
*-un-lft-identity96.6%
Applied egg-rr96.6%
if -1.9999999999999999e-75 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999982e-6Initial program 29.2%
Taylor expanded in n around inf 79.4%
log1p-define79.4%
Simplified79.4%
if 3.99999999999999982e-6 < (/.f64 #s(literal 1 binary64) n) Initial program 51.1%
Taylor expanded in n around 0 34.6%
log1p-define56.1%
*-rgt-identity56.1%
associate-*l/56.1%
associate-/l*56.1%
exp-to-pow93.0%
Simplified93.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-75)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 2e-5)
(/ (- (log1p x) (log x)) n)
(- (exp (/ x n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-75) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-5) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-75) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-5) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-75: tmp = (t_0 / n) / x elif (1.0 / n) <= 2e-5: tmp = (math.log1p(x) - math.log(x)) / n else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-75) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 2e-5) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-75], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-5], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-75}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-75Initial program 85.0%
Taylor expanded in x around inf 74.0%
log-rec74.0%
mul-1-neg74.0%
neg-mul-174.0%
mul-1-neg74.0%
distribute-frac-neg74.0%
remove-double-neg74.0%
*-rgt-identity74.0%
associate-/l*74.0%
exp-to-pow96.5%
*-commutative96.5%
Simplified96.5%
*-un-lft-identity96.5%
times-frac96.6%
Applied egg-rr96.6%
associate-*l/96.6%
*-un-lft-identity96.6%
Applied egg-rr96.6%
if -1.9999999999999999e-75 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000016e-5Initial program 29.0%
Taylor expanded in n around inf 78.8%
log1p-define78.8%
Simplified78.8%
if 2.00000000000000016e-5 < (/.f64 #s(literal 1 binary64) n) Initial program 51.8%
Taylor expanded in n around 0 35.1%
log1p-define56.9%
*-rgt-identity56.9%
associate-*l/56.9%
associate-/l*56.9%
exp-to-pow94.4%
Simplified94.4%
Taylor expanded in x around 0 94.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-75)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 2e-5)
(/ (- (log1p x) (log 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-75) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-5) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = ((x / n) + 1.0) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-75) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e-5) {
tmp = (Math.log1p(x) - Math.log(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-75: tmp = (t_0 / n) / x elif (1.0 / n) <= 2e-5: tmp = (math.log1p(x) - math.log(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-75) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 2e-5) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-75], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-5], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[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^{-75}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-75Initial program 85.0%
Taylor expanded in x around inf 74.0%
log-rec74.0%
mul-1-neg74.0%
neg-mul-174.0%
mul-1-neg74.0%
distribute-frac-neg74.0%
remove-double-neg74.0%
*-rgt-identity74.0%
associate-/l*74.0%
exp-to-pow96.5%
*-commutative96.5%
Simplified96.5%
*-un-lft-identity96.5%
times-frac96.6%
Applied egg-rr96.6%
associate-*l/96.6%
*-un-lft-identity96.6%
Applied egg-rr96.6%
if -1.9999999999999999e-75 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000016e-5Initial program 29.0%
Taylor expanded in n around inf 78.8%
log1p-define78.8%
Simplified78.8%
if 2.00000000000000016e-5 < (/.f64 #s(literal 1 binary64) n) Initial program 51.8%
Taylor expanded in x around 0 50.2%
Final simplification78.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x -3.1e-192)
0.0
(if (<= x 2.3e-247)
(- (+ (/ x n) 1.0) t_0)
(if (<= x 0.25)
(-
(*
x
(+
(/ 1.0 n)
(* x (+ (* (/ x n) 0.3333333333333333) (* 0.5 (/ -1.0 n))))))
(/ (log x) n))
(/ (/ t_0 n) x))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= -3.1e-192) {
tmp = 0.0;
} else if (x <= 2.3e-247) {
tmp = ((x / n) + 1.0) - t_0;
} else if (x <= 0.25) {
tmp = (x * ((1.0 / n) + (x * (((x / n) * 0.3333333333333333) + (0.5 * (-1.0 / n)))))) - (log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= (-3.1d-192)) then
tmp = 0.0d0
else if (x <= 2.3d-247) then
tmp = ((x / n) + 1.0d0) - t_0
else if (x <= 0.25d0) then
tmp = (x * ((1.0d0 / n) + (x * (((x / n) * 0.3333333333333333d0) + (0.5d0 * ((-1.0d0) / n)))))) - (log(x) / n)
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= -3.1e-192) {
tmp = 0.0;
} else if (x <= 2.3e-247) {
tmp = ((x / n) + 1.0) - t_0;
} else if (x <= 0.25) {
tmp = (x * ((1.0 / n) + (x * (((x / n) * 0.3333333333333333) + (0.5 * (-1.0 / n)))))) - (Math.log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= -3.1e-192: tmp = 0.0 elif x <= 2.3e-247: tmp = ((x / n) + 1.0) - t_0 elif x <= 0.25: tmp = (x * ((1.0 / n) + (x * (((x / n) * 0.3333333333333333) + (0.5 * (-1.0 / n)))))) - (math.log(x) / n) else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= -3.1e-192) tmp = 0.0; elseif (x <= 2.3e-247) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); elseif (x <= 0.25) tmp = Float64(Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(Float64(x / n) * 0.3333333333333333) + Float64(0.5 * Float64(-1.0 / n)))))) - Float64(log(x) / n)); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= -3.1e-192) tmp = 0.0; elseif (x <= 2.3e-247) tmp = ((x / n) + 1.0) - t_0; elseif (x <= 0.25) tmp = (x * ((1.0 / n) + (x * (((x / n) * 0.3333333333333333) + (0.5 * (-1.0 / n)))))) - (log(x) / n); else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -3.1e-192], 0.0, If[LessEqual[x, 2.3e-247], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 0.25], N[(N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(x * N[(N[(N[(x / n), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq -3.1 \cdot 10^{-192}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-247}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{elif}\;x \leq 0.25:\\
\;\;\;\;x \cdot \left(\frac{1}{n} + x \cdot \left(\frac{x}{n} \cdot 0.3333333333333333 + 0.5 \cdot \frac{-1}{n}\right)\right) - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < -3.1e-192Initial program 65.8%
Taylor expanded in x around inf 0.0%
log-rec0.0%
mul-1-neg0.0%
neg-mul-10.0%
mul-1-neg0.0%
distribute-frac-neg0.0%
remove-double-neg0.0%
*-rgt-identity0.0%
associate-/l*0.0%
exp-to-pow85.8%
Simplified85.8%
Taylor expanded in x around 0 85.9%
if -3.1e-192 < x < 2.3e-247Initial program 64.7%
Taylor expanded in x around 0 65.9%
if 2.3e-247 < x < 0.25Initial program 37.1%
add-sqr-sqrt14.5%
pow214.5%
pow-to-exp14.5%
un-div-inv14.5%
+-commutative14.5%
log1p-define26.3%
Applied egg-rr26.3%
Taylor expanded in n around inf 30.9%
log1p-define30.9%
Simplified30.9%
Taylor expanded in x around 0 56.1%
if 0.25 < x Initial program 61.2%
Taylor expanded in x around inf 97.9%
log-rec97.9%
mul-1-neg97.9%
neg-mul-197.9%
mul-1-neg97.9%
distribute-frac-neg97.9%
remove-double-neg97.9%
*-rgt-identity97.9%
associate-/l*97.9%
exp-to-pow97.9%
*-commutative97.9%
Simplified97.9%
*-un-lft-identity97.9%
times-frac98.6%
Applied egg-rr98.6%
associate-*l/98.6%
*-un-lft-identity98.6%
Applied egg-rr98.6%
Final simplification76.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x -4.9e-206)
0.0
(if (<= x 2.3e-247)
(- (+ (/ x n) 1.0) t_0)
(if (<= x 0.22)
(- (* x (+ (/ 1.0 n) (* (/ x n) -0.5))) (/ (log x) n))
(/ (/ t_0 n) x))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= -4.9e-206) {
tmp = 0.0;
} else if (x <= 2.3e-247) {
tmp = ((x / n) + 1.0) - t_0;
} else if (x <= 0.22) {
tmp = (x * ((1.0 / n) + ((x / n) * -0.5))) - (log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= (-4.9d-206)) then
tmp = 0.0d0
else if (x <= 2.3d-247) then
tmp = ((x / n) + 1.0d0) - t_0
else if (x <= 0.22d0) then
tmp = (x * ((1.0d0 / n) + ((x / n) * (-0.5d0)))) - (log(x) / n)
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= -4.9e-206) {
tmp = 0.0;
} else if (x <= 2.3e-247) {
tmp = ((x / n) + 1.0) - t_0;
} else if (x <= 0.22) {
tmp = (x * ((1.0 / n) + ((x / n) * -0.5))) - (Math.log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= -4.9e-206: tmp = 0.0 elif x <= 2.3e-247: tmp = ((x / n) + 1.0) - t_0 elif x <= 0.22: tmp = (x * ((1.0 / n) + ((x / n) * -0.5))) - (math.log(x) / n) else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= -4.9e-206) tmp = 0.0; elseif (x <= 2.3e-247) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); elseif (x <= 0.22) tmp = Float64(Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(x / n) * -0.5))) - Float64(log(x) / n)); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= -4.9e-206) tmp = 0.0; elseif (x <= 2.3e-247) tmp = ((x / n) + 1.0) - t_0; elseif (x <= 0.22) tmp = (x * ((1.0 / n) + ((x / n) * -0.5))) - (log(x) / n); else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -4.9e-206], 0.0, If[LessEqual[x, 2.3e-247], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 0.22], N[(N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(x / n), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq -4.9 \cdot 10^{-206}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-247}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{elif}\;x \leq 0.22:\\
\;\;\;\;x \cdot \left(\frac{1}{n} + \frac{x}{n} \cdot -0.5\right) - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < -4.9e-206Initial program 65.8%
Taylor expanded in x around inf 0.0%
log-rec0.0%
mul-1-neg0.0%
neg-mul-10.0%
mul-1-neg0.0%
distribute-frac-neg0.0%
remove-double-neg0.0%
*-rgt-identity0.0%
associate-/l*0.0%
exp-to-pow85.8%
Simplified85.8%
Taylor expanded in x around 0 85.9%
if -4.9e-206 < x < 2.3e-247Initial program 64.7%
Taylor expanded in x around 0 65.9%
if 2.3e-247 < x < 0.220000000000000001Initial program 37.1%
add-sqr-sqrt14.5%
pow214.5%
pow-to-exp14.5%
un-div-inv14.5%
+-commutative14.5%
log1p-define26.3%
Applied egg-rr26.3%
Taylor expanded in n around inf 30.9%
log1p-define30.9%
Simplified30.9%
Taylor expanded in x around 0 56.0%
if 0.220000000000000001 < x Initial program 61.2%
Taylor expanded in x around inf 97.9%
log-rec97.9%
mul-1-neg97.9%
neg-mul-197.9%
mul-1-neg97.9%
distribute-frac-neg97.9%
remove-double-neg97.9%
*-rgt-identity97.9%
associate-/l*97.9%
exp-to-pow97.9%
*-commutative97.9%
Simplified97.9%
*-un-lft-identity97.9%
times-frac98.6%
Applied egg-rr98.6%
associate-*l/98.6%
*-un-lft-identity98.6%
Applied egg-rr98.6%
Final simplification76.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x -2.95e-192)
0.0
(if (<= x 1.4e-247)
(- (+ (/ x n) 1.0) t_0)
(if (<= x 0.22) (/ (- x (log x)) n) (/ (/ t_0 n) x))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= -2.95e-192) {
tmp = 0.0;
} else if (x <= 1.4e-247) {
tmp = ((x / n) + 1.0) - t_0;
} else if (x <= 0.22) {
tmp = (x - log(x)) / n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= (-2.95d-192)) then
tmp = 0.0d0
else if (x <= 1.4d-247) then
tmp = ((x / n) + 1.0d0) - t_0
else if (x <= 0.22d0) then
tmp = (x - log(x)) / n
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= -2.95e-192) {
tmp = 0.0;
} else if (x <= 1.4e-247) {
tmp = ((x / n) + 1.0) - t_0;
} else if (x <= 0.22) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= -2.95e-192: tmp = 0.0 elif x <= 1.4e-247: tmp = ((x / n) + 1.0) - t_0 elif x <= 0.22: tmp = (x - math.log(x)) / n else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= -2.95e-192) tmp = 0.0; elseif (x <= 1.4e-247) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); elseif (x <= 0.22) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= -2.95e-192) tmp = 0.0; elseif (x <= 1.4e-247) tmp = ((x / n) + 1.0) - t_0; elseif (x <= 0.22) tmp = (x - log(x)) / n; else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.95e-192], 0.0, If[LessEqual[x, 1.4e-247], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 0.22], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq -2.95 \cdot 10^{-192}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-247}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{elif}\;x \leq 0.22:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < -2.9499999999999998e-192Initial program 65.8%
Taylor expanded in x around inf 0.0%
log-rec0.0%
mul-1-neg0.0%
neg-mul-10.0%
mul-1-neg0.0%
distribute-frac-neg0.0%
remove-double-neg0.0%
*-rgt-identity0.0%
associate-/l*0.0%
exp-to-pow85.8%
Simplified85.8%
Taylor expanded in x around 0 85.9%
if -2.9499999999999998e-192 < x < 1.39999999999999993e-247Initial program 64.7%
Taylor expanded in x around 0 65.9%
if 1.39999999999999993e-247 < x < 0.220000000000000001Initial program 37.1%
Taylor expanded in x around 0 35.7%
Taylor expanded in n around inf 55.5%
if 0.220000000000000001 < x Initial program 61.2%
Taylor expanded in x around inf 97.9%
log-rec97.9%
mul-1-neg97.9%
neg-mul-197.9%
mul-1-neg97.9%
distribute-frac-neg97.9%
remove-double-neg97.9%
*-rgt-identity97.9%
associate-/l*97.9%
exp-to-pow97.9%
*-commutative97.9%
Simplified97.9%
*-un-lft-identity97.9%
times-frac98.6%
Applied egg-rr98.6%
associate-*l/98.6%
*-un-lft-identity98.6%
Applied egg-rr98.6%
Final simplification75.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x -2.4e-198)
0.0
(if (<= x 1.55e-247)
(- 1.0 t_0)
(if (<= x 0.22) (/ (- x (log x)) n) (/ (/ t_0 n) x))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= -2.4e-198) {
tmp = 0.0;
} else if (x <= 1.55e-247) {
tmp = 1.0 - t_0;
} else if (x <= 0.22) {
tmp = (x - log(x)) / n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= (-2.4d-198)) then
tmp = 0.0d0
else if (x <= 1.55d-247) then
tmp = 1.0d0 - t_0
else if (x <= 0.22d0) then
tmp = (x - log(x)) / n
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= -2.4e-198) {
tmp = 0.0;
} else if (x <= 1.55e-247) {
tmp = 1.0 - t_0;
} else if (x <= 0.22) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= -2.4e-198: tmp = 0.0 elif x <= 1.55e-247: tmp = 1.0 - t_0 elif x <= 0.22: tmp = (x - math.log(x)) / n else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= -2.4e-198) tmp = 0.0; elseif (x <= 1.55e-247) tmp = Float64(1.0 - t_0); elseif (x <= 0.22) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= -2.4e-198) tmp = 0.0; elseif (x <= 1.55e-247) tmp = 1.0 - t_0; elseif (x <= 0.22) tmp = (x - log(x)) / n; else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.4e-198], 0.0, If[LessEqual[x, 1.55e-247], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[x, 0.22], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq -2.4 \cdot 10^{-198}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-247}:\\
\;\;\;\;1 - t\_0\\
\mathbf{elif}\;x \leq 0.22:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < -2.39999999999999986e-198Initial program 65.8%
Taylor expanded in x around inf 0.0%
log-rec0.0%
mul-1-neg0.0%
neg-mul-10.0%
mul-1-neg0.0%
distribute-frac-neg0.0%
remove-double-neg0.0%
*-rgt-identity0.0%
associate-/l*0.0%
exp-to-pow85.8%
Simplified85.8%
Taylor expanded in x around 0 85.9%
if -2.39999999999999986e-198 < x < 1.55000000000000008e-247Initial program 64.7%
Taylor expanded in x around 0 47.3%
*-rgt-identity47.3%
associate-*l/47.3%
associate-/l*47.3%
exp-to-pow64.7%
Simplified64.7%
if 1.55000000000000008e-247 < x < 0.220000000000000001Initial program 37.1%
Taylor expanded in x around 0 35.7%
Taylor expanded in n around inf 55.5%
if 0.220000000000000001 < x Initial program 61.2%
Taylor expanded in x around inf 97.9%
log-rec97.9%
mul-1-neg97.9%
neg-mul-197.9%
mul-1-neg97.9%
distribute-frac-neg97.9%
remove-double-neg97.9%
*-rgt-identity97.9%
associate-/l*97.9%
exp-to-pow97.9%
*-commutative97.9%
Simplified97.9%
*-un-lft-identity97.9%
times-frac98.6%
Applied egg-rr98.6%
associate-*l/98.6%
*-un-lft-identity98.6%
Applied egg-rr98.6%
(FPCore (x n)
:precision binary64
(if (<= x -2e-192)
0.0
(if (<= x 1.5e-247)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.85)
(/ (- x (log x)) n)
(if (<= x 2.1e+160)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x)) x)
0.0)))))
double code(double x, double n) {
double tmp;
if (x <= -2e-192) {
tmp = 0.0;
} else if (x <= 1.5e-247) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.85) {
tmp = (x - log(x)) / n;
} else if (x <= 2.1e+160) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= (-2d-192)) then
tmp = 0.0d0
else if (x <= 1.5d-247) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.85d0) then
tmp = (x - log(x)) / n
else if (x <= 2.1d+160) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= -2e-192) {
tmp = 0.0;
} else if (x <= 1.5e-247) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.85) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 2.1e+160) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= -2e-192: tmp = 0.0 elif x <= 1.5e-247: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.85: tmp = (x - math.log(x)) / n elif x <= 2.1e+160: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= -2e-192) tmp = 0.0; elseif (x <= 1.5e-247) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.85) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 2.1e+160) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= -2e-192) tmp = 0.0; elseif (x <= 1.5e-247) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.85) tmp = (x - log(x)) / n; elseif (x <= 2.1e+160) tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, -2e-192], 0.0, If[LessEqual[x, 1.5e-247], 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.1e+160], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-192}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-247}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.85:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.0000000000000002e-192 or 2.09999999999999997e160 < x Initial program 73.7%
Taylor expanded in x around inf 46.1%
log-rec46.1%
mul-1-neg46.1%
neg-mul-146.1%
mul-1-neg46.1%
distribute-frac-neg46.1%
remove-double-neg46.1%
*-rgt-identity46.1%
associate-/l*46.1%
exp-to-pow82.1%
Simplified82.1%
Taylor expanded in x around 0 82.1%
if -2.0000000000000002e-192 < x < 1.4999999999999999e-247Initial program 64.7%
Taylor expanded in x around 0 47.3%
*-rgt-identity47.3%
associate-*l/47.3%
associate-/l*47.3%
exp-to-pow64.7%
Simplified64.7%
if 1.4999999999999999e-247 < x < 0.849999999999999978Initial program 37.1%
Taylor expanded in x around 0 35.7%
Taylor expanded in n around inf 55.5%
if 0.849999999999999978 < x < 2.09999999999999997e160Initial program 39.8%
add-sqr-sqrt39.8%
pow239.8%
pow-to-exp39.8%
un-div-inv39.8%
+-commutative39.8%
log1p-define39.8%
Applied egg-rr39.8%
Taylor expanded in n around inf 38.7%
log1p-define38.7%
Simplified38.7%
Taylor expanded in x around -inf 74.1%
mul-1-neg74.1%
mul-1-neg74.1%
associate-*r/74.1%
metadata-eval74.1%
*-commutative74.1%
associate-*r/74.1%
metadata-eval74.1%
Simplified74.1%
Final simplification68.3%
(FPCore (x n)
:precision binary64
(if (<= x -4e-310)
0.0
(if (<= x 0.85)
(/ (- x (log x)) n)
(if (<= x 1.95e+160)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x)) x)
0.0))))
double code(double x, double n) {
double tmp;
if (x <= -4e-310) {
tmp = 0.0;
} else if (x <= 0.85) {
tmp = (x - log(x)) / n;
} else if (x <= 1.95e+160) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= (-4d-310)) then
tmp = 0.0d0
else if (x <= 0.85d0) then
tmp = (x - log(x)) / n
else if (x <= 1.95d+160) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= -4e-310) {
tmp = 0.0;
} else if (x <= 0.85) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 1.95e+160) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= -4e-310: tmp = 0.0 elif x <= 0.85: tmp = (x - math.log(x)) / n elif x <= 1.95e+160: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= -4e-310) tmp = 0.0; elseif (x <= 0.85) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 1.95e+160) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= -4e-310) tmp = 0.0; elseif (x <= 0.85) tmp = (x - log(x)) / n; elseif (x <= 1.95e+160) tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, -4e-310], 0.0, If[LessEqual[x, 0.85], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.95e+160], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-310}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 0.85:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -3.999999999999988e-310 or 1.95000000000000004e160 < x Initial program 72.8%
Taylor expanded in x around inf 40.6%
log-rec40.6%
mul-1-neg40.6%
neg-mul-140.6%
mul-1-neg40.6%
distribute-frac-neg40.6%
remove-double-neg40.6%
*-rgt-identity40.6%
associate-/l*40.6%
exp-to-pow73.6%
Simplified73.6%
Taylor expanded in x around 0 73.7%
if -3.999999999999988e-310 < x < 0.849999999999999978Initial program 43.9%
Taylor expanded in x around 0 43.1%
Taylor expanded in n around inf 50.6%
if 0.849999999999999978 < x < 1.95000000000000004e160Initial program 39.8%
add-sqr-sqrt39.8%
pow239.8%
pow-to-exp39.8%
un-div-inv39.8%
+-commutative39.8%
log1p-define39.8%
Applied egg-rr39.8%
Taylor expanded in n around inf 38.7%
log1p-define38.7%
Simplified38.7%
Taylor expanded in x around -inf 74.1%
mul-1-neg74.1%
mul-1-neg74.1%
associate-*r/74.1%
metadata-eval74.1%
*-commutative74.1%
associate-*r/74.1%
metadata-eval74.1%
Simplified74.1%
Final simplification62.6%
(FPCore (x n)
:precision binary64
(if (<= x -4e-310)
0.0
(if (<= x 0.6)
(/ (log x) (- n))
(if (<= x 2e+160)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x)) x)
0.0))))
double code(double x, double n) {
double tmp;
if (x <= -4e-310) {
tmp = 0.0;
} else if (x <= 0.6) {
tmp = log(x) / -n;
} else if (x <= 2e+160) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= (-4d-310)) then
tmp = 0.0d0
else if (x <= 0.6d0) then
tmp = log(x) / -n
else if (x <= 2d+160) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= -4e-310) {
tmp = 0.0;
} else if (x <= 0.6) {
tmp = Math.log(x) / -n;
} else if (x <= 2e+160) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= -4e-310: tmp = 0.0 elif x <= 0.6: tmp = math.log(x) / -n elif x <= 2e+160: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= -4e-310) tmp = 0.0; elseif (x <= 0.6) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 2e+160) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= -4e-310) tmp = 0.0; elseif (x <= 0.6) tmp = log(x) / -n; elseif (x <= 2e+160) tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, -4e-310], 0.0, If[LessEqual[x, 0.6], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 2e+160], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-310}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 0.6:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -3.999999999999988e-310 or 2.00000000000000001e160 < x Initial program 72.8%
Taylor expanded in x around inf 40.6%
log-rec40.6%
mul-1-neg40.6%
neg-mul-140.6%
mul-1-neg40.6%
distribute-frac-neg40.6%
remove-double-neg40.6%
*-rgt-identity40.6%
associate-/l*40.6%
exp-to-pow73.6%
Simplified73.6%
Taylor expanded in x around 0 73.7%
if -3.999999999999988e-310 < x < 0.599999999999999978Initial program 43.9%
Taylor expanded in x around 0 42.3%
*-rgt-identity42.3%
associate-*l/42.3%
associate-/l*42.3%
exp-to-pow42.3%
Simplified42.3%
Taylor expanded in n around inf 50.2%
associate-*r/50.2%
mul-1-neg50.2%
Simplified50.2%
if 0.599999999999999978 < x < 2.00000000000000001e160Initial program 39.8%
add-sqr-sqrt39.8%
pow239.8%
pow-to-exp39.8%
un-div-inv39.8%
+-commutative39.8%
log1p-define39.8%
Applied egg-rr39.8%
Taylor expanded in n around inf 38.7%
log1p-define38.7%
Simplified38.7%
Taylor expanded in x around -inf 74.1%
mul-1-neg74.1%
mul-1-neg74.1%
associate-*r/74.1%
metadata-eval74.1%
*-commutative74.1%
associate-*r/74.1%
metadata-eval74.1%
Simplified74.1%
Final simplification62.4%
(FPCore (x n)
:precision binary64
(if (<= x 1.16e-292)
0.0
(if (<= x 1.95e+160)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x)) x)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 1.16e-292) {
tmp = 0.0;
} else if (x <= 1.95e+160) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.16d-292) then
tmp = 0.0d0
else if (x <= 1.95d+160) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.16e-292) {
tmp = 0.0;
} else if (x <= 1.95e+160) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.16e-292: tmp = 0.0 elif x <= 1.95e+160: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1.16e-292) tmp = 0.0; elseif (x <= 1.95e+160) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.16e-292) tmp = 0.0; elseif (x <= 1.95e+160) tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.16e-292], 0.0, If[LessEqual[x, 1.95e+160], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.16 \cdot 10^{-292}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.16e-292 or 1.95000000000000004e160 < x Initial program 70.5%
Taylor expanded in x around inf 38.7%
log-rec38.7%
mul-1-neg38.7%
neg-mul-138.7%
mul-1-neg38.7%
distribute-frac-neg38.7%
remove-double-neg38.7%
*-rgt-identity38.7%
associate-/l*38.7%
exp-to-pow70.1%
Simplified70.1%
Taylor expanded in x around 0 70.2%
if 1.16e-292 < x < 1.95000000000000004e160Initial program 43.3%
add-sqr-sqrt24.5%
pow224.5%
pow-to-exp24.5%
un-div-inv24.5%
+-commutative24.5%
log1p-define31.9%
Applied egg-rr31.9%
Taylor expanded in n around inf 28.8%
log1p-define28.8%
Simplified28.8%
Taylor expanded in x around -inf 40.9%
mul-1-neg40.9%
mul-1-neg40.9%
associate-*r/40.9%
metadata-eval40.9%
*-commutative40.9%
associate-*r/40.9%
metadata-eval40.9%
Simplified40.9%
Final simplification52.0%
(FPCore (x n) :precision binary64 (if (<= x 1.16e-292) 0.0 (if (<= x 1.95e+160) (/ (/ 1.0 x) n) 0.0)))
double code(double x, double n) {
double tmp;
if (x <= 1.16e-292) {
tmp = 0.0;
} else if (x <= 1.95e+160) {
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 <= 1.16d-292) then
tmp = 0.0d0
else if (x <= 1.95d+160) 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 <= 1.16e-292) {
tmp = 0.0;
} else if (x <= 1.95e+160) {
tmp = (1.0 / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.16e-292: tmp = 0.0 elif x <= 1.95e+160: tmp = (1.0 / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1.16e-292) tmp = 0.0; elseif (x <= 1.95e+160) tmp = Float64(Float64(1.0 / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.16e-292) tmp = 0.0; elseif (x <= 1.95e+160) tmp = (1.0 / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.16e-292], 0.0, If[LessEqual[x, 1.95e+160], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.16 \cdot 10^{-292}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.16e-292 or 1.95000000000000004e160 < x Initial program 70.5%
Taylor expanded in x around inf 38.7%
log-rec38.7%
mul-1-neg38.7%
neg-mul-138.7%
mul-1-neg38.7%
distribute-frac-neg38.7%
remove-double-neg38.7%
*-rgt-identity38.7%
associate-/l*38.7%
exp-to-pow70.1%
Simplified70.1%
Taylor expanded in x around 0 70.2%
if 1.16e-292 < x < 1.95000000000000004e160Initial program 43.3%
Taylor expanded in x around inf 45.6%
log-rec45.6%
mul-1-neg45.6%
neg-mul-145.6%
mul-1-neg45.6%
distribute-frac-neg45.6%
remove-double-neg45.6%
*-rgt-identity45.6%
associate-/l*45.6%
exp-to-pow45.6%
*-commutative45.6%
Simplified45.6%
*-un-lft-identity45.6%
times-frac45.9%
Applied egg-rr45.9%
associate-*l/45.9%
*-un-lft-identity45.9%
Applied egg-rr45.9%
Taylor expanded in n around inf 32.5%
*-commutative32.5%
associate-/r*32.5%
Simplified32.5%
(FPCore (x n) :precision binary64 (if (<= x 1.16e-292) 0.0 (if (<= x 1.95e+160) (/ (/ 1.0 n) x) 0.0)))
double code(double x, double n) {
double tmp;
if (x <= 1.16e-292) {
tmp = 0.0;
} else if (x <= 1.95e+160) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.16d-292) then
tmp = 0.0d0
else if (x <= 1.95d+160) then
tmp = (1.0d0 / n) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.16e-292) {
tmp = 0.0;
} else if (x <= 1.95e+160) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.16e-292: tmp = 0.0 elif x <= 1.95e+160: tmp = (1.0 / n) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1.16e-292) tmp = 0.0; elseif (x <= 1.95e+160) tmp = Float64(Float64(1.0 / n) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.16e-292) tmp = 0.0; elseif (x <= 1.95e+160) tmp = (1.0 / n) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.16e-292], 0.0, If[LessEqual[x, 1.95e+160], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.16 \cdot 10^{-292}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.16e-292 or 1.95000000000000004e160 < x Initial program 70.5%
Taylor expanded in x around inf 38.7%
log-rec38.7%
mul-1-neg38.7%
neg-mul-138.7%
mul-1-neg38.7%
distribute-frac-neg38.7%
remove-double-neg38.7%
*-rgt-identity38.7%
associate-/l*38.7%
exp-to-pow70.1%
Simplified70.1%
Taylor expanded in x around 0 70.2%
if 1.16e-292 < x < 1.95000000000000004e160Initial program 43.3%
Taylor expanded in x around inf 45.6%
log-rec45.6%
mul-1-neg45.6%
neg-mul-145.6%
mul-1-neg45.6%
distribute-frac-neg45.6%
remove-double-neg45.6%
*-rgt-identity45.6%
associate-/l*45.6%
exp-to-pow45.6%
*-commutative45.6%
Simplified45.6%
*-un-lft-identity45.6%
times-frac45.9%
Applied egg-rr45.9%
associate-*l/45.9%
*-un-lft-identity45.9%
Applied egg-rr45.9%
Taylor expanded in n around inf 32.5%
(FPCore (x n) :precision binary64 (if (<= x 1.16e-292) 0.0 (if (<= x 1.95e+160) (/ 1.0 (* n x)) 0.0)))
double code(double x, double n) {
double tmp;
if (x <= 1.16e-292) {
tmp = 0.0;
} else if (x <= 1.95e+160) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.16d-292) then
tmp = 0.0d0
else if (x <= 1.95d+160) then
tmp = 1.0d0 / (n * x)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.16e-292) {
tmp = 0.0;
} else if (x <= 1.95e+160) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.16e-292: tmp = 0.0 elif x <= 1.95e+160: tmp = 1.0 / (n * x) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1.16e-292) tmp = 0.0; elseif (x <= 1.95e+160) tmp = Float64(1.0 / Float64(n * x)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.16e-292) tmp = 0.0; elseif (x <= 1.95e+160) tmp = 1.0 / (n * x); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.16e-292], 0.0, If[LessEqual[x, 1.95e+160], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.16 \cdot 10^{-292}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+160}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.16e-292 or 1.95000000000000004e160 < x Initial program 70.5%
Taylor expanded in x around inf 38.7%
log-rec38.7%
mul-1-neg38.7%
neg-mul-138.7%
mul-1-neg38.7%
distribute-frac-neg38.7%
remove-double-neg38.7%
*-rgt-identity38.7%
associate-/l*38.7%
exp-to-pow70.1%
Simplified70.1%
Taylor expanded in x around 0 70.2%
if 1.16e-292 < x < 1.95000000000000004e160Initial program 43.3%
Taylor expanded in x around inf 45.6%
log-rec45.6%
mul-1-neg45.6%
neg-mul-145.6%
mul-1-neg45.6%
distribute-frac-neg45.6%
remove-double-neg45.6%
*-rgt-identity45.6%
associate-/l*45.6%
exp-to-pow45.6%
*-commutative45.6%
Simplified45.6%
Taylor expanded in n around inf 32.5%
*-commutative32.5%
Simplified32.5%
Final simplification46.7%
(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 53.6%
Taylor expanded in x around inf 22.3%
log-rec22.3%
mul-1-neg22.3%
neg-mul-122.3%
mul-1-neg22.3%
distribute-frac-neg22.3%
remove-double-neg22.3%
*-rgt-identity22.3%
associate-/l*22.3%
exp-to-pow34.2%
Simplified34.2%
Taylor expanded in x around 0 34.4%
herbie shell --seed 2024172
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))