
(FPCore (x) :precision binary64 (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))
double code(double x) {
return (1.0 / (x + 1.0)) - (1.0 / (x - 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / (x + 1.0d0)) - (1.0d0 / (x - 1.0d0))
end function
public static double code(double x) {
return (1.0 / (x + 1.0)) - (1.0 / (x - 1.0));
}
def code(x): return (1.0 / (x + 1.0)) - (1.0 / (x - 1.0))
function code(x) return Float64(Float64(1.0 / Float64(x + 1.0)) - Float64(1.0 / Float64(x - 1.0))) end
function tmp = code(x) tmp = (1.0 / (x + 1.0)) - (1.0 / (x - 1.0)); end
code[x_] := N[(N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x + 1} - \frac{1}{x - 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))
double code(double x) {
return (1.0 / (x + 1.0)) - (1.0 / (x - 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / (x + 1.0d0)) - (1.0d0 / (x - 1.0d0))
end function
public static double code(double x) {
return (1.0 / (x + 1.0)) - (1.0 / (x - 1.0));
}
def code(x): return (1.0 / (x + 1.0)) - (1.0 / (x - 1.0))
function code(x) return Float64(Float64(1.0 / Float64(x + 1.0)) - Float64(1.0 / Float64(x - 1.0))) end
function tmp = code(x) tmp = (1.0 / (x + 1.0)) - (1.0 / (x - 1.0)); end
code[x_] := N[(N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x + 1} - \frac{1}{x - 1}
\end{array}
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (/ (/ 2.0 (+ x_m 1.0)) (- 1.0 x_m)))
x_m = fabs(x);
double code(double x_m) {
return (2.0 / (x_m + 1.0)) / (1.0 - x_m);
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
code = (2.0d0 / (x_m + 1.0d0)) / (1.0d0 - x_m)
end function
x_m = Math.abs(x);
public static double code(double x_m) {
return (2.0 / (x_m + 1.0)) / (1.0 - x_m);
}
x_m = math.fabs(x) def code(x_m): return (2.0 / (x_m + 1.0)) / (1.0 - x_m)
x_m = abs(x) function code(x_m) return Float64(Float64(2.0 / Float64(x_m + 1.0)) / Float64(1.0 - x_m)) end
x_m = abs(x); function tmp = code(x_m) tmp = (2.0 / (x_m + 1.0)) / (1.0 - x_m); end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := N[(N[(2.0 / N[(x$95$m + 1.0), $MachinePrecision]), $MachinePrecision] / N[(1.0 - x$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{\frac{2}{x_m + 1}}{1 - x_m}
\end{array}
Initial program 82.9%
sub-neg82.9%
+-commutative82.9%
distribute-neg-frac82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
associate-/r*82.9%
metadata-eval82.9%
neg-mul-182.9%
sub0-neg82.9%
associate-+l-82.9%
neg-sub082.9%
remove-double-neg82.9%
distribute-neg-in82.9%
sub-neg82.9%
mul-1-neg82.9%
metadata-eval82.9%
associate-/r*82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
associate-*l/82.9%
Simplified82.9%
frac-sub83.4%
*-rgt-identity83.4%
metadata-eval83.4%
div-inv83.4%
associate-/r*83.4%
*-un-lft-identity83.4%
metadata-eval83.4%
div-inv83.4%
associate--l-85.7%
div-inv85.7%
metadata-eval85.7%
*-rgt-identity85.7%
div-inv85.7%
metadata-eval85.7%
*-rgt-identity85.7%
Applied egg-rr85.7%
frac-2neg85.7%
div-inv85.6%
distribute-neg-frac85.6%
associate--r+83.4%
associate--r-83.4%
neg-mul-183.4%
sub-neg83.4%
distribute-rgt-in83.4%
metadata-eval83.4%
cancel-sign-sub-inv83.4%
*-commutative83.4%
neg-mul-183.4%
Applied egg-rr83.4%
associate-*l/83.4%
sub-neg83.4%
remove-double-neg83.4%
associate-*r/83.4%
associate--l-83.4%
+-commutative83.4%
associate-+l-85.6%
associate--l+99.9%
+-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Final simplification99.9%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= x_m 1.0) 2.0 (/ 2.0 (* x_m (- -1.0 x_m)))))
x_m = fabs(x);
double code(double x_m) {
double tmp;
if (x_m <= 1.0) {
tmp = 2.0;
} else {
tmp = 2.0 / (x_m * (-1.0 - x_m));
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
real(8) :: tmp
if (x_m <= 1.0d0) then
tmp = 2.0d0
else
tmp = 2.0d0 / (x_m * ((-1.0d0) - x_m))
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m) {
double tmp;
if (x_m <= 1.0) {
tmp = 2.0;
} else {
tmp = 2.0 / (x_m * (-1.0 - x_m));
}
return tmp;
}
x_m = math.fabs(x) def code(x_m): tmp = 0 if x_m <= 1.0: tmp = 2.0 else: tmp = 2.0 / (x_m * (-1.0 - x_m)) return tmp
x_m = abs(x) function code(x_m) tmp = 0.0 if (x_m <= 1.0) tmp = 2.0; else tmp = Float64(2.0 / Float64(x_m * Float64(-1.0 - x_m))); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m) tmp = 0.0; if (x_m <= 1.0) tmp = 2.0; else tmp = 2.0 / (x_m * (-1.0 - x_m)); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[x$95$m, 1.0], 2.0, N[(2.0 / N[(x$95$m * N[(-1.0 - x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x_m \leq 1:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{x_m \cdot \left(-1 - x_m\right)}\\
\end{array}
\end{array}
if x < 1Initial program 90.4%
sub-neg90.4%
+-commutative90.4%
distribute-neg-frac90.4%
metadata-eval90.4%
metadata-eval90.4%
metadata-eval90.4%
associate-/r*90.4%
metadata-eval90.4%
neg-mul-190.4%
sub0-neg90.4%
associate-+l-90.4%
neg-sub090.4%
remove-double-neg90.4%
distribute-neg-in90.4%
sub-neg90.4%
mul-1-neg90.4%
metadata-eval90.4%
associate-/r*90.4%
metadata-eval90.4%
metadata-eval90.4%
metadata-eval90.4%
metadata-eval90.4%
associate-*l/90.4%
Simplified90.4%
Taylor expanded in x around 0 70.0%
if 1 < x Initial program 53.4%
sub-neg53.4%
+-commutative53.4%
distribute-neg-frac53.4%
metadata-eval53.4%
metadata-eval53.4%
metadata-eval53.4%
associate-/r*53.4%
metadata-eval53.4%
neg-mul-153.4%
sub0-neg53.4%
associate-+l-53.4%
neg-sub053.4%
remove-double-neg53.4%
distribute-neg-in53.4%
sub-neg53.4%
mul-1-neg53.4%
metadata-eval53.4%
associate-/r*53.4%
metadata-eval53.4%
metadata-eval53.4%
metadata-eval53.4%
metadata-eval53.4%
associate-*l/53.4%
Simplified53.4%
frac-sub54.7%
*-rgt-identity54.7%
metadata-eval54.7%
div-inv54.7%
associate-/r*54.7%
*-un-lft-identity54.7%
metadata-eval54.7%
div-inv54.7%
associate--l-60.9%
div-inv60.9%
metadata-eval60.9%
*-rgt-identity60.9%
div-inv60.9%
metadata-eval60.9%
*-rgt-identity60.9%
Applied egg-rr60.9%
Taylor expanded in x around inf 98.1%
expm1-log1p-u98.1%
expm1-udef51.7%
associate-/l/51.7%
Applied egg-rr51.7%
expm1-def98.2%
expm1-log1p98.2%
*-commutative98.2%
Simplified98.2%
Final simplification75.7%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= x_m 0.75) 2.0 (/ 2.0 (* x_m (- 1.0 x_m)))))
x_m = fabs(x);
double code(double x_m) {
double tmp;
if (x_m <= 0.75) {
tmp = 2.0;
} else {
tmp = 2.0 / (x_m * (1.0 - x_m));
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
real(8) :: tmp
if (x_m <= 0.75d0) then
tmp = 2.0d0
else
tmp = 2.0d0 / (x_m * (1.0d0 - x_m))
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m) {
double tmp;
if (x_m <= 0.75) {
tmp = 2.0;
} else {
tmp = 2.0 / (x_m * (1.0 - x_m));
}
return tmp;
}
x_m = math.fabs(x) def code(x_m): tmp = 0 if x_m <= 0.75: tmp = 2.0 else: tmp = 2.0 / (x_m * (1.0 - x_m)) return tmp
x_m = abs(x) function code(x_m) tmp = 0.0 if (x_m <= 0.75) tmp = 2.0; else tmp = Float64(2.0 / Float64(x_m * Float64(1.0 - x_m))); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m) tmp = 0.0; if (x_m <= 0.75) tmp = 2.0; else tmp = 2.0 / (x_m * (1.0 - x_m)); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[x$95$m, 0.75], 2.0, N[(2.0 / N[(x$95$m * N[(1.0 - x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x_m \leq 0.75:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{x_m \cdot \left(1 - x_m\right)}\\
\end{array}
\end{array}
if x < 0.75Initial program 90.4%
sub-neg90.4%
+-commutative90.4%
distribute-neg-frac90.4%
metadata-eval90.4%
metadata-eval90.4%
metadata-eval90.4%
associate-/r*90.4%
metadata-eval90.4%
neg-mul-190.4%
sub0-neg90.4%
associate-+l-90.4%
neg-sub090.4%
remove-double-neg90.4%
distribute-neg-in90.4%
sub-neg90.4%
mul-1-neg90.4%
metadata-eval90.4%
associate-/r*90.4%
metadata-eval90.4%
metadata-eval90.4%
metadata-eval90.4%
metadata-eval90.4%
associate-*l/90.4%
Simplified90.4%
Taylor expanded in x around 0 70.0%
if 0.75 < x Initial program 53.4%
sub-neg53.4%
+-commutative53.4%
distribute-neg-frac53.4%
metadata-eval53.4%
metadata-eval53.4%
metadata-eval53.4%
associate-/r*53.4%
metadata-eval53.4%
neg-mul-153.4%
sub0-neg53.4%
associate-+l-53.4%
neg-sub053.4%
remove-double-neg53.4%
distribute-neg-in53.4%
sub-neg53.4%
mul-1-neg53.4%
metadata-eval53.4%
associate-/r*53.4%
metadata-eval53.4%
metadata-eval53.4%
metadata-eval53.4%
metadata-eval53.4%
associate-*l/53.4%
Simplified53.4%
frac-sub54.7%
*-rgt-identity54.7%
metadata-eval54.7%
div-inv54.7%
associate-/r*54.7%
*-un-lft-identity54.7%
metadata-eval54.7%
div-inv54.7%
associate--l-60.9%
div-inv60.9%
metadata-eval60.9%
*-rgt-identity60.9%
div-inv60.9%
metadata-eval60.9%
*-rgt-identity60.9%
Applied egg-rr60.9%
frac-2neg60.9%
div-inv60.9%
distribute-neg-frac60.9%
associate--r+54.6%
associate--r-54.6%
neg-mul-154.6%
sub-neg54.6%
distribute-rgt-in54.6%
metadata-eval54.6%
cancel-sign-sub-inv54.6%
*-commutative54.6%
neg-mul-154.6%
Applied egg-rr54.6%
associate-*l/54.7%
sub-neg54.7%
remove-double-neg54.7%
associate-*r/54.7%
associate--l-54.7%
+-commutative54.7%
associate-+l-60.9%
associate--l+99.8%
+-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 98.1%
expm1-log1p-u98.1%
expm1-udef51.7%
associate-/l/51.7%
*-commutative51.7%
Applied egg-rr51.7%
expm1-def98.2%
expm1-log1p98.2%
Simplified98.2%
Final simplification75.7%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= x_m 1.0) 2.0 (/ (/ 2.0 x_m) (- -1.0 x_m))))
x_m = fabs(x);
double code(double x_m) {
double tmp;
if (x_m <= 1.0) {
tmp = 2.0;
} else {
tmp = (2.0 / x_m) / (-1.0 - x_m);
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
real(8) :: tmp
if (x_m <= 1.0d0) then
tmp = 2.0d0
else
tmp = (2.0d0 / x_m) / ((-1.0d0) - x_m)
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m) {
double tmp;
if (x_m <= 1.0) {
tmp = 2.0;
} else {
tmp = (2.0 / x_m) / (-1.0 - x_m);
}
return tmp;
}
x_m = math.fabs(x) def code(x_m): tmp = 0 if x_m <= 1.0: tmp = 2.0 else: tmp = (2.0 / x_m) / (-1.0 - x_m) return tmp
x_m = abs(x) function code(x_m) tmp = 0.0 if (x_m <= 1.0) tmp = 2.0; else tmp = Float64(Float64(2.0 / x_m) / Float64(-1.0 - x_m)); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m) tmp = 0.0; if (x_m <= 1.0) tmp = 2.0; else tmp = (2.0 / x_m) / (-1.0 - x_m); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[x$95$m, 1.0], 2.0, N[(N[(2.0 / x$95$m), $MachinePrecision] / N[(-1.0 - x$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x_m \leq 1:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{x_m}}{-1 - x_m}\\
\end{array}
\end{array}
if x < 1Initial program 90.4%
sub-neg90.4%
+-commutative90.4%
distribute-neg-frac90.4%
metadata-eval90.4%
metadata-eval90.4%
metadata-eval90.4%
associate-/r*90.4%
metadata-eval90.4%
neg-mul-190.4%
sub0-neg90.4%
associate-+l-90.4%
neg-sub090.4%
remove-double-neg90.4%
distribute-neg-in90.4%
sub-neg90.4%
mul-1-neg90.4%
metadata-eval90.4%
associate-/r*90.4%
metadata-eval90.4%
metadata-eval90.4%
metadata-eval90.4%
metadata-eval90.4%
associate-*l/90.4%
Simplified90.4%
Taylor expanded in x around 0 70.0%
if 1 < x Initial program 53.4%
sub-neg53.4%
+-commutative53.4%
distribute-neg-frac53.4%
metadata-eval53.4%
metadata-eval53.4%
metadata-eval53.4%
associate-/r*53.4%
metadata-eval53.4%
neg-mul-153.4%
sub0-neg53.4%
associate-+l-53.4%
neg-sub053.4%
remove-double-neg53.4%
distribute-neg-in53.4%
sub-neg53.4%
mul-1-neg53.4%
metadata-eval53.4%
associate-/r*53.4%
metadata-eval53.4%
metadata-eval53.4%
metadata-eval53.4%
metadata-eval53.4%
associate-*l/53.4%
Simplified53.4%
frac-sub54.7%
*-rgt-identity54.7%
metadata-eval54.7%
div-inv54.7%
associate-/r*54.7%
*-un-lft-identity54.7%
metadata-eval54.7%
div-inv54.7%
associate--l-60.9%
div-inv60.9%
metadata-eval60.9%
*-rgt-identity60.9%
div-inv60.9%
metadata-eval60.9%
*-rgt-identity60.9%
Applied egg-rr60.9%
Taylor expanded in x around inf 98.1%
Final simplification75.7%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (/ 2.0 (* (- -1.0 x_m) (+ x_m -1.0))))
x_m = fabs(x);
double code(double x_m) {
return 2.0 / ((-1.0 - x_m) * (x_m + -1.0));
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
code = 2.0d0 / (((-1.0d0) - x_m) * (x_m + (-1.0d0)))
end function
x_m = Math.abs(x);
public static double code(double x_m) {
return 2.0 / ((-1.0 - x_m) * (x_m + -1.0));
}
x_m = math.fabs(x) def code(x_m): return 2.0 / ((-1.0 - x_m) * (x_m + -1.0))
x_m = abs(x) function code(x_m) return Float64(2.0 / Float64(Float64(-1.0 - x_m) * Float64(x_m + -1.0))) end
x_m = abs(x); function tmp = code(x_m) tmp = 2.0 / ((-1.0 - x_m) * (x_m + -1.0)); end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := N[(2.0 / N[(N[(-1.0 - x$95$m), $MachinePrecision] * N[(x$95$m + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{2}{\left(-1 - x_m\right) \cdot \left(x_m + -1\right)}
\end{array}
Initial program 82.9%
sub-neg82.9%
+-commutative82.9%
distribute-neg-frac82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
associate-/r*82.9%
metadata-eval82.9%
neg-mul-182.9%
sub0-neg82.9%
associate-+l-82.9%
neg-sub082.9%
remove-double-neg82.9%
distribute-neg-in82.9%
sub-neg82.9%
mul-1-neg82.9%
metadata-eval82.9%
associate-/r*82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
associate-*l/82.9%
Simplified82.9%
sub-neg82.9%
distribute-neg-frac82.9%
metadata-eval82.9%
Applied egg-rr82.9%
*-rgt-identity82.9%
cancel-sign-sub82.9%
distribute-neg-frac82.9%
metadata-eval82.9%
*-rgt-identity82.9%
*-inverses82.9%
associate-/r*60.0%
distribute-lft-neg-in60.0%
distribute-rgt-neg-in60.0%
*-commutative60.0%
*-lft-identity60.0%
*-inverses60.0%
times-frac82.9%
div-sub83.4%
Simplified99.9%
Final simplification99.9%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= x_m 1.0) 2.0 (/ -2.0 x_m)))
x_m = fabs(x);
double code(double x_m) {
double tmp;
if (x_m <= 1.0) {
tmp = 2.0;
} else {
tmp = -2.0 / x_m;
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
real(8) :: tmp
if (x_m <= 1.0d0) then
tmp = 2.0d0
else
tmp = (-2.0d0) / x_m
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m) {
double tmp;
if (x_m <= 1.0) {
tmp = 2.0;
} else {
tmp = -2.0 / x_m;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m): tmp = 0 if x_m <= 1.0: tmp = 2.0 else: tmp = -2.0 / x_m return tmp
x_m = abs(x) function code(x_m) tmp = 0.0 if (x_m <= 1.0) tmp = 2.0; else tmp = Float64(-2.0 / x_m); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m) tmp = 0.0; if (x_m <= 1.0) tmp = 2.0; else tmp = -2.0 / x_m; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[x$95$m, 1.0], 2.0, N[(-2.0 / x$95$m), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x_m \leq 1:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{x_m}\\
\end{array}
\end{array}
if x < 1Initial program 90.4%
sub-neg90.4%
+-commutative90.4%
distribute-neg-frac90.4%
metadata-eval90.4%
metadata-eval90.4%
metadata-eval90.4%
associate-/r*90.4%
metadata-eval90.4%
neg-mul-190.4%
sub0-neg90.4%
associate-+l-90.4%
neg-sub090.4%
remove-double-neg90.4%
distribute-neg-in90.4%
sub-neg90.4%
mul-1-neg90.4%
metadata-eval90.4%
associate-/r*90.4%
metadata-eval90.4%
metadata-eval90.4%
metadata-eval90.4%
metadata-eval90.4%
associate-*l/90.4%
Simplified90.4%
Taylor expanded in x around 0 70.0%
if 1 < x Initial program 53.4%
sub-neg53.4%
+-commutative53.4%
distribute-neg-frac53.4%
metadata-eval53.4%
metadata-eval53.4%
metadata-eval53.4%
associate-/r*53.4%
metadata-eval53.4%
neg-mul-153.4%
sub0-neg53.4%
associate-+l-53.4%
neg-sub053.4%
remove-double-neg53.4%
distribute-neg-in53.4%
sub-neg53.4%
mul-1-neg53.4%
metadata-eval53.4%
associate-/r*53.4%
metadata-eval53.4%
metadata-eval53.4%
metadata-eval53.4%
metadata-eval53.4%
associate-*l/53.4%
Simplified53.4%
frac-sub54.7%
*-rgt-identity54.7%
metadata-eval54.7%
div-inv54.7%
associate-/r*54.7%
*-un-lft-identity54.7%
metadata-eval54.7%
div-inv54.7%
associate--l-60.9%
div-inv60.9%
metadata-eval60.9%
*-rgt-identity60.9%
div-inv60.9%
metadata-eval60.9%
*-rgt-identity60.9%
Applied egg-rr60.9%
Taylor expanded in x around inf 98.1%
Taylor expanded in x around 0 7.1%
Final simplification57.2%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (/ -2.0 (- -1.0 x_m)))
x_m = fabs(x);
double code(double x_m) {
return -2.0 / (-1.0 - x_m);
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
code = (-2.0d0) / ((-1.0d0) - x_m)
end function
x_m = Math.abs(x);
public static double code(double x_m) {
return -2.0 / (-1.0 - x_m);
}
x_m = math.fabs(x) def code(x_m): return -2.0 / (-1.0 - x_m)
x_m = abs(x) function code(x_m) return Float64(-2.0 / Float64(-1.0 - x_m)) end
x_m = abs(x); function tmp = code(x_m) tmp = -2.0 / (-1.0 - x_m); end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := N[(-2.0 / N[(-1.0 - x$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{-2}{-1 - x_m}
\end{array}
Initial program 82.9%
sub-neg82.9%
+-commutative82.9%
distribute-neg-frac82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
associate-/r*82.9%
metadata-eval82.9%
neg-mul-182.9%
sub0-neg82.9%
associate-+l-82.9%
neg-sub082.9%
remove-double-neg82.9%
distribute-neg-in82.9%
sub-neg82.9%
mul-1-neg82.9%
metadata-eval82.9%
associate-/r*82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
associate-*l/82.9%
Simplified82.9%
frac-sub83.4%
*-rgt-identity83.4%
metadata-eval83.4%
div-inv83.4%
associate-/r*83.4%
*-un-lft-identity83.4%
metadata-eval83.4%
div-inv83.4%
associate--l-85.7%
div-inv85.7%
metadata-eval85.7%
*-rgt-identity85.7%
div-inv85.7%
metadata-eval85.7%
*-rgt-identity85.7%
Applied egg-rr85.7%
Taylor expanded in x around 0 57.3%
Final simplification57.3%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 1.0)
x_m = fabs(x);
double code(double x_m) {
return 1.0;
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
code = 1.0d0
end function
x_m = Math.abs(x);
public static double code(double x_m) {
return 1.0;
}
x_m = math.fabs(x) def code(x_m): return 1.0
x_m = abs(x) function code(x_m) return 1.0 end
x_m = abs(x); function tmp = code(x_m) tmp = 1.0; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := 1.0
\begin{array}{l}
x_m = \left|x\right|
\\
1
\end{array}
Initial program 82.9%
sub-neg82.9%
+-commutative82.9%
distribute-neg-frac82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
associate-/r*82.9%
metadata-eval82.9%
neg-mul-182.9%
sub0-neg82.9%
associate-+l-82.9%
neg-sub082.9%
remove-double-neg82.9%
distribute-neg-in82.9%
sub-neg82.9%
mul-1-neg82.9%
metadata-eval82.9%
associate-/r*82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
associate-*l/82.9%
Simplified82.9%
Taylor expanded in x around 0 55.8%
Taylor expanded in x around inf 11.6%
Final simplification11.6%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 2.0)
x_m = fabs(x);
double code(double x_m) {
return 2.0;
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
code = 2.0d0
end function
x_m = Math.abs(x);
public static double code(double x_m) {
return 2.0;
}
x_m = math.fabs(x) def code(x_m): return 2.0
x_m = abs(x) function code(x_m) return 2.0 end
x_m = abs(x); function tmp = code(x_m) tmp = 2.0; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := 2.0
\begin{array}{l}
x_m = \left|x\right|
\\
2
\end{array}
Initial program 82.9%
sub-neg82.9%
+-commutative82.9%
distribute-neg-frac82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
associate-/r*82.9%
metadata-eval82.9%
neg-mul-182.9%
sub0-neg82.9%
associate-+l-82.9%
neg-sub082.9%
remove-double-neg82.9%
distribute-neg-in82.9%
sub-neg82.9%
mul-1-neg82.9%
metadata-eval82.9%
associate-/r*82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
metadata-eval82.9%
associate-*l/82.9%
Simplified82.9%
Taylor expanded in x around 0 56.3%
Final simplification56.3%
herbie shell --seed 2023322
(FPCore (x)
:name "Asymptote A"
:precision binary64
(- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))