
(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 (<= (/ 1.0 n) -5e-26)
(/ (/ (cbrt (pow x (/ 3.0 n))) n) x)
(if (<= (/ 1.0 n) 5e-134)
(* (* 2.0 (log (sqrt (/ x (+ 1.0 x))))) (/ -1.0 n))
(if (<= (/ 1.0 n) 4e-79)
(/ (/ 1.0 n) x)
(if (<= (/ 1.0 n) 2e-22)
(/ (log (/ (+ 1.0 x) x)) n)
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (cbrt(pow(x, (3.0 / n))) / n) / x;
} else if ((1.0 / n) <= 5e-134) {
tmp = (2.0 * log(sqrt((x / (1.0 + x))))) * (-1.0 / n);
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 2e-22) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (Math.cbrt(Math.pow(x, (3.0 / n))) / n) / x;
} else if ((1.0 / n) <= 5e-134) {
tmp = (2.0 * Math.log(Math.sqrt((x / (1.0 + x))))) * (-1.0 / n);
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 2e-22) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-26) tmp = Float64(Float64(cbrt((x ^ Float64(3.0 / n))) / n) / x); elseif (Float64(1.0 / n) <= 5e-134) tmp = Float64(Float64(2.0 * log(sqrt(Float64(x / Float64(1.0 + x))))) * Float64(-1.0 / n)); elseif (Float64(1.0 / n) <= 4e-79) tmp = Float64(Float64(1.0 / n) / x); elseif (Float64(1.0 / n) <= 2e-22) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-26], N[(N[(N[Power[N[Power[x, N[(3.0 / n), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-134], N[(N[(2.0 * N[Log[N[Sqrt[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-79], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-22], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-26}:\\
\;\;\;\;\frac{\frac{\sqrt[3]{{x}^{\left(\frac{3}{n}\right)}}}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-134}:\\
\;\;\;\;\left(2 \cdot \log \left(\sqrt{\frac{x}{1 + x}}\right)\right) \cdot \frac{-1}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-26Initial program 89.5%
Taylor expanded in x around inf 96.6%
associate-/r*97.0%
mul-1-neg97.0%
log-rec97.0%
mul-1-neg97.0%
distribute-neg-frac97.0%
mul-1-neg97.0%
remove-double-neg97.0%
*-rgt-identity97.0%
associate-/l*97.0%
exp-to-pow97.0%
Simplified97.0%
add-cbrt-cube97.0%
pow397.0%
pow-pow97.0%
Applied egg-rr97.0%
associate-*l/97.0%
metadata-eval97.0%
Simplified97.0%
if -5.00000000000000019e-26 < (/.f64 1 n) < 5.0000000000000003e-134Initial program 35.8%
Taylor expanded in n around inf 87.9%
log1p-define87.9%
Simplified87.9%
log1p-undefine87.9%
diff-log88.0%
Applied egg-rr88.0%
+-commutative88.0%
Simplified88.0%
frac-2neg88.0%
div-inv87.9%
neg-log87.9%
clear-num87.9%
Applied egg-rr87.9%
distribute-frac-neg287.9%
distribute-neg-frac87.9%
metadata-eval87.9%
Simplified87.9%
add-sqr-sqrt87.9%
log-prod88.0%
Applied egg-rr88.0%
count-288.0%
Simplified88.0%
if 5.0000000000000003e-134 < (/.f64 1 n) < 4e-79Initial program 26.1%
Taylor expanded in x around inf 73.5%
associate-/r*76.3%
mul-1-neg76.3%
log-rec76.3%
mul-1-neg76.3%
distribute-neg-frac76.3%
mul-1-neg76.3%
remove-double-neg76.3%
*-rgt-identity76.3%
associate-/l*76.3%
exp-to-pow76.3%
Simplified76.3%
Taylor expanded in n around inf 76.3%
if 4e-79 < (/.f64 1 n) < 2.0000000000000001e-22Initial program 19.1%
Taylor expanded in n around inf 79.7%
log1p-define79.7%
Simplified79.7%
log1p-undefine79.7%
diff-log79.7%
Applied egg-rr79.7%
+-commutative79.7%
Simplified79.7%
if 2.0000000000000001e-22 < (/.f64 1 n) Initial program 54.1%
Taylor expanded in n around 0 54.1%
log1p-define95.1%
*-rgt-identity95.1%
associate-*l/95.1%
associate-/l*95.1%
exp-to-pow95.1%
Simplified95.1%
Final simplification89.9%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -5e-26)
(/ (/ (cbrt (pow x (/ 3.0 n))) n) x)
(if (<= (/ 1.0 n) 5e-134)
(* (* 2.0 (log (sqrt (/ x (+ 1.0 x))))) (/ -1.0 n))
(if (<= (/ 1.0 n) 4e-79)
(/ (/ 1.0 n) x)
(if (<= (/ 1.0 n) 4e-8)
(/ (log (/ (+ 1.0 x) x)) n)
(-
(+ 1.0 (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))))
(pow x (/ 1.0 n))))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (cbrt(pow(x, (3.0 / n))) / n) / x;
} else if ((1.0 / n) <= 5e-134) {
tmp = (2.0 * log(sqrt((x / (1.0 + x))))) * (-1.0 / n);
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (Math.cbrt(Math.pow(x, (3.0 / n))) / n) / x;
} else if ((1.0 / n) <= 5e-134) {
tmp = (2.0 * Math.log(Math.sqrt((x / (1.0 + x))))) * (-1.0 / n);
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - Math.pow(x, (1.0 / n));
}
return tmp;
}
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-26) tmp = Float64(Float64(cbrt((x ^ Float64(3.0 / n))) / n) / x); elseif (Float64(1.0 / n) <= 5e-134) tmp = Float64(Float64(2.0 * log(sqrt(Float64(x / Float64(1.0 + x))))) * Float64(-1.0 / n)); elseif (Float64(1.0 / n) <= 4e-79) tmp = Float64(Float64(1.0 / n) / x); elseif (Float64(1.0 / n) <= 4e-8) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n)))) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-26], N[(N[(N[Power[N[Power[x, N[(3.0 / n), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-134], N[(N[(2.0 * N[Log[N[Sqrt[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-79], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-8], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-26}:\\
\;\;\;\;\frac{\frac{\sqrt[3]{{x}^{\left(\frac{3}{n}\right)}}}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-134}:\\
\;\;\;\;\left(2 \cdot \log \left(\sqrt{\frac{x}{1 + x}}\right)\right) \cdot \frac{-1}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-8}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-26Initial program 89.5%
Taylor expanded in x around inf 96.6%
associate-/r*97.0%
mul-1-neg97.0%
log-rec97.0%
mul-1-neg97.0%
distribute-neg-frac97.0%
mul-1-neg97.0%
remove-double-neg97.0%
*-rgt-identity97.0%
associate-/l*97.0%
exp-to-pow97.0%
Simplified97.0%
add-cbrt-cube97.0%
pow397.0%
pow-pow97.0%
Applied egg-rr97.0%
associate-*l/97.0%
metadata-eval97.0%
Simplified97.0%
if -5.00000000000000019e-26 < (/.f64 1 n) < 5.0000000000000003e-134Initial program 35.8%
Taylor expanded in n around inf 87.9%
log1p-define87.9%
Simplified87.9%
log1p-undefine87.9%
diff-log88.0%
Applied egg-rr88.0%
+-commutative88.0%
Simplified88.0%
frac-2neg88.0%
div-inv87.9%
neg-log87.9%
clear-num87.9%
Applied egg-rr87.9%
distribute-frac-neg287.9%
distribute-neg-frac87.9%
metadata-eval87.9%
Simplified87.9%
add-sqr-sqrt87.9%
log-prod88.0%
Applied egg-rr88.0%
count-288.0%
Simplified88.0%
if 5.0000000000000003e-134 < (/.f64 1 n) < 4e-79Initial program 26.1%
Taylor expanded in x around inf 73.5%
associate-/r*76.3%
mul-1-neg76.3%
log-rec76.3%
mul-1-neg76.3%
distribute-neg-frac76.3%
mul-1-neg76.3%
remove-double-neg76.3%
*-rgt-identity76.3%
associate-/l*76.3%
exp-to-pow76.3%
Simplified76.3%
Taylor expanded in n around inf 76.3%
if 4e-79 < (/.f64 1 n) < 4.0000000000000001e-8Initial program 18.4%
Taylor expanded in n around inf 76.0%
log1p-define76.0%
Simplified76.0%
log1p-undefine76.0%
diff-log76.0%
Applied egg-rr76.0%
+-commutative76.0%
Simplified76.0%
if 4.0000000000000001e-8 < (/.f64 1 n) Initial program 55.4%
Taylor expanded in x around 0 80.0%
Taylor expanded in n around inf 87.7%
Final simplification88.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log (/ (+ 1.0 x) x)) n)))
(if (<= (/ 1.0 n) -5e-26)
(/ (/ (cbrt (pow x (/ 3.0 n))) n) x)
(if (<= (/ 1.0 n) 5e-134)
t_0
(if (<= (/ 1.0 n) 4e-79)
(/ (/ 1.0 n) x)
(if (<= (/ 1.0 n) 4e-8)
t_0
(-
(+ 1.0 (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))))
(pow x (/ 1.0 n)))))))))
double code(double x, double n) {
double t_0 = log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (cbrt(pow(x, (3.0 / n))) / n) / x;
} else if ((1.0 / n) <= 5e-134) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = t_0;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (Math.cbrt(Math.pow(x, (3.0 / n))) / n) / x;
} else if ((1.0 / n) <= 5e-134) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = t_0;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - Math.pow(x, (1.0 / n));
}
return tmp;
}
function code(x, n) t_0 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-26) tmp = Float64(Float64(cbrt((x ^ Float64(3.0 / n))) / n) / x); elseif (Float64(1.0 / n) <= 5e-134) tmp = t_0; elseif (Float64(1.0 / n) <= 4e-79) tmp = Float64(Float64(1.0 / n) / x); elseif (Float64(1.0 / n) <= 4e-8) tmp = t_0; else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n)))) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-26], N[(N[(N[Power[N[Power[x, N[(3.0 / n), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-134], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-79], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-8], t$95$0, N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-26}:\\
\;\;\;\;\frac{\frac{\sqrt[3]{{x}^{\left(\frac{3}{n}\right)}}}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-134}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-26Initial program 89.5%
Taylor expanded in x around inf 96.6%
associate-/r*97.0%
mul-1-neg97.0%
log-rec97.0%
mul-1-neg97.0%
distribute-neg-frac97.0%
mul-1-neg97.0%
remove-double-neg97.0%
*-rgt-identity97.0%
associate-/l*97.0%
exp-to-pow97.0%
Simplified97.0%
add-cbrt-cube97.0%
pow397.0%
pow-pow97.0%
Applied egg-rr97.0%
associate-*l/97.0%
metadata-eval97.0%
Simplified97.0%
if -5.00000000000000019e-26 < (/.f64 1 n) < 5.0000000000000003e-134 or 4e-79 < (/.f64 1 n) < 4.0000000000000001e-8Initial program 33.2%
Taylor expanded in n around inf 86.1%
log1p-define86.1%
Simplified86.1%
log1p-undefine86.1%
diff-log86.1%
Applied egg-rr86.1%
+-commutative86.1%
Simplified86.1%
if 5.0000000000000003e-134 < (/.f64 1 n) < 4e-79Initial program 26.1%
Taylor expanded in x around inf 73.5%
associate-/r*76.3%
mul-1-neg76.3%
log-rec76.3%
mul-1-neg76.3%
distribute-neg-frac76.3%
mul-1-neg76.3%
remove-double-neg76.3%
*-rgt-identity76.3%
associate-/l*76.3%
exp-to-pow76.3%
Simplified76.3%
Taylor expanded in n around inf 76.3%
if 4.0000000000000001e-8 < (/.f64 1 n) Initial program 55.4%
Taylor expanded in x around 0 80.0%
Taylor expanded in n around inf 87.7%
Final simplification88.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log (/ (+ 1.0 x) x)) n)) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-26)
(* (/ t_1 n) (/ 1.0 x))
(if (<= (/ 1.0 n) 5e-134)
t_0
(if (<= (/ 1.0 n) 4e-79)
(/ (/ 1.0 n) x)
(if (<= (/ 1.0 n) 4e-8)
t_0
(-
(+ 1.0 (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))))
t_1)))))))
double code(double x, double n) {
double t_0 = log(((1.0 + x) / x)) / n;
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (t_1 / n) * (1.0 / x);
} else if ((1.0 / n) <= 5e-134) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = t_0;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_1;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = log(((1.0d0 + x) / x)) / n
t_1 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-5d-26)) then
tmp = (t_1 / n) * (1.0d0 / x)
else if ((1.0d0 / n) <= 5d-134) then
tmp = t_0
else if ((1.0d0 / n) <= 4d-79) then
tmp = (1.0d0 / n) / x
else if ((1.0d0 / n) <= 4d-8) then
tmp = t_0
else
tmp = (1.0d0 + (x * ((1.0d0 / n) + (((x * (-0.5d0)) + (0.5d0 * (x / n))) / n)))) - t_1
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(((1.0 + x) / x)) / n;
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (t_1 / n) * (1.0 / x);
} else if ((1.0 / n) <= 5e-134) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = t_0;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_1;
}
return tmp;
}
def code(x, n): t_0 = math.log(((1.0 + x) / x)) / n t_1 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-26: tmp = (t_1 / n) * (1.0 / x) elif (1.0 / n) <= 5e-134: tmp = t_0 elif (1.0 / n) <= 4e-79: tmp = (1.0 / n) / x elif (1.0 / n) <= 4e-8: tmp = t_0 else: tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_1 return tmp
function code(x, n) t_0 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-26) tmp = Float64(Float64(t_1 / n) * Float64(1.0 / x)); elseif (Float64(1.0 / n) <= 5e-134) tmp = t_0; elseif (Float64(1.0 / n) <= 4e-79) tmp = Float64(Float64(1.0 / n) / x); elseif (Float64(1.0 / n) <= 4e-8) tmp = t_0; else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n)))) - t_1); end return tmp end
function tmp_2 = code(x, n) t_0 = log(((1.0 + x) / x)) / n; t_1 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-26) tmp = (t_1 / n) * (1.0 / x); elseif ((1.0 / n) <= 5e-134) tmp = t_0; elseif ((1.0 / n) <= 4e-79) tmp = (1.0 / n) / x; elseif ((1.0 / n) <= 4e-8) tmp = t_0; else tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_1; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-26], N[(N[(t$95$1 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-134], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-79], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-8], t$95$0, N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-26}:\\
\;\;\;\;\frac{t\_1}{n} \cdot \frac{1}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-134}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - t\_1\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-26Initial program 89.5%
Taylor expanded in x around inf 96.6%
associate-/r*97.0%
mul-1-neg97.0%
log-rec97.0%
mul-1-neg97.0%
distribute-neg-frac97.0%
mul-1-neg97.0%
remove-double-neg97.0%
*-rgt-identity97.0%
associate-/l*97.0%
exp-to-pow97.0%
Simplified97.0%
div-inv97.0%
Applied egg-rr97.0%
if -5.00000000000000019e-26 < (/.f64 1 n) < 5.0000000000000003e-134 or 4e-79 < (/.f64 1 n) < 4.0000000000000001e-8Initial program 33.2%
Taylor expanded in n around inf 86.1%
log1p-define86.1%
Simplified86.1%
log1p-undefine86.1%
diff-log86.1%
Applied egg-rr86.1%
+-commutative86.1%
Simplified86.1%
if 5.0000000000000003e-134 < (/.f64 1 n) < 4e-79Initial program 26.1%
Taylor expanded in x around inf 73.5%
associate-/r*76.3%
mul-1-neg76.3%
log-rec76.3%
mul-1-neg76.3%
distribute-neg-frac76.3%
mul-1-neg76.3%
remove-double-neg76.3%
*-rgt-identity76.3%
associate-/l*76.3%
exp-to-pow76.3%
Simplified76.3%
Taylor expanded in n around inf 76.3%
if 4.0000000000000001e-8 < (/.f64 1 n) Initial program 55.4%
Taylor expanded in x around 0 80.0%
Taylor expanded in n around inf 87.7%
Final simplification88.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log (/ (+ 1.0 x) x)) n)) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-26)
(* (/ t_1 n) (/ 1.0 x))
(if (<= (/ 1.0 n) 5e-134)
t_0
(if (<= (/ 1.0 n) 4e-79)
(/ (/ 1.0 n) x)
(if (<= (/ 1.0 n) 4e-8)
t_0
(if (<= (/ 1.0 n) 5e+157)
(- (+ 1.0 (/ x n)) t_1)
(/ (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) n))))))))
double code(double x, double n) {
double t_0 = log(((1.0 + x) / x)) / n;
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (t_1 / n) * (1.0 / x);
} else if ((1.0 / n) <= 5e-134) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+157) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = log(((1.0d0 + x) / x)) / n
t_1 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-5d-26)) then
tmp = (t_1 / n) * (1.0d0 / x)
else if ((1.0d0 / n) <= 5d-134) then
tmp = t_0
else if ((1.0d0 / n) <= 4d-79) then
tmp = (1.0d0 / n) / x
else if ((1.0d0 / n) <= 4d-8) then
tmp = t_0
else if ((1.0d0 / n) <= 5d+157) then
tmp = (1.0d0 + (x / n)) - t_1
else
tmp = ((1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(((1.0 + x) / x)) / n;
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (t_1 / n) * (1.0 / x);
} else if ((1.0 / n) <= 5e-134) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+157) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.log(((1.0 + x) / x)) / n t_1 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-26: tmp = (t_1 / n) * (1.0 / x) elif (1.0 / n) <= 5e-134: tmp = t_0 elif (1.0 / n) <= 4e-79: tmp = (1.0 / n) / x elif (1.0 / n) <= 4e-8: tmp = t_0 elif (1.0 / n) <= 5e+157: tmp = (1.0 + (x / n)) - t_1 else: tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n return tmp
function code(x, n) t_0 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-26) tmp = Float64(Float64(t_1 / n) * Float64(1.0 / x)); elseif (Float64(1.0 / n) <= 5e-134) tmp = t_0; elseif (Float64(1.0 / n) <= 4e-79) tmp = Float64(Float64(1.0 / n) / x); elseif (Float64(1.0 / n) <= 4e-8) tmp = t_0; elseif (Float64(1.0 / n) <= 5e+157) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_1); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = log(((1.0 + x) / x)) / n; t_1 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-26) tmp = (t_1 / n) * (1.0 / x); elseif ((1.0 / n) <= 5e-134) tmp = t_0; elseif ((1.0 / n) <= 4e-79) tmp = (1.0 / n) / x; elseif ((1.0 / n) <= 4e-8) tmp = t_0; elseif ((1.0 / n) <= 5e+157) tmp = (1.0 + (x / n)) - t_1; else tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-26], N[(N[(t$95$1 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-134], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-79], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-8], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+157], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-26}:\\
\;\;\;\;\frac{t\_1}{n} \cdot \frac{1}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-134}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+157}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-26Initial program 89.5%
Taylor expanded in x around inf 96.6%
associate-/r*97.0%
mul-1-neg97.0%
log-rec97.0%
mul-1-neg97.0%
distribute-neg-frac97.0%
mul-1-neg97.0%
remove-double-neg97.0%
*-rgt-identity97.0%
associate-/l*97.0%
exp-to-pow97.0%
Simplified97.0%
div-inv97.0%
Applied egg-rr97.0%
if -5.00000000000000019e-26 < (/.f64 1 n) < 5.0000000000000003e-134 or 4e-79 < (/.f64 1 n) < 4.0000000000000001e-8Initial program 33.2%
Taylor expanded in n around inf 86.1%
log1p-define86.1%
Simplified86.1%
log1p-undefine86.1%
diff-log86.1%
Applied egg-rr86.1%
+-commutative86.1%
Simplified86.1%
if 5.0000000000000003e-134 < (/.f64 1 n) < 4e-79Initial program 26.1%
Taylor expanded in x around inf 73.5%
associate-/r*76.3%
mul-1-neg76.3%
log-rec76.3%
mul-1-neg76.3%
distribute-neg-frac76.3%
mul-1-neg76.3%
remove-double-neg76.3%
*-rgt-identity76.3%
associate-/l*76.3%
exp-to-pow76.3%
Simplified76.3%
Taylor expanded in n around inf 76.3%
if 4.0000000000000001e-8 < (/.f64 1 n) < 4.99999999999999976e157Initial program 92.4%
Taylor expanded in x around 0 93.8%
if 4.99999999999999976e157 < (/.f64 1 n) Initial program 29.6%
Taylor expanded in n around inf 7.3%
log1p-define7.3%
Simplified7.3%
log1p-undefine7.3%
diff-log7.3%
Applied egg-rr7.3%
+-commutative7.3%
Simplified7.3%
Taylor expanded in x around inf 70.7%
Simplified70.7%
Final simplification87.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log (/ (+ 1.0 x) x)) n)))
(if (<= (/ 1.0 n) -5e+48)
(/ (/ 0.3333333333333333 n) (pow x 3.0))
(if (<= (/ 1.0 n) 5e-134)
t_0
(if (<= (/ 1.0 n) 4e-79)
(/ (/ 1.0 n) x)
(if (<= (/ 1.0 n) 4e-8)
t_0
(if (<= (/ 1.0 n) 5e+157)
(- 1.0 (pow x (/ 1.0 n)))
(/ (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) n))))))))
double code(double x, double n) {
double t_0 = log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e+48) {
tmp = (0.3333333333333333 / n) / pow(x, 3.0);
} else if ((1.0 / n) <= 5e-134) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+157) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = log(((1.0d0 + x) / x)) / n
if ((1.0d0 / n) <= (-5d+48)) then
tmp = (0.3333333333333333d0 / n) / (x ** 3.0d0)
else if ((1.0d0 / n) <= 5d-134) then
tmp = t_0
else if ((1.0d0 / n) <= 4d-79) then
tmp = (1.0d0 / n) / x
else if ((1.0d0 / n) <= 4d-8) then
tmp = t_0
else if ((1.0d0 / n) <= 5d+157) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = ((1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e+48) {
tmp = (0.3333333333333333 / n) / Math.pow(x, 3.0);
} else if ((1.0 / n) <= 5e-134) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+157) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.log(((1.0 + x) / x)) / n tmp = 0 if (1.0 / n) <= -5e+48: tmp = (0.3333333333333333 / n) / math.pow(x, 3.0) elif (1.0 / n) <= 5e-134: tmp = t_0 elif (1.0 / n) <= 4e-79: tmp = (1.0 / n) / x elif (1.0 / n) <= 4e-8: tmp = t_0 elif (1.0 / n) <= 5e+157: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n return tmp
function code(x, n) t_0 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e+48) tmp = Float64(Float64(0.3333333333333333 / n) / (x ^ 3.0)); elseif (Float64(1.0 / n) <= 5e-134) tmp = t_0; elseif (Float64(1.0 / n) <= 4e-79) tmp = Float64(Float64(1.0 / n) / x); elseif (Float64(1.0 / n) <= 4e-8) tmp = t_0; elseif (Float64(1.0 / n) <= 5e+157) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = log(((1.0 + x) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -5e+48) tmp = (0.3333333333333333 / n) / (x ^ 3.0); elseif ((1.0 / n) <= 5e-134) tmp = t_0; elseif ((1.0 / n) <= 4e-79) tmp = (1.0 / n) / x; elseif ((1.0 / n) <= 4e-8) tmp = t_0; elseif ((1.0 / n) <= 5e+157) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+48], N[(N[(0.3333333333333333 / n), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-134], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-79], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-8], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+157], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{+48}:\\
\;\;\;\;\frac{\frac{0.3333333333333333}{n}}{{x}^{3}}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-134}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+157}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.99999999999999973e48Initial program 100.0%
Taylor expanded in n around inf 58.2%
log1p-define58.2%
Simplified58.2%
Taylor expanded in x around -inf 34.4%
Taylor expanded in x around 0 75.1%
associate-/r*75.1%
Simplified75.1%
if -4.99999999999999973e48 < (/.f64 1 n) < 5.0000000000000003e-134 or 4e-79 < (/.f64 1 n) < 4.0000000000000001e-8Initial program 35.7%
Taylor expanded in n around inf 83.5%
log1p-define83.5%
Simplified83.5%
log1p-undefine83.5%
diff-log83.6%
Applied egg-rr83.6%
+-commutative83.6%
Simplified83.6%
if 5.0000000000000003e-134 < (/.f64 1 n) < 4e-79Initial program 26.1%
Taylor expanded in x around inf 73.5%
associate-/r*76.3%
mul-1-neg76.3%
log-rec76.3%
mul-1-neg76.3%
distribute-neg-frac76.3%
mul-1-neg76.3%
remove-double-neg76.3%
*-rgt-identity76.3%
associate-/l*76.3%
exp-to-pow76.3%
Simplified76.3%
Taylor expanded in n around inf 76.3%
if 4.0000000000000001e-8 < (/.f64 1 n) < 4.99999999999999976e157Initial program 92.4%
Taylor expanded in x around 0 92.4%
*-rgt-identity92.4%
associate-*l/92.4%
associate-/l*92.4%
exp-to-pow92.4%
Simplified92.4%
if 4.99999999999999976e157 < (/.f64 1 n) Initial program 29.6%
Taylor expanded in n around inf 7.3%
log1p-define7.3%
Simplified7.3%
log1p-undefine7.3%
diff-log7.3%
Applied egg-rr7.3%
+-commutative7.3%
Simplified7.3%
Taylor expanded in x around inf 70.7%
Simplified70.7%
Final simplification80.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ (+ 1.0 x) x)) n)))
(if (<= (/ 1.0 n) -5e-26)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 5e-134)
t_1
(if (<= (/ 1.0 n) 4e-79)
(/ (/ 1.0 n) x)
(if (<= (/ 1.0 n) 4e-8)
t_1
(if (<= (/ 1.0 n) 5e+157)
(- 1.0 t_0)
(/ (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) n))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-134) {
tmp = t_1;
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+157) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = log(((1.0d0 + x) / x)) / n
if ((1.0d0 / n) <= (-5d-26)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 5d-134) then
tmp = t_1
else if ((1.0d0 / n) <= 4d-79) then
tmp = (1.0d0 / n) / x
else if ((1.0d0 / n) <= 4d-8) then
tmp = t_1
else if ((1.0d0 / n) <= 5d+157) then
tmp = 1.0d0 - t_0
else
tmp = ((1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-134) {
tmp = t_1;
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+157) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.log(((1.0 + x) / x)) / n tmp = 0 if (1.0 / n) <= -5e-26: tmp = (t_0 / n) / x elif (1.0 / n) <= 5e-134: tmp = t_1 elif (1.0 / n) <= 4e-79: tmp = (1.0 / n) / x elif (1.0 / n) <= 4e-8: tmp = t_1 elif (1.0 / n) <= 5e+157: tmp = 1.0 - t_0 else: tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-26) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 5e-134) tmp = t_1; elseif (Float64(1.0 / n) <= 4e-79) tmp = Float64(Float64(1.0 / n) / x); elseif (Float64(1.0 / n) <= 4e-8) tmp = t_1; elseif (Float64(1.0 / n) <= 5e+157) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = log(((1.0 + x) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -5e-26) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 5e-134) tmp = t_1; elseif ((1.0 / n) <= 4e-79) tmp = (1.0 / n) / x; elseif ((1.0 / n) <= 4e-8) tmp = t_1; elseif ((1.0 / n) <= 5e+157) tmp = 1.0 - t_0; else tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-26], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-134], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-79], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-8], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+157], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-26}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+157}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-26Initial program 89.5%
Taylor expanded in x around inf 96.6%
associate-/r*97.0%
mul-1-neg97.0%
log-rec97.0%
mul-1-neg97.0%
distribute-neg-frac97.0%
mul-1-neg97.0%
remove-double-neg97.0%
*-rgt-identity97.0%
associate-/l*97.0%
exp-to-pow97.0%
Simplified97.0%
if -5.00000000000000019e-26 < (/.f64 1 n) < 5.0000000000000003e-134 or 4e-79 < (/.f64 1 n) < 4.0000000000000001e-8Initial program 33.2%
Taylor expanded in n around inf 86.1%
log1p-define86.1%
Simplified86.1%
log1p-undefine86.1%
diff-log86.1%
Applied egg-rr86.1%
+-commutative86.1%
Simplified86.1%
if 5.0000000000000003e-134 < (/.f64 1 n) < 4e-79Initial program 26.1%
Taylor expanded in x around inf 73.5%
associate-/r*76.3%
mul-1-neg76.3%
log-rec76.3%
mul-1-neg76.3%
distribute-neg-frac76.3%
mul-1-neg76.3%
remove-double-neg76.3%
*-rgt-identity76.3%
associate-/l*76.3%
exp-to-pow76.3%
Simplified76.3%
Taylor expanded in n around inf 76.3%
if 4.0000000000000001e-8 < (/.f64 1 n) < 4.99999999999999976e157Initial program 92.4%
Taylor expanded in x around 0 92.4%
*-rgt-identity92.4%
associate-*l/92.4%
associate-/l*92.4%
exp-to-pow92.4%
Simplified92.4%
if 4.99999999999999976e157 < (/.f64 1 n) Initial program 29.6%
Taylor expanded in n around inf 7.3%
log1p-define7.3%
Simplified7.3%
log1p-undefine7.3%
diff-log7.3%
Applied egg-rr7.3%
+-commutative7.3%
Simplified7.3%
Taylor expanded in x around inf 70.7%
Simplified70.7%
Final simplification87.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log (/ (+ 1.0 x) x)) n)) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-26)
(* (/ t_1 n) (/ 1.0 x))
(if (<= (/ 1.0 n) 5e-134)
t_0
(if (<= (/ 1.0 n) 4e-79)
(/ (/ 1.0 n) x)
(if (<= (/ 1.0 n) 4e-8)
t_0
(if (<= (/ 1.0 n) 5e+157)
(- 1.0 t_1)
(/ (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) n))))))))
double code(double x, double n) {
double t_0 = log(((1.0 + x) / x)) / n;
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (t_1 / n) * (1.0 / x);
} else if ((1.0 / n) <= 5e-134) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+157) {
tmp = 1.0 - t_1;
} else {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = log(((1.0d0 + x) / x)) / n
t_1 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-5d-26)) then
tmp = (t_1 / n) * (1.0d0 / x)
else if ((1.0d0 / n) <= 5d-134) then
tmp = t_0
else if ((1.0d0 / n) <= 4d-79) then
tmp = (1.0d0 / n) / x
else if ((1.0d0 / n) <= 4d-8) then
tmp = t_0
else if ((1.0d0 / n) <= 5d+157) then
tmp = 1.0d0 - t_1
else
tmp = ((1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(((1.0 + x) / x)) / n;
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-26) {
tmp = (t_1 / n) * (1.0 / x);
} else if ((1.0 / n) <= 5e-134) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-79) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e-8) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+157) {
tmp = 1.0 - t_1;
} else {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.log(((1.0 + x) / x)) / n t_1 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-26: tmp = (t_1 / n) * (1.0 / x) elif (1.0 / n) <= 5e-134: tmp = t_0 elif (1.0 / n) <= 4e-79: tmp = (1.0 / n) / x elif (1.0 / n) <= 4e-8: tmp = t_0 elif (1.0 / n) <= 5e+157: tmp = 1.0 - t_1 else: tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n return tmp
function code(x, n) t_0 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-26) tmp = Float64(Float64(t_1 / n) * Float64(1.0 / x)); elseif (Float64(1.0 / n) <= 5e-134) tmp = t_0; elseif (Float64(1.0 / n) <= 4e-79) tmp = Float64(Float64(1.0 / n) / x); elseif (Float64(1.0 / n) <= 4e-8) tmp = t_0; elseif (Float64(1.0 / n) <= 5e+157) tmp = Float64(1.0 - t_1); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = log(((1.0 + x) / x)) / n; t_1 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-26) tmp = (t_1 / n) * (1.0 / x); elseif ((1.0 / n) <= 5e-134) tmp = t_0; elseif ((1.0 / n) <= 4e-79) tmp = (1.0 / n) / x; elseif ((1.0 / n) <= 4e-8) tmp = t_0; elseif ((1.0 / n) <= 5e+157) tmp = 1.0 - t_1; else tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-26], N[(N[(t$95$1 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-134], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-79], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-8], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+157], N[(1.0 - t$95$1), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-26}:\\
\;\;\;\;\frac{t\_1}{n} \cdot \frac{1}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-134}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+157}:\\
\;\;\;\;1 - t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-26Initial program 89.5%
Taylor expanded in x around inf 96.6%
associate-/r*97.0%
mul-1-neg97.0%
log-rec97.0%
mul-1-neg97.0%
distribute-neg-frac97.0%
mul-1-neg97.0%
remove-double-neg97.0%
*-rgt-identity97.0%
associate-/l*97.0%
exp-to-pow97.0%
Simplified97.0%
div-inv97.0%
Applied egg-rr97.0%
if -5.00000000000000019e-26 < (/.f64 1 n) < 5.0000000000000003e-134 or 4e-79 < (/.f64 1 n) < 4.0000000000000001e-8Initial program 33.2%
Taylor expanded in n around inf 86.1%
log1p-define86.1%
Simplified86.1%
log1p-undefine86.1%
diff-log86.1%
Applied egg-rr86.1%
+-commutative86.1%
Simplified86.1%
if 5.0000000000000003e-134 < (/.f64 1 n) < 4e-79Initial program 26.1%
Taylor expanded in x around inf 73.5%
associate-/r*76.3%
mul-1-neg76.3%
log-rec76.3%
mul-1-neg76.3%
distribute-neg-frac76.3%
mul-1-neg76.3%
remove-double-neg76.3%
*-rgt-identity76.3%
associate-/l*76.3%
exp-to-pow76.3%
Simplified76.3%
Taylor expanded in n around inf 76.3%
if 4.0000000000000001e-8 < (/.f64 1 n) < 4.99999999999999976e157Initial program 92.4%
Taylor expanded in x around 0 92.4%
*-rgt-identity92.4%
associate-*l/92.4%
associate-/l*92.4%
exp-to-pow92.4%
Simplified92.4%
if 4.99999999999999976e157 < (/.f64 1 n) Initial program 29.6%
Taylor expanded in n around inf 7.3%
log1p-define7.3%
Simplified7.3%
log1p-undefine7.3%
diff-log7.3%
Applied egg-rr7.3%
+-commutative7.3%
Simplified7.3%
Taylor expanded in x around inf 70.7%
Simplified70.7%
Final simplification87.2%
(FPCore (x n)
:precision binary64
(if (<= x 21000.0)
(/ (- x (log x)) n)
(if (or (<= x 1.05e+72) (not (<= x 2.55e+173)))
(/ 0.0 n)
(/ (- (/ 1.0 n) (/ (/ 0.5 n) x)) x))))
double code(double x, double n) {
double tmp;
if (x <= 21000.0) {
tmp = (x - log(x)) / n;
} else if ((x <= 1.05e+72) || !(x <= 2.55e+173)) {
tmp = 0.0 / n;
} else {
tmp = ((1.0 / n) - ((0.5 / n) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 21000.0d0) then
tmp = (x - log(x)) / n
else if ((x <= 1.05d+72) .or. (.not. (x <= 2.55d+173))) then
tmp = 0.0d0 / n
else
tmp = ((1.0d0 / n) - ((0.5d0 / n) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 21000.0) {
tmp = (x - Math.log(x)) / n;
} else if ((x <= 1.05e+72) || !(x <= 2.55e+173)) {
tmp = 0.0 / n;
} else {
tmp = ((1.0 / n) - ((0.5 / n) / x)) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 21000.0: tmp = (x - math.log(x)) / n elif (x <= 1.05e+72) or not (x <= 2.55e+173): tmp = 0.0 / n else: tmp = ((1.0 / n) - ((0.5 / n) / x)) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 21000.0) tmp = Float64(Float64(x - log(x)) / n); elseif ((x <= 1.05e+72) || !(x <= 2.55e+173)) tmp = Float64(0.0 / n); else tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(0.5 / n) / x)) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 21000.0) tmp = (x - log(x)) / n; elseif ((x <= 1.05e+72) || ~((x <= 2.55e+173))) tmp = 0.0 / n; else tmp = ((1.0 / n) - ((0.5 / n) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 21000.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[Or[LessEqual[x, 1.05e+72], N[Not[LessEqual[x, 2.55e+173]], $MachinePrecision]], N[(0.0 / n), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(0.5 / n), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 21000:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+72} \lor \neg \left(x \leq 2.55 \cdot 10^{+173}\right):\\
\;\;\;\;\frac{0}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if x < 21000Initial program 33.0%
Taylor expanded in n around inf 60.5%
log1p-define60.5%
Simplified60.5%
Taylor expanded in x around 0 58.9%
if 21000 < x < 1.0500000000000001e72 or 2.54999999999999975e173 < x Initial program 83.1%
Taylor expanded in n around inf 79.6%
log1p-define79.6%
Simplified79.6%
log1p-undefine79.6%
diff-log79.6%
Applied egg-rr79.6%
+-commutative79.6%
Simplified79.6%
Taylor expanded in x around inf 83.2%
if 1.0500000000000001e72 < x < 2.54999999999999975e173Initial program 42.6%
Taylor expanded in n around inf 42.6%
log1p-define42.6%
Simplified42.6%
Taylor expanded in x around inf 82.8%
associate-*r/82.8%
metadata-eval82.8%
associate-/r*82.8%
Simplified82.8%
Final simplification69.9%
(FPCore (x n)
:precision binary64
(if (<= x 1.0)
(/ (log x) (- n))
(if (or (<= x 1.05e+72) (not (<= x 5.5e+173)))
(/ 0.0 n)
(/ (- (/ 1.0 n) (/ (/ 0.5 n) x)) x))))
double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = log(x) / -n;
} else if ((x <= 1.05e+72) || !(x <= 5.5e+173)) {
tmp = 0.0 / n;
} else {
tmp = ((1.0 / n) - ((0.5 / n) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.0d0) then
tmp = log(x) / -n
else if ((x <= 1.05d+72) .or. (.not. (x <= 5.5d+173))) then
tmp = 0.0d0 / n
else
tmp = ((1.0d0 / n) - ((0.5d0 / n) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = Math.log(x) / -n;
} else if ((x <= 1.05e+72) || !(x <= 5.5e+173)) {
tmp = 0.0 / n;
} else {
tmp = ((1.0 / n) - ((0.5 / n) / x)) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.0: tmp = math.log(x) / -n elif (x <= 1.05e+72) or not (x <= 5.5e+173): tmp = 0.0 / n else: tmp = ((1.0 / n) - ((0.5 / n) / x)) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 1.0) tmp = Float64(log(x) / Float64(-n)); elseif ((x <= 1.05e+72) || !(x <= 5.5e+173)) tmp = Float64(0.0 / n); else tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(0.5 / n) / x)) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.0) tmp = log(x) / -n; elseif ((x <= 1.05e+72) || ~((x <= 5.5e+173))) tmp = 0.0 / n; else tmp = ((1.0 / n) - ((0.5 / n) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.0], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[Or[LessEqual[x, 1.05e+72], N[Not[LessEqual[x, 5.5e+173]], $MachinePrecision]], N[(0.0 / n), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(0.5 / n), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+72} \lor \neg \left(x \leq 5.5 \cdot 10^{+173}\right):\\
\;\;\;\;\frac{0}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if x < 1Initial program 33.4%
Taylor expanded in n around inf 60.3%
log1p-define60.3%
Simplified60.3%
Taylor expanded in x around 0 58.9%
neg-mul-158.9%
Simplified58.9%
if 1 < x < 1.0500000000000001e72 or 5.50000000000000049e173 < x Initial program 81.3%
Taylor expanded in n around inf 79.6%
log1p-define79.6%
Simplified79.6%
log1p-undefine79.6%
diff-log79.7%
Applied egg-rr79.7%
+-commutative79.7%
Simplified79.7%
Taylor expanded in x around inf 81.3%
if 1.0500000000000001e72 < x < 5.50000000000000049e173Initial program 42.6%
Taylor expanded in n around inf 42.6%
log1p-define42.6%
Simplified42.6%
Taylor expanded in x around inf 82.8%
associate-*r/82.8%
metadata-eval82.8%
associate-/r*82.8%
Simplified82.8%
Final simplification69.5%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -500000.0) (/ 0.0 n) (/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x)) x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -500000.0) {
tmp = 0.0 / n;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= (-500000.0d0)) then
tmp = 0.0d0 / n
else
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -500000.0) {
tmp = 0.0 / n;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -500000.0: tmp = 0.0 / n else: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -500000.0) tmp = Float64(0.0 / n); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -500000.0) tmp = 0.0 / n; else tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -500000.0], N[(0.0 / n), $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -500000:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5e5Initial program 100.0%
Taylor expanded in n around inf 63.3%
log1p-define63.3%
Simplified63.3%
log1p-undefine63.3%
diff-log63.3%
Applied egg-rr63.3%
+-commutative63.3%
Simplified63.3%
Taylor expanded in x around inf 67.2%
if -5e5 < (/.f64 1 n) Initial program 36.3%
Taylor expanded in n around inf 64.6%
log1p-define64.6%
Simplified64.6%
log1p-undefine64.6%
diff-log64.7%
Applied egg-rr64.7%
+-commutative64.7%
Simplified64.7%
Taylor expanded in x around inf 42.3%
Simplified49.0%
Final simplification53.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)))
(if (<= x 4.9e+173)
(/ (/ (+ 1.0 t_0) x) n)
(+ -1.0 (- 1.0 (/ (+ -1.0 t_0) (* n x)))))))
double code(double x, double n) {
double t_0 = (-0.5 + (0.3333333333333333 / x)) / x;
double tmp;
if (x <= 4.9e+173) {
tmp = ((1.0 + t_0) / x) / n;
} else {
tmp = -1.0 + (1.0 - ((-1.0 + 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 = ((-0.5d0) + (0.3333333333333333d0 / x)) / x
if (x <= 4.9d+173) then
tmp = ((1.0d0 + t_0) / x) / n
else
tmp = (-1.0d0) + (1.0d0 - (((-1.0d0) + t_0) / (n * x)))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (-0.5 + (0.3333333333333333 / x)) / x;
double tmp;
if (x <= 4.9e+173) {
tmp = ((1.0 + t_0) / x) / n;
} else {
tmp = -1.0 + (1.0 - ((-1.0 + t_0) / (n * x)));
}
return tmp;
}
def code(x, n): t_0 = (-0.5 + (0.3333333333333333 / x)) / x tmp = 0 if x <= 4.9e+173: tmp = ((1.0 + t_0) / x) / n else: tmp = -1.0 + (1.0 - ((-1.0 + t_0) / (n * x))) return tmp
function code(x, n) t_0 = Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x) tmp = 0.0 if (x <= 4.9e+173) tmp = Float64(Float64(Float64(1.0 + t_0) / x) / n); else tmp = Float64(-1.0 + Float64(1.0 - Float64(Float64(-1.0 + t_0) / Float64(n * x)))); end return tmp end
function tmp_2 = code(x, n) t_0 = (-0.5 + (0.3333333333333333 / x)) / x; tmp = 0.0; if (x <= 4.9e+173) tmp = ((1.0 + t_0) / x) / n; else tmp = -1.0 + (1.0 - ((-1.0 + t_0) / (n * x))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, 4.9e+173], N[(N[(N[(1.0 + t$95$0), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[(-1.0 + N[(1.0 - N[(N[(-1.0 + t$95$0), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}\\
\mathbf{if}\;x \leq 4.9 \cdot 10^{+173}:\\
\;\;\;\;\frac{\frac{1 + t\_0}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(1 - \frac{-1 + t\_0}{n \cdot x}\right)\\
\end{array}
\end{array}
if x < 4.9000000000000001e173Initial program 39.4%
Taylor expanded in n around inf 57.4%
log1p-define57.4%
Simplified57.4%
log1p-undefine57.4%
diff-log57.5%
Applied egg-rr57.5%
+-commutative57.5%
Simplified57.5%
Taylor expanded in x around inf 39.1%
Simplified39.1%
if 4.9000000000000001e173 < x Initial program 87.4%
Taylor expanded in n around inf 87.5%
log1p-define87.5%
Simplified87.5%
Taylor expanded in x around -inf 64.4%
div-sub64.4%
add-sqr-sqrt64.4%
sqrt-unprod64.4%
mul-1-neg64.4%
mul-1-neg64.4%
sqr-neg64.4%
sqrt-unprod0.0%
add-sqr-sqrt64.4%
sub-neg64.4%
un-div-inv64.4%
metadata-eval64.4%
Applied egg-rr64.4%
expm1-log1p-u64.2%
expm1-undefine77.3%
mul-1-neg77.3%
sub-div77.3%
Applied egg-rr77.3%
sub-neg77.3%
metadata-eval77.3%
+-commutative77.3%
log1p-undefine77.3%
rem-exp-log77.6%
distribute-frac-neg77.6%
unsub-neg77.6%
associate-/r*77.6%
sub-neg77.6%
metadata-eval77.6%
+-commutative77.6%
+-commutative77.6%
Simplified77.6%
Final simplification47.9%
(FPCore (x n)
:precision binary64
(if (<= x 1.72e+179)
(/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x)) x)
(+
-1.0
(- 1.0 (/ (+ -1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) (* n x))))))
double code(double x, double n) {
double tmp;
if (x <= 1.72e+179) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
} else {
tmp = -1.0 + (1.0 - ((-1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (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 <= 1.72d+179) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
else
tmp = (-1.0d0) + (1.0d0 - (((-1.0d0) + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / (n * x)))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.72e+179) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
} else {
tmp = -1.0 + (1.0 - ((-1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (n * x)));
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.72e+179: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x else: tmp = -1.0 + (1.0 - ((-1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (n * x))) return tmp
function code(x, n) tmp = 0.0 if (x <= 1.72e+179) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); else tmp = Float64(-1.0 + Float64(1.0 - Float64(Float64(-1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / Float64(n * x)))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.72e+179) tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; else tmp = -1.0 + (1.0 - ((-1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (n * x))); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.72e+179], 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], N[(-1.0 + N[(1.0 - N[(N[(-1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.72 \cdot 10^{+179}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(1 - \frac{-1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{n \cdot x}\right)\\
\end{array}
\end{array}
if x < 1.7200000000000001e179Initial program 40.4%
Taylor expanded in n around inf 58.1%
log1p-define58.1%
Simplified58.1%
log1p-undefine58.1%
diff-log58.1%
Applied egg-rr58.1%
+-commutative58.1%
Simplified58.1%
Taylor expanded in x around inf 27.9%
Simplified39.0%
if 1.7200000000000001e179 < x Initial program 86.8%
Taylor expanded in n around inf 86.8%
log1p-define86.8%
Simplified86.8%
Taylor expanded in x around -inf 66.0%
div-sub66.0%
add-sqr-sqrt66.0%
sqrt-unprod66.0%
mul-1-neg66.0%
mul-1-neg66.0%
sqr-neg66.0%
sqrt-unprod0.0%
add-sqr-sqrt66.0%
sub-neg66.0%
un-div-inv66.0%
metadata-eval66.0%
Applied egg-rr66.0%
expm1-log1p-u65.8%
expm1-undefine79.7%
mul-1-neg79.7%
sub-div79.7%
Applied egg-rr79.7%
sub-neg79.7%
metadata-eval79.7%
+-commutative79.7%
log1p-undefine79.7%
rem-exp-log79.8%
distribute-frac-neg79.8%
unsub-neg79.8%
associate-/r*79.8%
sub-neg79.8%
metadata-eval79.8%
+-commutative79.8%
+-commutative79.8%
Simplified79.8%
Final simplification48.0%
(FPCore (x n) :precision binary64 (* (/ 1.0 n) (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x)))
double code(double x, double n) {
return (1.0 / n) * ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) * ((1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / x)
end function
public static double code(double x, double n) {
return (1.0 / n) * ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x);
}
def code(x, n): return (1.0 / n) * ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x)
function code(x, n) return Float64(Float64(1.0 / n) * Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / x)) end
function tmp = code(x, n) tmp = (1.0 / n) * ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x); end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] * N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n} \cdot \frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}
\end{array}
Initial program 50.5%
Taylor expanded in n around inf 64.3%
log1p-define64.3%
Simplified64.3%
Taylor expanded in x around -inf 44.9%
div-inv44.9%
Applied egg-rr44.9%
Final simplification44.9%
(FPCore (x n) :precision binary64 (/ (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) n))
double code(double x, double n) {
return ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / x) / n
end function
public static double code(double x, double n) {
return ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
}
def code(x, n): return ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n
function code(x, n) return Float64(Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / x) / n) end
function tmp = code(x, n) tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n; end
code[x_, n_] := N[(N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}}{n}
\end{array}
Initial program 50.5%
Taylor expanded in n around inf 64.3%
log1p-define64.3%
Simplified64.3%
log1p-undefine64.3%
diff-log64.4%
Applied egg-rr64.4%
+-commutative64.4%
Simplified64.4%
Taylor expanded in x around inf 44.9%
Simplified44.9%
Final simplification44.9%
(FPCore (x n) :precision binary64 (/ (+ (/ 1.0 n) (/ 0.5 (* n x))) x))
double code(double x, double n) {
return ((1.0 / n) + (0.5 / (n * x))) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 / n) + (0.5d0 / (n * x))) / x
end function
public static double code(double x, double n) {
return ((1.0 / n) + (0.5 / (n * x))) / x;
}
def code(x, n): return ((1.0 / n) + (0.5 / (n * x))) / x
function code(x, n) return Float64(Float64(Float64(1.0 / n) + Float64(0.5 / Float64(n * x))) / x) end
function tmp = code(x, n) tmp = ((1.0 / n) + (0.5 / (n * x))) / x; end
code[x_, n_] := N[(N[(N[(1.0 / n), $MachinePrecision] + N[(0.5 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n} + \frac{0.5}{n \cdot x}}{x}
\end{array}
Initial program 50.5%
Taylor expanded in n around inf 64.3%
log1p-define64.3%
Simplified64.3%
Taylor expanded in x around -inf 44.9%
div-sub44.9%
add-sqr-sqrt30.9%
sqrt-unprod31.5%
mul-1-neg31.5%
mul-1-neg31.5%
sqr-neg31.5%
sqrt-unprod0.6%
add-sqr-sqrt31.2%
sub-neg31.2%
un-div-inv31.2%
metadata-eval31.2%
Applied egg-rr31.2%
Taylor expanded in x around inf 43.7%
associate-*r/43.7%
metadata-eval43.7%
*-commutative43.7%
Simplified43.7%
Final simplification43.7%
(FPCore (x n) :precision binary64 (/ 1.0 (* n x)))
double code(double x, double n) {
return 1.0 / (n * x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (n * x)
end function
public static double code(double x, double n) {
return 1.0 / (n * x);
}
def code(x, n): return 1.0 / (n * x)
function code(x, n) return Float64(1.0 / Float64(n * x)) end
function tmp = code(x, n) tmp = 1.0 / (n * x); end
code[x_, n_] := N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n \cdot x}
\end{array}
Initial program 50.5%
Taylor expanded in n around inf 64.3%
log1p-define64.3%
Simplified64.3%
Taylor expanded in x around inf 41.3%
*-commutative41.3%
Simplified41.3%
Final simplification41.3%
(FPCore (x n) :precision binary64 (/ (/ 1.0 n) x))
double code(double x, double n) {
return (1.0 / n) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) / x
end function
public static double code(double x, double n) {
return (1.0 / n) / x;
}
def code(x, n): return (1.0 / n) / x
function code(x, n) return Float64(Float64(1.0 / n) / x) end
function tmp = code(x, n) tmp = (1.0 / n) / x; end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n}}{x}
\end{array}
Initial program 50.5%
Taylor expanded in x around inf 55.3%
associate-/r*55.8%
mul-1-neg55.8%
log-rec55.8%
mul-1-neg55.8%
distribute-neg-frac55.8%
mul-1-neg55.8%
remove-double-neg55.8%
*-rgt-identity55.8%
associate-/l*55.8%
exp-to-pow55.8%
Simplified55.8%
Taylor expanded in n around inf 41.6%
Final simplification41.6%
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
return x / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = x / n
end function
public static double code(double x, double n) {
return x / n;
}
def code(x, n): return x / n
function code(x, n) return Float64(x / n) end
function tmp = code(x, n) tmp = x / n; end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{n}
\end{array}
Initial program 50.5%
Taylor expanded in x around 0 25.7%
Taylor expanded in x around inf 4.6%
Final simplification4.6%
herbie shell --seed 2024053
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))