
(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 13 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 1.0) (fma (* x x) (/ -0.5 n) (- (/ x n) (expm1 (/ (log x) n)))) (/ (/ (pow x (/ 1.0 n)) x) n)))
double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = fma((x * x), (-0.5 / n), ((x / n) - expm1((log(x) / n))));
} else {
tmp = (pow(x, (1.0 / n)) / x) / n;
}
return tmp;
}
function code(x, n) tmp = 0.0 if (x <= 1.0) tmp = fma(Float64(x * x), Float64(-0.5 / n), Float64(Float64(x / n) - expm1(Float64(log(x) / n)))); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / x) / n); end return tmp end
code[x_, n_] := If[LessEqual[x, 1.0], N[(N[(x * x), $MachinePrecision] * N[(-0.5 / n), $MachinePrecision] + N[(N[(x / n), $MachinePrecision] - N[(Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \frac{-0.5}{n}, \frac{x}{n} - \mathsf{expm1}\left(\frac{\log x}{n}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{x}}{n}\\
\end{array}
\end{array}
if x < 1Initial program 47.0%
Taylor expanded in x around 0
Applied rewrites74.1%
Taylor expanded in n around inf
Applied rewrites86.9%
if 1 < x Initial program 67.0%
Taylor expanded in x around inf
associate-/l/N/A
lower-/.f64N/A
lower-/.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
lower-pow.f64N/A
lower-/.f6498.7
Applied rewrites98.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (pow (+ 1.0 x) (/ 1.0 n)) t_0)))
(if (<= t_1 -5000.0)
(- (+ (/ x n) 1.0) t_0)
(if (<= t_1 0.5309801530229148)
(/ (log (/ (+ 1.0 x) x)) n)
(* (/ (fma (fma -0.5 x 1.0) n (* 0.5 x)) (* n n)) x)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((1.0 + x), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -5000.0) {
tmp = ((x / n) + 1.0) - t_0;
} else if (t_1 <= 0.5309801530229148) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = (fma(fma(-0.5, x, 1.0), n, (0.5 * x)) / (n * n)) * x;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64((Float64(1.0 + x) ^ Float64(1.0 / n)) - t_0) tmp = 0.0 if (t_1 <= -5000.0) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); elseif (t_1 <= 0.5309801530229148) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = Float64(Float64(fma(fma(-0.5, x, 1.0), n, Float64(0.5 * x)) / Float64(n * n)) * x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(1.0 + x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -5000.0], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 0.5309801530229148], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(N[(-0.5 * x + 1.0), $MachinePrecision] * n + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -5000:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{elif}\;t\_1 \leq 0.5309801530229148:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.5, x, 1\right), n, 0.5 \cdot x\right)}{n \cdot n} \cdot x\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -5e3Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-rgt-identityN/A
associate-*r/N/A
lower-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f6499.4
Applied rewrites99.4%
if -5e3 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.53098015302291479Initial program 42.5%
Taylor expanded in n around inf
lower-/.f64N/A
Applied rewrites80.2%
Applied rewrites80.3%
Taylor expanded in n around inf
Applied rewrites80.2%
if 0.53098015302291479 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 53.4%
Taylor expanded in x around 0
Applied rewrites68.6%
Taylor expanded in n around 0
Applied rewrites29.2%
Applied rewrites51.1%
Final simplification80.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (pow (+ 1.0 x) (/ 1.0 n)) t_0)))
(if (<= t_1 -5000.0)
(- 1.0 t_0)
(if (<= t_1 0.5309801530229148)
(/ (log (/ (+ 1.0 x) x)) n)
(* (/ (fma (fma -0.5 x 1.0) n (* 0.5 x)) (* n n)) x)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((1.0 + x), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -5000.0) {
tmp = 1.0 - t_0;
} else if (t_1 <= 0.5309801530229148) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = (fma(fma(-0.5, x, 1.0), n, (0.5 * x)) / (n * n)) * x;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64((Float64(1.0 + x) ^ Float64(1.0 / n)) - t_0) tmp = 0.0 if (t_1 <= -5000.0) tmp = Float64(1.0 - t_0); elseif (t_1 <= 0.5309801530229148) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = Float64(Float64(fma(fma(-0.5, x, 1.0), n, Float64(0.5 * x)) / Float64(n * n)) * x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(1.0 + x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -5000.0], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 0.5309801530229148], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(N[(-0.5 * x + 1.0), $MachinePrecision] * n + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -5000:\\
\;\;\;\;1 - t\_0\\
\mathbf{elif}\;t\_1 \leq 0.5309801530229148:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.5, x, 1\right), n, 0.5 \cdot x\right)}{n \cdot n} \cdot x\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -5e3Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites99.1%
if -5e3 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.53098015302291479Initial program 42.5%
Taylor expanded in n around inf
lower-/.f64N/A
Applied rewrites80.2%
Applied rewrites80.3%
Taylor expanded in n around inf
Applied rewrites80.2%
if 0.53098015302291479 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 53.4%
Taylor expanded in x around 0
Applied rewrites68.6%
Taylor expanded in n around 0
Applied rewrites29.2%
Applied rewrites51.1%
Final simplification80.4%
(FPCore (x n) :precision binary64 (if (<= (- (pow (+ 1.0 x) (/ 1.0 n)) (pow x (/ 1.0 n))) 0.5309801530229148) (/ (/ 1.0 x) n) (* (/ (fma (fma -0.5 x 1.0) n (* 0.5 x)) (* n n)) x)))
double code(double x, double n) {
double tmp;
if ((pow((1.0 + x), (1.0 / n)) - pow(x, (1.0 / n))) <= 0.5309801530229148) {
tmp = (1.0 / x) / n;
} else {
tmp = (fma(fma(-0.5, x, 1.0), n, (0.5 * x)) / (n * n)) * x;
}
return tmp;
}
function code(x, n) tmp = 0.0 if (Float64((Float64(1.0 + x) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) <= 0.5309801530229148) tmp = Float64(Float64(1.0 / x) / n); else tmp = Float64(Float64(fma(fma(-0.5, x, 1.0), n, Float64(0.5 * x)) / Float64(n * n)) * x); end return tmp end
code[x_, n_] := If[LessEqual[N[(N[Power[N[(1.0 + x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.5309801530229148], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(N[(-0.5 * x + 1.0), $MachinePrecision] * n + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \leq 0.5309801530229148:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.5, x, 1\right), n, 0.5 \cdot x\right)}{n \cdot n} \cdot x\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.53098015302291479Initial program 55.3%
Taylor expanded in n around inf
lower-/.f64N/A
Applied rewrites75.8%
Taylor expanded in x around inf
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
log-recN/A
remove-double-negN/A
lower-exp.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-*.f6468.4
Applied rewrites68.4%
Taylor expanded in n around inf
Applied rewrites47.0%
if 0.53098015302291479 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 53.4%
Taylor expanded in x around 0
Applied rewrites68.6%
Taylor expanded in n around 0
Applied rewrites29.2%
Applied rewrites51.1%
Final simplification47.5%
(FPCore (x n) :precision binary64 (if (<= x 1.0) (- (/ x n) (expm1 (/ (log x) n))) (/ (/ (pow x (/ 1.0 n)) x) n)))
double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = (x / n) - expm1((log(x) / n));
} else {
tmp = (pow(x, (1.0 / n)) / x) / n;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = (x / n) - Math.expm1((Math.log(x) / n));
} else {
tmp = (Math.pow(x, (1.0 / n)) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.0: tmp = (x / n) - math.expm1((math.log(x) / n)) else: tmp = (math.pow(x, (1.0 / n)) / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(x / n) - expm1(Float64(log(x) / n))); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / x) / n); end return tmp end
code[x_, n_] := If[LessEqual[x, 1.0], N[(N[(x / n), $MachinePrecision] - N[(Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{x}{n} - \mathsf{expm1}\left(\frac{\log x}{n}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{x}}{n}\\
\end{array}
\end{array}
if x < 1Initial program 47.0%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
*-rgt-identityN/A
associate-*r/N/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-fracN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-+l-N/A
lower--.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f64N/A
Applied rewrites86.8%
if 1 < x Initial program 67.0%
Taylor expanded in x around inf
associate-/l/N/A
lower-/.f64N/A
lower-/.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
lower-pow.f64N/A
lower-/.f6498.7
Applied rewrites98.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-157)
(/ (/ t_0 x) n)
(if (<= (/ 1.0 n) 2e-30)
(/ (log (/ (+ 1.0 x) x)) n)
(- (fma (fma (- (/ 0.5 (* n n)) (/ 0.5 n)) x (/ 1.0 n)) x 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-157) {
tmp = (t_0 / x) / n;
} else if ((1.0 / n) <= 2e-30) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = fma(fma(((0.5 / (n * n)) - (0.5 / n)), x, (1.0 / n)), x, 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-157) tmp = Float64(Float64(t_0 / x) / n); elseif (Float64(1.0 / n) <= 2e-30) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = Float64(fma(fma(Float64(Float64(0.5 / Float64(n * n)) - Float64(0.5 / n)), x, Float64(1.0 / n)), x, 1.0) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-157], N[(N[(t$95$0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-30], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * x + N[(1.0 / n), $MachinePrecision]), $MachinePrecision] * x + 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^{-157}:\\
\;\;\;\;\frac{\frac{t\_0}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-30}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}, x, \frac{1}{n}\right), x, 1\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5.0000000000000002e-157Initial program 73.3%
Taylor expanded in x around inf
associate-/l/N/A
lower-/.f64N/A
lower-/.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
lower-pow.f64N/A
lower-/.f6488.0
Applied rewrites88.0%
if -5.0000000000000002e-157 < (/.f64 #s(literal 1 binary64) n) < 2e-30Initial program 34.4%
Taylor expanded in n around inf
lower-/.f64N/A
Applied rewrites86.7%
Applied rewrites86.8%
Taylor expanded in n around inf
Applied rewrites86.8%
if 2e-30 < (/.f64 #s(literal 1 binary64) n) Initial program 54.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f6482.1
Applied rewrites82.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (/ 1.0 x) n)))
(if (<= (/ 1.0 n) -5e-17)
t_0
(if (<= (/ 1.0 n) -1e-302)
t_1
(if (<= (/ 1.0 n) 2e-79)
(/ (fma (* -0.5 x) x (- x (log x))) n)
(if (<= (/ 1.0 n) 2e-30)
t_1
(if (<= (/ 1.0 n) 4e+144)
t_0
(* (/ (fma (fma -0.5 x 1.0) n (* 0.5 x)) (* n n)) x))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double t_1 = (1.0 / x) / n;
double tmp;
if ((1.0 / n) <= -5e-17) {
tmp = t_0;
} else if ((1.0 / n) <= -1e-302) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-79) {
tmp = fma((-0.5 * x), x, (x - log(x))) / n;
} else if ((1.0 / n) <= 2e-30) {
tmp = t_1;
} else if ((1.0 / n) <= 4e+144) {
tmp = t_0;
} else {
tmp = (fma(fma(-0.5, x, 1.0), n, (0.5 * x)) / (n * n)) * x;
}
return tmp;
}
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_1 = Float64(Float64(1.0 / x) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-17) tmp = t_0; elseif (Float64(1.0 / n) <= -1e-302) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-79) tmp = Float64(fma(Float64(-0.5 * x), x, Float64(x - log(x))) / n); elseif (Float64(1.0 / n) <= 2e-30) tmp = t_1; elseif (Float64(1.0 / n) <= 4e+144) tmp = t_0; else tmp = Float64(Float64(fma(fma(-0.5, x, 1.0), n, Float64(0.5 * x)) / Float64(n * n)) * x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-17], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-302], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-79], N[(N[(N[(-0.5 * x), $MachinePrecision] * x + N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-30], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+144], t$95$0, N[(N[(N[(N[(-0.5 * x + 1.0), $MachinePrecision] * n + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\frac{1}{x}}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-302}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-79}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.5 \cdot x, x, x - \log x\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+144}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.5, x, 1\right), n, 0.5 \cdot x\right)}{n \cdot n} \cdot x\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.9999999999999999e-17 or 2e-30 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000009e144Initial program 94.7%
Taylor expanded in x around 0
Applied rewrites63.7%
if -4.9999999999999999e-17 < (/.f64 #s(literal 1 binary64) n) < -9.9999999999999996e-303 or 2e-79 < (/.f64 #s(literal 1 binary64) n) < 2e-30Initial program 36.2%
Taylor expanded in n around inf
lower-/.f64N/A
Applied rewrites70.3%
Taylor expanded in x around inf
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
log-recN/A
remove-double-negN/A
lower-exp.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-*.f6465.4
Applied rewrites65.4%
Taylor expanded in n around inf
Applied rewrites65.9%
if -9.9999999999999996e-303 < (/.f64 #s(literal 1 binary64) n) < 2e-79Initial program 20.2%
Taylor expanded in x around 0
Applied rewrites70.7%
Taylor expanded in n around inf
Applied rewrites70.7%
if 4.00000000000000009e144 < (/.f64 #s(literal 1 binary64) n) Initial program 33.4%
Taylor expanded in x around 0
Applied rewrites68.8%
Taylor expanded in n around 0
Applied rewrites51.8%
Applied rewrites93.9%
Final simplification67.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-157)
(/ (/ t_0 x) n)
(if (<= (/ 1.0 n) 2e-30)
(/ (log (/ (+ 1.0 x) x)) n)
(- (fma (/ (fma (- (/ 0.5 n) 0.5) x 1.0) n) x 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-157) {
tmp = (t_0 / x) / n;
} else if ((1.0 / n) <= 2e-30) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = fma((fma(((0.5 / n) - 0.5), x, 1.0) / n), x, 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-157) tmp = Float64(Float64(t_0 / x) / n); elseif (Float64(1.0 / n) <= 2e-30) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = Float64(fma(Float64(fma(Float64(Float64(0.5 / n) - 0.5), x, 1.0) / n), x, 1.0) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-157], N[(N[(t$95$0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-30], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(N[(N[(N[(0.5 / n), $MachinePrecision] - 0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] / n), $MachinePrecision] * x + 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^{-157}:\\
\;\;\;\;\frac{\frac{t\_0}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-30}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{0.5}{n} - 0.5, x, 1\right)}{n}, x, 1\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5.0000000000000002e-157Initial program 73.3%
Taylor expanded in x around inf
associate-/l/N/A
lower-/.f64N/A
lower-/.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
lower-pow.f64N/A
lower-/.f6488.0
Applied rewrites88.0%
if -5.0000000000000002e-157 < (/.f64 #s(literal 1 binary64) n) < 2e-30Initial program 34.4%
Taylor expanded in n around inf
lower-/.f64N/A
Applied rewrites86.7%
Applied rewrites86.8%
Taylor expanded in n around inf
Applied rewrites86.8%
if 2e-30 < (/.f64 #s(literal 1 binary64) n) Initial program 54.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f6482.1
Applied rewrites82.1%
Taylor expanded in n around inf
Applied rewrites73.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-157)
(/ (/ t_0 x) n)
(if (<= (/ 1.0 n) 2e-30)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 4e+144)
(- (+ (/ x n) 1.0) t_0)
(* (/ (fma (fma -0.5 x 1.0) n (* 0.5 x)) (* n n)) x))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-157) {
tmp = (t_0 / x) / n;
} else if ((1.0 / n) <= 2e-30) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 4e+144) {
tmp = ((x / n) + 1.0) - t_0;
} else {
tmp = (fma(fma(-0.5, x, 1.0), n, (0.5 * x)) / (n * n)) * x;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-157) tmp = Float64(Float64(t_0 / x) / n); elseif (Float64(1.0 / n) <= 2e-30) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 4e+144) tmp = Float64(Float64(Float64(x / n) + 1.0) - t_0); else tmp = Float64(Float64(fma(fma(-0.5, x, 1.0), n, Float64(0.5 * x)) / Float64(n * n)) * x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-157], N[(N[(t$95$0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-30], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+144], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(N[(-0.5 * x + 1.0), $MachinePrecision] * n + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-157}:\\
\;\;\;\;\frac{\frac{t\_0}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-30}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+144}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.5, x, 1\right), n, 0.5 \cdot x\right)}{n \cdot n} \cdot x\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5.0000000000000002e-157Initial program 73.3%
Taylor expanded in x around inf
associate-/l/N/A
lower-/.f64N/A
lower-/.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
lower-pow.f64N/A
lower-/.f6488.0
Applied rewrites88.0%
if -5.0000000000000002e-157 < (/.f64 #s(literal 1 binary64) n) < 2e-30Initial program 34.4%
Taylor expanded in n around inf
lower-/.f64N/A
Applied rewrites86.7%
Applied rewrites86.8%
Taylor expanded in n around inf
Applied rewrites86.8%
if 2e-30 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000009e144Initial program 76.2%
Taylor expanded in x around 0
+-commutativeN/A
*-rgt-identityN/A
associate-*r/N/A
lower-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f6470.2
Applied rewrites70.2%
if 4.00000000000000009e144 < (/.f64 #s(literal 1 binary64) n) Initial program 33.4%
Taylor expanded in x around 0
Applied rewrites68.8%
Taylor expanded in n around 0
Applied rewrites51.8%
Applied rewrites93.9%
Final simplification86.8%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -2e-77)
(/ (pow (* x x) (/ 0.5 n)) (* n x))
(if (<= (/ 1.0 n) 2e-30)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 4e+144)
(- (+ (/ x n) 1.0) (pow x (/ 1.0 n)))
(* (/ (fma (fma -0.5 x 1.0) n (* 0.5 x)) (* n n)) x)))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = pow((x * x), (0.5 / n)) / (n * x);
} else if ((1.0 / n) <= 2e-30) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 4e+144) {
tmp = ((x / n) + 1.0) - pow(x, (1.0 / n));
} else {
tmp = (fma(fma(-0.5, x, 1.0), n, (0.5 * x)) / (n * n)) * x;
}
return tmp;
}
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-77) tmp = Float64((Float64(x * x) ^ Float64(0.5 / n)) / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-30) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 4e+144) tmp = Float64(Float64(Float64(x / n) + 1.0) - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(fma(fma(-0.5, x, 1.0), n, Float64(0.5 * x)) / Float64(n * n)) * x); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-77], N[(N[Power[N[(x * x), $MachinePrecision], N[(0.5 / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-30], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+144], N[(N[(N[(x / n), $MachinePrecision] + 1.0), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-0.5 * x + 1.0), $MachinePrecision] * n + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-77}:\\
\;\;\;\;\frac{{\left(x \cdot x\right)}^{\left(\frac{0.5}{n}\right)}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-30}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+144}:\\
\;\;\;\;\left(\frac{x}{n} + 1\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.5, x, 1\right), n, 0.5 \cdot x\right)}{n \cdot n} \cdot x\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-77Initial program 84.2%
Taylor expanded in n around inf
lower-/.f64N/A
Applied rewrites68.5%
Taylor expanded in x around inf
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
log-recN/A
remove-double-negN/A
lower-exp.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-*.f6493.3
Applied rewrites93.3%
Applied rewrites90.5%
if -1.9999999999999999e-77 < (/.f64 #s(literal 1 binary64) n) < 2e-30Initial program 32.0%
Taylor expanded in n around inf
lower-/.f64N/A
Applied rewrites82.1%
Applied rewrites82.1%
Taylor expanded in n around inf
Applied rewrites82.1%
if 2e-30 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000009e144Initial program 76.2%
Taylor expanded in x around 0
+-commutativeN/A
*-rgt-identityN/A
associate-*r/N/A
lower-+.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f6470.2
Applied rewrites70.2%
if 4.00000000000000009e144 < (/.f64 #s(literal 1 binary64) n) Initial program 33.4%
Taylor expanded in x around 0
Applied rewrites68.8%
Taylor expanded in n around 0
Applied rewrites51.8%
Applied rewrites93.9%
Final simplification85.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -5e-17)
t_0
(if (<= (/ 1.0 n) 2e-30)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 4e+144)
t_0
(* (/ (fma (fma -0.5 x 1.0) n (* 0.5 x)) (* n n)) x))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-17) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-30) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 4e+144) {
tmp = t_0;
} else {
tmp = (fma(fma(-0.5, x, 1.0), n, (0.5 * x)) / (n * n)) * x;
}
return tmp;
}
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -5e-17) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-30) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 4e+144) tmp = t_0; else tmp = Float64(Float64(fma(fma(-0.5, x, 1.0), n, Float64(0.5 * x)) / Float64(n * n)) * x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-17], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-30], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+144], t$95$0, N[(N[(N[(N[(-0.5 * x + 1.0), $MachinePrecision] * n + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-30}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+144}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.5, x, 1\right), n, 0.5 \cdot x\right)}{n \cdot n} \cdot x\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.9999999999999999e-17 or 2e-30 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000009e144Initial program 94.7%
Taylor expanded in x around 0
Applied rewrites63.7%
if -4.9999999999999999e-17 < (/.f64 #s(literal 1 binary64) n) < 2e-30Initial program 30.1%
Taylor expanded in n around inf
lower-/.f64N/A
Applied rewrites76.9%
Taylor expanded in x around inf
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
log-recN/A
remove-double-negN/A
lower-exp.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-*.f6452.6
Applied rewrites52.6%
Taylor expanded in n around inf
Applied rewrites52.9%
if 4.00000000000000009e144 < (/.f64 #s(literal 1 binary64) n) Initial program 33.4%
Taylor expanded in x around 0
Applied rewrites68.8%
Taylor expanded in n around 0
Applied rewrites51.8%
Applied rewrites93.9%
Final simplification59.6%
(FPCore (x n) :precision binary64 (/ (/ 1.0 x) n))
double code(double x, double n) {
return (1.0 / x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / x) / n
end function
public static double code(double x, double n) {
return (1.0 / x) / n;
}
def code(x, n): return (1.0 / x) / n
function code(x, n) return Float64(Float64(1.0 / x) / n) end
function tmp = code(x, n) tmp = (1.0 / x) / n; end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{n}
\end{array}
Initial program 55.0%
Taylor expanded in n around inf
lower-/.f64N/A
Applied rewrites66.7%
Taylor expanded in x around inf
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
log-recN/A
remove-double-negN/A
lower-exp.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-*.f6460.3
Applied rewrites60.3%
Taylor expanded in n around inf
Applied rewrites45.3%
(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 55.0%
Taylor expanded in x around 0
Applied rewrites45.0%
Taylor expanded in n around 0
Applied rewrites6.2%
Taylor expanded in x around 0
Applied rewrites4.3%
herbie shell --seed 2024284
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))