
(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 19 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 19000000.0)
(/
(-
(/
(+
(* 0.5 (* (log (* x (+ x 1.0))) (log (/ (+ x 1.0) x))))
(* (- (pow (log1p x) 3.0) (pow (log x) 3.0)) (/ 0.16666666666666666 n)))
n)
(log (/ x (+ x 1.0))))
n)
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 19000000.0) {
tmp = ((((0.5 * (log((x * (x + 1.0))) * log(((x + 1.0) / x)))) + ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) * (0.16666666666666666 / n))) / n) - log((x / (x + 1.0)))) / n;
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (x <= 19000000.0) {
tmp = ((((0.5 * (Math.log((x * (x + 1.0))) * Math.log(((x + 1.0) / x)))) + ((Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0)) * (0.16666666666666666 / n))) / n) - Math.log((x / (x + 1.0)))) / n;
} else {
tmp = (Math.pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 19000000.0: tmp = ((((0.5 * (math.log((x * (x + 1.0))) * math.log(((x + 1.0) / x)))) + ((math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0)) * (0.16666666666666666 / n))) / n) - math.log((x / (x + 1.0)))) / n else: tmp = (math.pow(x, (1.0 / n)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 19000000.0) tmp = Float64(Float64(Float64(Float64(Float64(0.5 * Float64(log(Float64(x * Float64(x + 1.0))) * log(Float64(Float64(x + 1.0) / x)))) + Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) * Float64(0.16666666666666666 / n))) / n) - log(Float64(x / Float64(x + 1.0)))) / n); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
code[x_, n_] := If[LessEqual[x, 19000000.0], N[(N[(N[(N[(N[(0.5 * N[(N[Log[N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] * N[(0.16666666666666666 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 19000000:\\
\;\;\;\;\frac{\frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) \cdot \frac{0.16666666666666666}{n}}{n} - \log \left(\frac{x}{x + 1}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 1.9e7Initial program 47.8%
Taylor expanded in n around -inf
Simplified77.7%
Applied egg-rr77.9%
if 1.9e7 < x Initial program 72.3%
Taylor expanded in x around inf
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6499.0%
Simplified99.0%
Final simplification88.0%
(FPCore (x n)
:precision binary64
(if (<= x 0.48)
(/
(-
(/
(+
(/ (* (pow (log x) 3.0) -0.16666666666666666) n)
(* -0.5 (pow (log x) 2.0)))
n)
(log x))
n)
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 0.48) {
tmp = (((((pow(log(x), 3.0) * -0.16666666666666666) / n) + (-0.5 * pow(log(x), 2.0))) / n) - log(x)) / n;
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.48d0) then
tmp = ((((((log(x) ** 3.0d0) * (-0.16666666666666666d0)) / n) + ((-0.5d0) * (log(x) ** 2.0d0))) / n) - log(x)) / n
else
tmp = ((x ** (1.0d0 / n)) / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.48) {
tmp = (((((Math.pow(Math.log(x), 3.0) * -0.16666666666666666) / n) + (-0.5 * Math.pow(Math.log(x), 2.0))) / n) - Math.log(x)) / n;
} else {
tmp = (Math.pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.48: tmp = (((((math.pow(math.log(x), 3.0) * -0.16666666666666666) / n) + (-0.5 * math.pow(math.log(x), 2.0))) / n) - math.log(x)) / n else: tmp = (math.pow(x, (1.0 / n)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 0.48) tmp = Float64(Float64(Float64(Float64(Float64(Float64((log(x) ^ 3.0) * -0.16666666666666666) / n) + Float64(-0.5 * (log(x) ^ 2.0))) / n) - log(x)) / n); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.48) tmp = ((((((log(x) ^ 3.0) * -0.16666666666666666) / n) + (-0.5 * (log(x) ^ 2.0))) / n) - log(x)) / n; else tmp = ((x ^ (1.0 / n)) / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.48], N[(N[(N[(N[(N[(N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 * N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.48:\\
\;\;\;\;\frac{\frac{\frac{{\log x}^{3} \cdot -0.16666666666666666}{n} + -0.5 \cdot {\log x}^{2}}{n} - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 0.47999999999999998Initial program 48.5%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6448.2%
Simplified48.2%
Taylor expanded in n around -inf
Simplified75.9%
if 0.47999999999999998 < x Initial program 71.2%
Taylor expanded in x around inf
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6498.3%
Simplified98.3%
Final simplification86.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log (/ x (+ x 1.0))) (- 0.0 n))))
(if (<= n -30500000000.0)
t_0
(if (<= n 28500000000.0)
(- (exp (* (log1p x) (/ 1.0 n))) (pow x (/ 1.0 n)))
t_0))))
double code(double x, double n) {
double t_0 = log((x / (x + 1.0))) / (0.0 - n);
double tmp;
if (n <= -30500000000.0) {
tmp = t_0;
} else if (n <= 28500000000.0) {
tmp = exp((log1p(x) * (1.0 / n))) - pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.log((x / (x + 1.0))) / (0.0 - n);
double tmp;
if (n <= -30500000000.0) {
tmp = t_0;
} else if (n <= 28500000000.0) {
tmp = Math.exp((Math.log1p(x) * (1.0 / n))) - Math.pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = math.log((x / (x + 1.0))) / (0.0 - n) tmp = 0 if n <= -30500000000.0: tmp = t_0 elif n <= 28500000000.0: tmp = math.exp((math.log1p(x) * (1.0 / n))) - math.pow(x, (1.0 / n)) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)) tmp = 0.0 if (n <= -30500000000.0) tmp = t_0; elseif (n <= 28500000000.0) tmp = Float64(exp(Float64(log1p(x) * Float64(1.0 / n))) - (x ^ Float64(1.0 / n))); else tmp = t_0; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -30500000000.0], t$95$0, If[LessEqual[n, 28500000000.0], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] * N[(1.0 / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{if}\;n \leq -30500000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 28500000000:\\
\;\;\;\;e^{\mathsf{log1p}\left(x\right) \cdot \frac{1}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -3.05e10 or 2.85e10 < n Initial program 34.8%
Taylor expanded in n around -inf
Simplified78.0%
Applied egg-rr53.0%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6478.4%
Simplified78.4%
if -3.05e10 < n < 2.85e10Initial program 92.8%
flip-+N/A
clear-numN/A
inv-powN/A
pow-powN/A
div-invN/A
pow-to-expN/A
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
clear-numN/A
flip-+N/A
log-divN/A
metadata-evalN/A
--lowering--.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f64N/A
/-lowering-/.f6498.7%
Applied egg-rr98.7%
Final simplification87.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log (/ x (+ x 1.0))) (- 0.0 n))))
(if (<= n -34500000000.0)
t_0
(if (<= n 52000000000.0)
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))
t_0))))
double code(double x, double n) {
double t_0 = log((x / (x + 1.0))) / (0.0 - n);
double tmp;
if (n <= -34500000000.0) {
tmp = t_0;
} else if (n <= 52000000000.0) {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.log((x / (x + 1.0))) / (0.0 - n);
double tmp;
if (n <= -34500000000.0) {
tmp = t_0;
} else if (n <= 52000000000.0) {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = math.log((x / (x + 1.0))) / (0.0 - n) tmp = 0 if n <= -34500000000.0: tmp = t_0 elif n <= 52000000000.0: tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(0.0 - n)) tmp = 0.0 if (n <= -34500000000.0) tmp = t_0; elseif (n <= 52000000000.0) tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); else tmp = t_0; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -34500000000.0], t$95$0, If[LessEqual[n, 52000000000.0], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{if}\;n \leq -34500000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 52000000000:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -3.45e10 or 5.2e10 < n Initial program 34.8%
Taylor expanded in n around -inf
Simplified78.0%
Applied egg-rr53.0%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6478.4%
Simplified78.4%
if -3.45e10 < n < 5.2e10Initial program 92.8%
pow-to-expN/A
exp-lowering-exp.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-log1p.f6498.7%
Applied egg-rr98.7%
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 (+ x 1.0))) (- 0.0 n))
(-
(+
(*
x
(+
(/ 1.0 n)
(/
(+
(* x (+ -0.5 (* x 0.3333333333333333)))
(/ (* x (+ 0.5 (* x -0.5))) n))
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 / (x + 1.0))) / (0.0 - n);
} else {
tmp = ((x * ((1.0 / n) + (((x * (-0.5 + (x * 0.3333333333333333))) + ((x * (0.5 + (x * -0.5))) / n)) / 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 / (x + 1.0d0))) / (0.0d0 - n)
else
tmp = ((x * ((1.0d0 / n) + (((x * ((-0.5d0) + (x * 0.3333333333333333d0))) + ((x * (0.5d0 + (x * (-0.5d0)))) / n)) / 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 / (x + 1.0))) / (0.0 - n);
} else {
tmp = ((x * ((1.0 / n) + (((x * (-0.5 + (x * 0.3333333333333333))) + ((x * (0.5 + (x * -0.5))) / n)) / 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 / (x + 1.0))) / (0.0 - n) else: tmp = ((x * ((1.0 / n) + (((x * (-0.5 + (x * 0.3333333333333333))) + ((x * (0.5 + (x * -0.5))) / n)) / 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(x / Float64(x + 1.0))) / Float64(0.0 - n)); else tmp = Float64(Float64(Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * Float64(-0.5 + Float64(x * 0.3333333333333333))) + Float64(Float64(x * Float64(0.5 + Float64(x * -0.5))) / n)) / 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 / (x + 1.0))) / (0.0 - n); else tmp = ((x * ((1.0 / n) + (((x * (-0.5 + (x * 0.3333333333333333))) + ((x * (0.5 + (x * -0.5))) / n)) / 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[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * N[(-0.5 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x * N[(0.5 + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $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}{x + 1}\right)}{0 - n}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(\frac{1}{n} + \frac{x \cdot \left(-0.5 + x \cdot 0.3333333333333333\right) + \frac{x \cdot \left(0.5 + x \cdot -0.5\right)}{n}}{n}\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
Simplified77.1%
Applied egg-rr52.4%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6477.5%
Simplified77.5%
if 2e12 < (/.f64 #s(literal 1 binary64) n) Initial program 76.4%
Taylor expanded in x around 0
Simplified60.4%
Taylor expanded in n around inf
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6496.2%
Simplified96.2%
Final simplification86.4%
(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 (+ x 1.0))) (- 0.0 n))
(-
(+
(*
x
(+
(/ 1.0 n)
(/
(+
(* x (+ -0.5 (* x 0.3333333333333333)))
(/ (* x (+ 0.5 (* x -0.5))) n))
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 / (x + 1.0))) / (0.0 - n);
} else {
tmp = ((x * ((1.0 / n) + (((x * (-0.5 + (x * 0.3333333333333333))) + ((x * (0.5 + (x * -0.5))) / n)) / 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 / (x + 1.0d0))) / (0.0d0 - n)
else
tmp = ((x * ((1.0d0 / n) + (((x * ((-0.5d0) + (x * 0.3333333333333333d0))) + ((x * (0.5d0 + (x * (-0.5d0)))) / n)) / 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 / (x + 1.0))) / (0.0 - n);
} else {
tmp = ((x * ((1.0 / n) + (((x * (-0.5 + (x * 0.3333333333333333))) + ((x * (0.5 + (x * -0.5))) / n)) / 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 / (x + 1.0))) / (0.0 - n) else: tmp = ((x * ((1.0 / n) + (((x * (-0.5 + (x * 0.3333333333333333))) + ((x * (0.5 + (x * -0.5))) / n)) / 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(x / Float64(x + 1.0))) / Float64(0.0 - n)); else tmp = Float64(Float64(Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * Float64(-0.5 + Float64(x * 0.3333333333333333))) + Float64(Float64(x * Float64(0.5 + Float64(x * -0.5))) / n)) / 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 / (x + 1.0))) / (0.0 - n); else tmp = ((x * ((1.0 / n) + (((x * (-0.5 + (x * 0.3333333333333333))) + ((x * (0.5 + (x * -0.5))) / n)) / 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[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * N[(-0.5 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x * N[(0.5 + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $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 -5 \cdot 10^{-83}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2000000000000:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(\frac{1}{n} + \frac{x \cdot \left(-0.5 + x \cdot 0.3333333333333333\right) + \frac{x \cdot \left(0.5 + x \cdot -0.5\right)}{n}}{n}\right) + 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
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6493.0%
Simplified93.0%
if -5e-83 < (/.f64 #s(literal 1 binary64) n) < 2e12Initial program 35.5%
Taylor expanded in n around -inf
Simplified79.2%
Applied egg-rr54.4%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6479.6%
Simplified79.6%
if 2e12 < (/.f64 #s(literal 1 binary64) n) Initial program 76.4%
Taylor expanded in x around 0
Simplified60.4%
Taylor expanded in n around inf
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6496.2%
Simplified96.2%
Final simplification86.2%
(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 (+ x 1.0))) (- 0.0 n))
(- (+ (* x (+ (/ 1.0 n) (/ (* x (+ -0.5 (/ 0.5 n))) 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 / (x + 1.0))) / (0.0 - n);
} else {
tmp = ((x * ((1.0 / n) + ((x * (-0.5 + (0.5 / n))) / 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 / (x + 1.0d0))) / (0.0d0 - n)
else
tmp = ((x * ((1.0d0 / n) + ((x * ((-0.5d0) + (0.5d0 / n))) / 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 / (x + 1.0))) / (0.0 - n);
} else {
tmp = ((x * ((1.0 / n) + ((x * (-0.5 + (0.5 / n))) / 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 / (x + 1.0))) / (0.0 - n) else: tmp = ((x * ((1.0 / n) + ((x * (-0.5 + (0.5 / n))) / 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(x / Float64(x + 1.0))) / Float64(0.0 - n)); else tmp = Float64(Float64(Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(x * Float64(-0.5 + Float64(0.5 / n))) / 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 / (x + 1.0))) / (0.0 - n); else tmp = ((x * ((1.0 / n) + ((x * (-0.5 + (0.5 / n))) / 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[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(x * N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $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 -5 \cdot 10^{-83}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2000000000000:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{0 - n}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(\frac{1}{n} + \frac{x \cdot \left(-0.5 + \frac{0.5}{n}\right)}{n}\right) + 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
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6493.0%
Simplified93.0%
if -5e-83 < (/.f64 #s(literal 1 binary64) n) < 2e12Initial program 35.5%
Taylor expanded in n around -inf
Simplified79.2%
Applied egg-rr54.4%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6479.6%
Simplified79.6%
if 2e12 < (/.f64 #s(literal 1 binary64) n) Initial program 76.4%
Taylor expanded in x around 0
Simplified60.4%
Taylor expanded in n around inf
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6496.2%
Simplified96.2%
Taylor expanded in x around 0
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sub-negN/A
sub-negN/A
associate-*r/N/A
metadata-evalN/A
unpow2N/A
associate-/r*N/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-subN/A
associate-/l*N/A
Simplified96.2%
Final simplification86.2%
(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 (+ x 1.0))) (- 0.0 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 / (x + 1.0))) / (0.0 - 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 / (x + 1.0d0))) / (0.0d0 - 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 / (x + 1.0))) / (0.0 - 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 / (x + 1.0))) / (0.0 - 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(x / Float64(x + 1.0))) / Float64(0.0 - 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 / (x + 1.0))) / (0.0 - 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[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $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}{x + 1}\right)}{0 - 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
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6493.0%
Simplified93.0%
if -5e-83 < (/.f64 #s(literal 1 binary64) n) < 2e12Initial program 35.5%
Taylor expanded in n around -inf
Simplified79.2%
Applied egg-rr54.4%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6479.6%
Simplified79.6%
if 2e12 < (/.f64 #s(literal 1 binary64) n) Initial program 76.4%
Taylor expanded in x around 0
*-rgt-identityN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f6480.5%
Simplified80.5%
Final simplification84.7%
(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 (+ x 1.0))) (- 0.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) <= -5e-83) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2000000000000.0) {
tmp = log((x / (x + 1.0))) / (0.0 - 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 / (x + 1.0d0))) / (0.0d0 - 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 / (x + 1.0))) / (0.0 - 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 / (x + 1.0))) / (0.0 - 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(x / Float64(x + 1.0))) / Float64(0.0 - 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 / (x + 1.0))) / (0.0 - 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[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $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}{x + 1}\right)}{0 - 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
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6493.0%
Simplified93.0%
if -5e-83 < (/.f64 #s(literal 1 binary64) n) < 2e12Initial program 35.5%
Taylor expanded in n around -inf
Simplified79.2%
Applied egg-rr54.4%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6479.6%
Simplified79.6%
if 2e12 < (/.f64 #s(literal 1 binary64) n) Initial program 76.4%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6476.4%
Simplified76.4%
Final simplification84.3%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) 2000000000000.0) (/ (log (/ x (+ x 1.0))) (- 0.0 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 / (x + 1.0))) / (0.0 - 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 / (x + 1.0d0))) / (0.0d0 - 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 / (x + 1.0))) / (0.0 - 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 / (x + 1.0))) / (0.0 - 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(x / Float64(x + 1.0))) / Float64(0.0 - 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 / (x + 1.0))) / (0.0 - 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[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - n), $MachinePrecision]), $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}{x + 1}\right)}{0 - 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
Simplified80.2%
Applied egg-rr53.4%
Taylor expanded in n around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
mul-1-negN/A
neg-lowering-neg.f6468.7%
Simplified68.7%
if 2e12 < (/.f64 #s(literal 1 binary64) n) Initial program 76.4%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6476.4%
Simplified76.4%
Final simplification69.4%
(FPCore (x n)
:precision binary64
(if (<= x 1.65e-247)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.6)
(- 0.0 (/ (log x) n))
(if (<= x 2.06e+167)
(/ (/ (- (+ (/ 0.3333333333333333 (* x x)) 1.0) (/ 0.5 x)) n) x)
0.0))))
double code(double x, double n) {
double tmp;
if (x <= 1.65e-247) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.6) {
tmp = 0.0 - (log(x) / n);
} else if (x <= 2.06e+167) {
tmp = ((((0.3333333333333333 / (x * x)) + 1.0) - (0.5 / x)) / 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.65d-247) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.6d0) then
tmp = 0.0d0 - (log(x) / n)
else if (x <= 2.06d+167) then
tmp = ((((0.3333333333333333d0 / (x * x)) + 1.0d0) - (0.5d0 / x)) / 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.65e-247) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.6) {
tmp = 0.0 - (Math.log(x) / n);
} else if (x <= 2.06e+167) {
tmp = ((((0.3333333333333333 / (x * x)) + 1.0) - (0.5 / x)) / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.65e-247: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.6: tmp = 0.0 - (math.log(x) / n) elif x <= 2.06e+167: tmp = ((((0.3333333333333333 / (x * x)) + 1.0) - (0.5 / x)) / n) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1.65e-247) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.6) tmp = Float64(0.0 - Float64(log(x) / n)); elseif (x <= 2.06e+167) tmp = Float64(Float64(Float64(Float64(Float64(0.3333333333333333 / Float64(x * x)) + 1.0) - Float64(0.5 / x)) / n) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.65e-247) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.6) tmp = 0.0 - (log(x) / n); elseif (x <= 2.06e+167) tmp = ((((0.3333333333333333 / (x * x)) + 1.0) - (0.5 / x)) / n) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.65e-247], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.6], N[(0.0 - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.06e+167], N[(N[(N[(N[(N[(0.3333333333333333 / N[(x * x), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.65 \cdot 10^{-247}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.6:\\
\;\;\;\;0 - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 2.06 \cdot 10^{+167}:\\
\;\;\;\;\frac{\frac{\left(\frac{0.3333333333333333}{x \cdot x} + 1\right) - \frac{0.5}{x}}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.64999999999999986e-247Initial program 65.9%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6465.9%
Simplified65.9%
if 1.64999999999999986e-247 < x < 0.599999999999999978Initial program 44.4%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6444.1%
Simplified44.1%
Taylor expanded in n around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6454.7%
Simplified54.7%
if 0.599999999999999978 < x < 2.06e167Initial program 49.1%
Taylor expanded in x around inf
Simplified77.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
associate-*r/N/A
metadata-evalN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6471.1%
Simplified71.1%
if 2.06e167 < x Initial program 93.4%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6457.2%
Simplified57.2%
Taylor expanded in n around inf
Simplified93.4%
metadata-eval93.4%
Applied egg-rr93.4%
Final simplification69.1%
(FPCore (x n)
:precision binary64
(if (<= x 0.6)
(- 0.0 (/ (log x) n))
(if (<= x 2.06e+167)
(/ (/ (- (+ (/ 0.3333333333333333 (* x x)) 1.0) (/ 0.5 x)) n) x)
0.0)))
double code(double x, double n) {
double tmp;
if (x <= 0.6) {
tmp = 0.0 - (log(x) / n);
} else if (x <= 2.06e+167) {
tmp = ((((0.3333333333333333 / (x * x)) + 1.0) - (0.5 / x)) / 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 <= 0.6d0) then
tmp = 0.0d0 - (log(x) / n)
else if (x <= 2.06d+167) then
tmp = ((((0.3333333333333333d0 / (x * x)) + 1.0d0) - (0.5d0 / x)) / n) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.6) {
tmp = 0.0 - (Math.log(x) / n);
} else if (x <= 2.06e+167) {
tmp = ((((0.3333333333333333 / (x * x)) + 1.0) - (0.5 / x)) / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.6: tmp = 0.0 - (math.log(x) / n) elif x <= 2.06e+167: tmp = ((((0.3333333333333333 / (x * x)) + 1.0) - (0.5 / x)) / n) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 0.6) tmp = Float64(0.0 - Float64(log(x) / n)); elseif (x <= 2.06e+167) tmp = Float64(Float64(Float64(Float64(Float64(0.3333333333333333 / Float64(x * x)) + 1.0) - Float64(0.5 / x)) / n) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.6) tmp = 0.0 - (log(x) / n); elseif (x <= 2.06e+167) tmp = ((((0.3333333333333333 / (x * x)) + 1.0) - (0.5 / x)) / n) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.6], N[(0.0 - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.06e+167], N[(N[(N[(N[(N[(0.3333333333333333 / N[(x * x), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.6:\\
\;\;\;\;0 - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 2.06 \cdot 10^{+167}:\\
\;\;\;\;\frac{\frac{\left(\frac{0.3333333333333333}{x \cdot x} + 1\right) - \frac{0.5}{x}}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.599999999999999978Initial program 48.5%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6448.2%
Simplified48.2%
Taylor expanded in n around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f6452.1%
Simplified52.1%
if 0.599999999999999978 < x < 2.06e167Initial program 49.1%
Taylor expanded in x around inf
Simplified77.2%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
associate-*r/N/A
metadata-evalN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6471.1%
Simplified71.1%
if 2.06e167 < x Initial program 93.4%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6457.2%
Simplified57.2%
Taylor expanded in n around inf
Simplified93.4%
metadata-eval93.4%
Applied egg-rr93.4%
Final simplification66.7%
(FPCore (x n) :precision binary64 (if (<= x 2.05e+167) (/ (/ (- (+ (/ 0.3333333333333333 (* x x)) 1.0) (/ 0.5 x)) n) x) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 2.05e+167) {
tmp = ((((0.3333333333333333 / (x * x)) + 1.0) - (0.5 / x)) / 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 <= 2.05d+167) then
tmp = ((((0.3333333333333333d0 / (x * x)) + 1.0d0) - (0.5d0 / x)) / n) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.05e+167) {
tmp = ((((0.3333333333333333 / (x * x)) + 1.0) - (0.5 / x)) / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.05e+167: tmp = ((((0.3333333333333333 / (x * x)) + 1.0) - (0.5 / x)) / n) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 2.05e+167) tmp = Float64(Float64(Float64(Float64(Float64(0.3333333333333333 / Float64(x * x)) + 1.0) - Float64(0.5 / x)) / n) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.05e+167) tmp = ((((0.3333333333333333 / (x * x)) + 1.0) - (0.5 / x)) / n) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.05e+167], N[(N[(N[(N[(N[(0.3333333333333333 / N[(x * x), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.05 \cdot 10^{+167}:\\
\;\;\;\;\frac{\frac{\left(\frac{0.3333333333333333}{x \cdot x} + 1\right) - \frac{0.5}{x}}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.05e167Initial program 48.7%
Taylor expanded in x around inf
Simplified34.8%
Taylor expanded in n around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
associate-*r/N/A
metadata-evalN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6444.6%
Simplified44.6%
if 2.05e167 < x Initial program 93.4%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6457.2%
Simplified57.2%
Taylor expanded in n around inf
Simplified93.4%
metadata-eval93.4%
Applied egg-rr93.4%
Final simplification56.4%
(FPCore (x n) :precision binary64 (if (<= x 2.06e+167) (/ (/ (/ (+ x (- (/ 0.3333333333333333 x) 0.5)) n) x) x) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 2.06e+167) {
tmp = (((x + ((0.3333333333333333 / 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 <= 2.06d+167) then
tmp = (((x + ((0.3333333333333333d0 / 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 <= 2.06e+167) {
tmp = (((x + ((0.3333333333333333 / x) - 0.5)) / n) / x) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.06e+167: tmp = (((x + ((0.3333333333333333 / x) - 0.5)) / n) / x) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 2.06e+167) tmp = Float64(Float64(Float64(Float64(x + Float64(Float64(0.3333333333333333 / x) - 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.06e+167) tmp = (((x + ((0.3333333333333333 / x) - 0.5)) / n) / x) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.06e+167], N[(N[(N[(N[(x + N[(N[(0.3333333333333333 / x), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.06 \cdot 10^{+167}:\\
\;\;\;\;\frac{\frac{\frac{x + \left(\frac{0.3333333333333333}{x} - 0.5\right)}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.06e167Initial program 48.7%
Taylor expanded in x around inf
Simplified34.8%
associate-*l/N/A
frac-addN/A
/-lowering-/.f64N/A
Applied egg-rr34.3%
Taylor expanded in n around -inf
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
--lowering--.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6444.6%
Simplified44.6%
if 2.06e167 < x Initial program 93.4%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6457.2%
Simplified57.2%
Taylor expanded in n around inf
Simplified93.4%
metadata-eval93.4%
Applied egg-rr93.4%
Final simplification56.4%
(FPCore (x n) :precision binary64 (if (<= x 1.95e+167) (/ (/ (+ x (- (/ 0.3333333333333333 x) 0.5)) (* x n)) x) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 1.95e+167) {
tmp = ((x + ((0.3333333333333333 / x) - 0.5)) / (x * 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.95d+167) then
tmp = ((x + ((0.3333333333333333d0 / x) - 0.5d0)) / (x * 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.95e+167) {
tmp = ((x + ((0.3333333333333333 / x) - 0.5)) / (x * n)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.95e+167: tmp = ((x + ((0.3333333333333333 / x) - 0.5)) / (x * n)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1.95e+167) tmp = Float64(Float64(Float64(x + Float64(Float64(0.3333333333333333 / x) - 0.5)) / Float64(x * n)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.95e+167) tmp = ((x + ((0.3333333333333333 / x) - 0.5)) / (x * n)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.95e+167], N[(N[(N[(x + N[(N[(0.3333333333333333 / x), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.95 \cdot 10^{+167}:\\
\;\;\;\;\frac{\frac{x + \left(\frac{0.3333333333333333}{x} - 0.5\right)}{x \cdot n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.9499999999999999e167Initial program 48.7%
Taylor expanded in x around inf
Simplified34.8%
associate-*l/N/A
frac-addN/A
/-lowering-/.f64N/A
Applied egg-rr34.3%
Taylor expanded in n around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
--lowering--.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6444.2%
Simplified44.2%
if 1.9499999999999999e167 < x Initial program 93.4%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6457.2%
Simplified57.2%
Taylor expanded in n around inf
Simplified93.4%
metadata-eval93.4%
Applied egg-rr93.4%
Final simplification56.1%
(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
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6447.7%
Simplified47.7%
Taylor expanded in n around inf
Simplified54.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
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6449.2%
Simplified49.2%
associate-/l/N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
/-lowering-/.f6449.2%
Applied egg-rr49.2%
Taylor expanded in n around inf
/-lowering-/.f6449.4%
Simplified49.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
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6447.7%
Simplified47.7%
Taylor expanded in n around inf
Simplified54.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
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6449.2%
Simplified49.2%
Taylor expanded in n around inf
/-lowering-/.f6449.4%
Simplified49.4%
(FPCore (x n) :precision binary64 (if (<= x 2.3e+167) (/ 1.0 (* x n)) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 2.3e+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.3d+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.3e+167) {
tmp = 1.0 / (x * n);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.3e+167: tmp = 1.0 / (x * n) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 2.3e+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.3e+167) tmp = 1.0 / (x * n); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.3e+167], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.3 \cdot 10^{+167}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.29999999999999988e167Initial program 48.7%
Taylor expanded in x around inf
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6452.9%
Simplified52.9%
Taylor expanded in n around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6436.8%
Simplified36.8%
if 2.29999999999999988e167 < x Initial program 93.4%
Taylor expanded in x around 0
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6457.2%
Simplified57.2%
Taylor expanded in n around inf
Simplified93.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
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
--lowering--.f64N/A
log-recN/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
associate-/l*N/A
exp-to-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6443.8%
Simplified43.8%
Taylor expanded in n around inf
Simplified36.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))))