
(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 8 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 76.7%
sub-neg76.7%
+-commutative76.7%
distribute-neg-frac76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
associate-/r*76.7%
metadata-eval76.7%
neg-mul-176.7%
sub0-neg76.7%
associate-+l-76.7%
neg-sub076.7%
remove-double-neg76.7%
distribute-neg-in76.7%
sub-neg76.7%
mul-1-neg76.7%
metadata-eval76.7%
associate-/r*76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
associate-*l/76.7%
Simplified76.7%
frac-sub78.3%
*-rgt-identity78.3%
metadata-eval78.3%
div-inv78.3%
associate-/r*78.3%
*-un-lft-identity78.3%
metadata-eval78.3%
div-inv78.3%
associate--l-81.2%
div-inv81.2%
metadata-eval81.2%
*-rgt-identity81.2%
div-inv81.2%
metadata-eval81.2%
*-rgt-identity81.2%
Applied egg-rr81.2%
div-sub81.2%
sub-neg81.2%
Applied egg-rr81.2%
metadata-eval81.2%
associate-*r/81.2%
neg-mul-181.2%
+-commutative81.2%
associate--r-99.9%
+-inverses99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
+-inverses99.9%
associate--l+81.2%
associate-+l-78.3%
+-commutative78.3%
associate--l-78.3%
associate-*l/78.3%
associate-*r/78.3%
metadata-eval78.3%
times-frac78.3%
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 83.4%
sub-neg83.4%
+-commutative83.4%
distribute-neg-frac83.4%
metadata-eval83.4%
metadata-eval83.4%
metadata-eval83.4%
associate-/r*83.4%
metadata-eval83.4%
neg-mul-183.4%
sub0-neg83.4%
associate-+l-83.4%
neg-sub083.4%
remove-double-neg83.4%
distribute-neg-in83.4%
sub-neg83.4%
mul-1-neg83.4%
metadata-eval83.4%
associate-/r*83.4%
metadata-eval83.4%
metadata-eval83.4%
metadata-eval83.4%
metadata-eval83.4%
associate-*l/83.4%
Simplified83.4%
Taylor expanded in x around 0 66.7%
if 1 < x Initial program 58.3%
sub-neg58.3%
+-commutative58.3%
distribute-neg-frac58.3%
metadata-eval58.3%
metadata-eval58.3%
metadata-eval58.3%
associate-/r*58.3%
metadata-eval58.3%
neg-mul-158.3%
sub0-neg58.3%
associate-+l-58.3%
neg-sub058.3%
remove-double-neg58.3%
distribute-neg-in58.3%
sub-neg58.3%
mul-1-neg58.3%
metadata-eval58.3%
associate-/r*58.3%
metadata-eval58.3%
metadata-eval58.3%
metadata-eval58.3%
metadata-eval58.3%
associate-*l/58.3%
Simplified58.3%
frac-sub60.3%
*-rgt-identity60.3%
metadata-eval60.3%
div-inv60.3%
associate-/r*60.2%
*-un-lft-identity60.2%
metadata-eval60.2%
div-inv60.2%
associate--l-65.4%
div-inv65.4%
metadata-eval65.4%
*-rgt-identity65.4%
div-inv65.4%
metadata-eval65.4%
*-rgt-identity65.4%
Applied egg-rr65.4%
Taylor expanded in x around inf 98.6%
expm1-log1p-u98.6%
expm1-udef56.7%
Applied egg-rr56.7%
expm1-def98.6%
expm1-log1p98.6%
associate-/l/97.2%
*-commutative97.2%
Simplified97.2%
Final simplification74.8%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= x_m 0.75) 2.0 (/ (/ -2.0 x_m) (+ x_m -1.0))))
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) / (x_m + -1.0);
}
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) / (x_m + (-1.0d0))
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) / (x_m + -1.0);
}
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) / (x_m + -1.0) return tmp
x_m = abs(x) function code(x_m) tmp = 0.0 if (x_m <= 0.75) tmp = 2.0; else tmp = Float64(Float64(-2.0 / x_m) / Float64(x_m + -1.0)); 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) / (x_m + -1.0); 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[(N[(-2.0 / x$95$m), $MachinePrecision] / N[(x$95$m + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x_m \leq 0.75:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-2}{x_m}}{x_m + -1}\\
\end{array}
\end{array}
if x < 0.75Initial program 83.4%
sub-neg83.4%
+-commutative83.4%
distribute-neg-frac83.4%
metadata-eval83.4%
metadata-eval83.4%
metadata-eval83.4%
associate-/r*83.4%
metadata-eval83.4%
neg-mul-183.4%
sub0-neg83.4%
associate-+l-83.4%
neg-sub083.4%
remove-double-neg83.4%
distribute-neg-in83.4%
sub-neg83.4%
mul-1-neg83.4%
metadata-eval83.4%
associate-/r*83.4%
metadata-eval83.4%
metadata-eval83.4%
metadata-eval83.4%
metadata-eval83.4%
associate-*l/83.4%
Simplified83.4%
Taylor expanded in x around 0 66.7%
if 0.75 < x Initial program 58.3%
sub-neg58.3%
+-commutative58.3%
distribute-neg-frac58.3%
metadata-eval58.3%
metadata-eval58.3%
metadata-eval58.3%
associate-/r*58.3%
metadata-eval58.3%
neg-mul-158.3%
sub0-neg58.3%
associate-+l-58.3%
neg-sub058.3%
remove-double-neg58.3%
distribute-neg-in58.3%
sub-neg58.3%
mul-1-neg58.3%
metadata-eval58.3%
associate-/r*58.3%
metadata-eval58.3%
metadata-eval58.3%
metadata-eval58.3%
metadata-eval58.3%
associate-*l/58.3%
Simplified58.3%
sub-neg58.3%
distribute-neg-frac58.3%
metadata-eval58.3%
Applied egg-rr58.3%
*-rgt-identity58.3%
cancel-sign-sub58.3%
distribute-neg-frac58.3%
metadata-eval58.3%
*-rgt-identity58.3%
*-inverses58.3%
associate-/r*8.5%
distribute-lft-neg-in8.5%
distribute-rgt-neg-in8.5%
*-commutative8.5%
*-inverses8.5%
associate-/r*58.3%
*-rgt-identity58.3%
div-sub60.3%
Simplified98.6%
clear-num98.6%
associate-/r/98.6%
Applied egg-rr98.6%
associate-*l/98.6%
metadata-eval98.6%
associate-/r*99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 98.6%
Final simplification75.2%
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 83.4%
sub-neg83.4%
+-commutative83.4%
distribute-neg-frac83.4%
metadata-eval83.4%
metadata-eval83.4%
metadata-eval83.4%
associate-/r*83.4%
metadata-eval83.4%
neg-mul-183.4%
sub0-neg83.4%
associate-+l-83.4%
neg-sub083.4%
remove-double-neg83.4%
distribute-neg-in83.4%
sub-neg83.4%
mul-1-neg83.4%
metadata-eval83.4%
associate-/r*83.4%
metadata-eval83.4%
metadata-eval83.4%
metadata-eval83.4%
metadata-eval83.4%
associate-*l/83.4%
Simplified83.4%
Taylor expanded in x around 0 66.7%
if 1 < x Initial program 58.3%
sub-neg58.3%
+-commutative58.3%
distribute-neg-frac58.3%
metadata-eval58.3%
metadata-eval58.3%
metadata-eval58.3%
associate-/r*58.3%
metadata-eval58.3%
neg-mul-158.3%
sub0-neg58.3%
associate-+l-58.3%
neg-sub058.3%
remove-double-neg58.3%
distribute-neg-in58.3%
sub-neg58.3%
mul-1-neg58.3%
metadata-eval58.3%
associate-/r*58.3%
metadata-eval58.3%
metadata-eval58.3%
metadata-eval58.3%
metadata-eval58.3%
associate-*l/58.3%
Simplified58.3%
frac-sub60.3%
*-rgt-identity60.3%
metadata-eval60.3%
div-inv60.3%
associate-/r*60.2%
*-un-lft-identity60.2%
metadata-eval60.2%
div-inv60.2%
associate--l-65.4%
div-inv65.4%
metadata-eval65.4%
*-rgt-identity65.4%
div-inv65.4%
metadata-eval65.4%
*-rgt-identity65.4%
Applied egg-rr65.4%
Taylor expanded in x around inf 98.6%
Final simplification75.2%
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(2.0 / Float64(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[(2.0 / N[(N[(x$95$m + -1.0), $MachinePrecision] * N[(-1.0 - x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{2}{\left(x_m + -1\right) \cdot \left(-1 - x_m\right)}
\end{array}
Initial program 76.7%
sub-neg76.7%
+-commutative76.7%
distribute-neg-frac76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
associate-/r*76.7%
metadata-eval76.7%
neg-mul-176.7%
sub0-neg76.7%
associate-+l-76.7%
neg-sub076.7%
remove-double-neg76.7%
distribute-neg-in76.7%
sub-neg76.7%
mul-1-neg76.7%
metadata-eval76.7%
associate-/r*76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
associate-*l/76.7%
Simplified76.7%
sub-neg76.7%
distribute-neg-frac76.7%
metadata-eval76.7%
Applied egg-rr76.7%
*-rgt-identity76.7%
cancel-sign-sub76.7%
distribute-neg-frac76.7%
metadata-eval76.7%
*-rgt-identity76.7%
*-inverses76.7%
associate-/r*53.3%
distribute-lft-neg-in53.3%
distribute-rgt-neg-in53.3%
*-commutative53.3%
*-inverses53.3%
associate-/r*76.7%
*-rgt-identity76.7%
div-sub78.3%
Simplified99.6%
Final simplification99.6%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (+ 2.0 (* x_m -2.0)))
x_m = fabs(x);
double code(double x_m) {
return 2.0 + (x_m * -2.0);
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
code = 2.0d0 + (x_m * (-2.0d0))
end function
x_m = Math.abs(x);
public static double code(double x_m) {
return 2.0 + (x_m * -2.0);
}
x_m = math.fabs(x) def code(x_m): return 2.0 + (x_m * -2.0)
x_m = abs(x) function code(x_m) return Float64(2.0 + Float64(x_m * -2.0)) end
x_m = abs(x); function tmp = code(x_m) tmp = 2.0 + (x_m * -2.0); end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := N[(2.0 + N[(x$95$m * -2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
2 + x_m \cdot -2
\end{array}
Initial program 76.7%
sub-neg76.7%
+-commutative76.7%
distribute-neg-frac76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
associate-/r*76.7%
metadata-eval76.7%
neg-mul-176.7%
sub0-neg76.7%
associate-+l-76.7%
neg-sub076.7%
remove-double-neg76.7%
distribute-neg-in76.7%
sub-neg76.7%
mul-1-neg76.7%
metadata-eval76.7%
associate-/r*76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
associate-*l/76.7%
Simplified76.7%
frac-sub78.3%
*-rgt-identity78.3%
metadata-eval78.3%
div-inv78.3%
associate-/r*78.3%
*-un-lft-identity78.3%
metadata-eval78.3%
div-inv78.3%
associate--l-81.2%
div-inv81.2%
metadata-eval81.2%
*-rgt-identity81.2%
div-inv81.2%
metadata-eval81.2%
*-rgt-identity81.2%
Applied egg-rr81.2%
Taylor expanded in x around 0 51.3%
Taylor expanded in x around 0 49.5%
*-commutative49.5%
Simplified49.5%
Final simplification49.5%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (/ -2.0 (+ x_m -1.0)))
x_m = fabs(x);
double code(double x_m) {
return -2.0 / (x_m + -1.0);
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
code = (-2.0d0) / (x_m + (-1.0d0))
end function
x_m = Math.abs(x);
public static double code(double x_m) {
return -2.0 / (x_m + -1.0);
}
x_m = math.fabs(x) def code(x_m): return -2.0 / (x_m + -1.0)
x_m = abs(x) function code(x_m) return Float64(-2.0 / Float64(x_m + -1.0)) end
x_m = abs(x); function tmp = code(x_m) tmp = -2.0 / (x_m + -1.0); end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := N[(-2.0 / N[(x$95$m + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{-2}{x_m + -1}
\end{array}
Initial program 76.7%
sub-neg76.7%
+-commutative76.7%
distribute-neg-frac76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
associate-/r*76.7%
metadata-eval76.7%
neg-mul-176.7%
sub0-neg76.7%
associate-+l-76.7%
neg-sub076.7%
remove-double-neg76.7%
distribute-neg-in76.7%
sub-neg76.7%
mul-1-neg76.7%
metadata-eval76.7%
associate-/r*76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
associate-*l/76.7%
Simplified76.7%
sub-neg76.7%
distribute-neg-frac76.7%
metadata-eval76.7%
Applied egg-rr76.7%
*-rgt-identity76.7%
cancel-sign-sub76.7%
distribute-neg-frac76.7%
metadata-eval76.7%
*-rgt-identity76.7%
*-inverses76.7%
associate-/r*53.3%
distribute-lft-neg-in53.3%
distribute-rgt-neg-in53.3%
*-commutative53.3%
*-inverses53.3%
associate-/r*76.7%
*-rgt-identity76.7%
div-sub78.3%
Simplified99.6%
clear-num99.6%
associate-/r/99.6%
Applied egg-rr99.6%
associate-*l/99.6%
metadata-eval99.6%
associate-/r*99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 51.2%
Final simplification51.2%
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 76.7%
sub-neg76.7%
+-commutative76.7%
distribute-neg-frac76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
associate-/r*76.7%
metadata-eval76.7%
neg-mul-176.7%
sub0-neg76.7%
associate-+l-76.7%
neg-sub076.7%
remove-double-neg76.7%
distribute-neg-in76.7%
sub-neg76.7%
mul-1-neg76.7%
metadata-eval76.7%
associate-/r*76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
metadata-eval76.7%
associate-*l/76.7%
Simplified76.7%
Taylor expanded in x around 0 49.7%
Final simplification49.7%
herbie shell --seed 2023334
(FPCore (x)
:name "Asymptote A"
:precision binary64
(- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))