
(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}
(FPCore (x) :precision binary64 (/ 2.0 (+ (+ 1.0 x) (* x (- -1.0 x)))))
double code(double x) {
return 2.0 / ((1.0 + x) + (x * (-1.0 - x)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 2.0d0 / ((1.0d0 + x) + (x * ((-1.0d0) - x)))
end function
public static double code(double x) {
return 2.0 / ((1.0 + x) + (x * (-1.0 - x)));
}
def code(x): return 2.0 / ((1.0 + x) + (x * (-1.0 - x)))
function code(x) return Float64(2.0 / Float64(Float64(1.0 + x) + Float64(x * Float64(-1.0 - x)))) end
function tmp = code(x) tmp = 2.0 / ((1.0 + x) + (x * (-1.0 - x))); end
code[x_] := N[(2.0 / N[(N[(1.0 + x), $MachinePrecision] + N[(x * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(1 + x\right) + x \cdot \left(-1 - x\right)}
\end{array}
Initial program 80.2%
sub-neg80.2%
+-commutative80.2%
distribute-neg-frac80.2%
metadata-eval80.2%
metadata-eval80.2%
metadata-eval80.2%
associate-/r*80.2%
metadata-eval80.2%
neg-mul-180.2%
sub0-neg80.2%
associate-+l-80.2%
neg-sub080.2%
remove-double-neg80.2%
distribute-neg-in80.2%
sub-neg80.2%
mul-1-neg80.2%
metadata-eval80.2%
associate-/r*80.2%
metadata-eval80.2%
metadata-eval80.2%
metadata-eval80.2%
metadata-eval80.2%
associate-*l/80.2%
Simplified80.2%
sub-neg80.2%
distribute-neg-frac80.2%
metadata-eval80.2%
Applied egg-rr80.2%
*-rgt-identity80.2%
cancel-sign-sub80.2%
distribute-neg-frac80.2%
metadata-eval80.2%
*-rgt-identity80.2%
*-inverses80.2%
associate-/r*53.7%
distribute-lft-neg-in53.7%
distribute-rgt-neg-in53.7%
*-commutative53.7%
*-lft-identity53.7%
*-inverses53.7%
times-frac80.2%
div-sub81.2%
Simplified99.5%
+-commutative99.5%
distribute-rgt-in99.5%
sub-neg99.5%
distribute-rgt-in99.5%
metadata-eval99.5%
cancel-sign-sub-inv99.5%
*-commutative99.5%
neg-mul-199.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x) :precision binary64 (if (<= x 1.0) 2.0 (/ 2.0 (* x (- -1.0 x)))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = 2.0;
} else {
tmp = 2.0 / (x * (-1.0 - x));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.0d0) then
tmp = 2.0d0
else
tmp = 2.0d0 / (x * ((-1.0d0) - x))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = 2.0;
} else {
tmp = 2.0 / (x * (-1.0 - x));
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = 2.0 else: tmp = 2.0 / (x * (-1.0 - x)) return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = 2.0; else tmp = Float64(2.0 / Float64(x * Float64(-1.0 - x))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = 2.0; else tmp = 2.0 / (x * (-1.0 - x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], 2.0, N[(2.0 / N[(x * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{x \cdot \left(-1 - x\right)}\\
\end{array}
\end{array}
if x < 1Initial program 84.5%
sub-neg84.5%
+-commutative84.5%
distribute-neg-frac84.5%
metadata-eval84.5%
metadata-eval84.5%
metadata-eval84.5%
associate-/r*84.5%
metadata-eval84.5%
neg-mul-184.5%
sub0-neg84.5%
associate-+l-84.5%
neg-sub084.5%
remove-double-neg84.5%
distribute-neg-in84.5%
sub-neg84.5%
mul-1-neg84.5%
metadata-eval84.5%
associate-/r*84.5%
metadata-eval84.5%
metadata-eval84.5%
metadata-eval84.5%
metadata-eval84.5%
associate-*l/84.5%
Simplified84.5%
Taylor expanded in x around 0 66.6%
if 1 < x Initial program 68.3%
sub-neg68.3%
+-commutative68.3%
distribute-neg-frac68.3%
metadata-eval68.3%
metadata-eval68.3%
metadata-eval68.3%
associate-/r*68.3%
metadata-eval68.3%
neg-mul-168.3%
sub0-neg68.3%
associate-+l-68.3%
neg-sub068.3%
remove-double-neg68.3%
distribute-neg-in68.3%
sub-neg68.3%
mul-1-neg68.3%
metadata-eval68.3%
associate-/r*68.3%
metadata-eval68.3%
metadata-eval68.3%
metadata-eval68.3%
metadata-eval68.3%
associate-*l/68.3%
Simplified68.3%
frac-sub71.7%
*-rgt-identity71.7%
metadata-eval71.7%
div-inv71.7%
associate-/r*71.7%
*-un-lft-identity71.7%
metadata-eval71.7%
div-inv71.7%
associate--l-75.7%
div-inv75.7%
metadata-eval75.7%
*-rgt-identity75.7%
div-inv75.7%
metadata-eval75.7%
*-rgt-identity75.7%
Applied egg-rr75.7%
Taylor expanded in x around inf 96.4%
expm1-log1p-u96.4%
expm1-udef64.7%
associate-/l/64.7%
*-commutative64.7%
Applied egg-rr64.7%
expm1-def96.3%
expm1-log1p96.3%
Simplified96.3%
Final simplification74.4%
(FPCore (x) :precision binary64 (if (<= x 1.0) 2.0 (/ (/ 2.0 x) (- -1.0 x))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = 2.0;
} else {
tmp = (2.0 / x) / (-1.0 - x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.0d0) then
tmp = 2.0d0
else
tmp = (2.0d0 / x) / ((-1.0d0) - x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = 2.0;
} else {
tmp = (2.0 / x) / (-1.0 - x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = 2.0 else: tmp = (2.0 / x) / (-1.0 - x) return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = 2.0; else tmp = Float64(Float64(2.0 / x) / Float64(-1.0 - x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = 2.0; else tmp = (2.0 / x) / (-1.0 - x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], 2.0, N[(N[(2.0 / x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{x}}{-1 - x}\\
\end{array}
\end{array}
if x < 1Initial program 84.5%
sub-neg84.5%
+-commutative84.5%
distribute-neg-frac84.5%
metadata-eval84.5%
metadata-eval84.5%
metadata-eval84.5%
associate-/r*84.5%
metadata-eval84.5%
neg-mul-184.5%
sub0-neg84.5%
associate-+l-84.5%
neg-sub084.5%
remove-double-neg84.5%
distribute-neg-in84.5%
sub-neg84.5%
mul-1-neg84.5%
metadata-eval84.5%
associate-/r*84.5%
metadata-eval84.5%
metadata-eval84.5%
metadata-eval84.5%
metadata-eval84.5%
associate-*l/84.5%
Simplified84.5%
Taylor expanded in x around 0 66.6%
if 1 < x Initial program 68.3%
sub-neg68.3%
+-commutative68.3%
distribute-neg-frac68.3%
metadata-eval68.3%
metadata-eval68.3%
metadata-eval68.3%
associate-/r*68.3%
metadata-eval68.3%
neg-mul-168.3%
sub0-neg68.3%
associate-+l-68.3%
neg-sub068.3%
remove-double-neg68.3%
distribute-neg-in68.3%
sub-neg68.3%
mul-1-neg68.3%
metadata-eval68.3%
associate-/r*68.3%
metadata-eval68.3%
metadata-eval68.3%
metadata-eval68.3%
metadata-eval68.3%
associate-*l/68.3%
Simplified68.3%
frac-sub71.7%
*-rgt-identity71.7%
metadata-eval71.7%
div-inv71.7%
associate-/r*71.7%
*-un-lft-identity71.7%
metadata-eval71.7%
div-inv71.7%
associate--l-75.7%
div-inv75.7%
metadata-eval75.7%
*-rgt-identity75.7%
div-inv75.7%
metadata-eval75.7%
*-rgt-identity75.7%
Applied egg-rr75.7%
Taylor expanded in x around inf 96.4%
Final simplification74.4%
(FPCore (x) :precision binary64 (/ 2.0 (* (- -1.0 x) (+ x -1.0))))
double code(double x) {
return 2.0 / ((-1.0 - x) * (x + -1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 2.0d0 / (((-1.0d0) - x) * (x + (-1.0d0)))
end function
public static double code(double x) {
return 2.0 / ((-1.0 - x) * (x + -1.0));
}
def code(x): return 2.0 / ((-1.0 - x) * (x + -1.0))
function code(x) return Float64(2.0 / Float64(Float64(-1.0 - x) * Float64(x + -1.0))) end
function tmp = code(x) tmp = 2.0 / ((-1.0 - x) * (x + -1.0)); end
code[x_] := N[(2.0 / N[(N[(-1.0 - x), $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(-1 - x\right) \cdot \left(x + -1\right)}
\end{array}
Initial program 80.2%
sub-neg80.2%
+-commutative80.2%
distribute-neg-frac80.2%
metadata-eval80.2%
metadata-eval80.2%
metadata-eval80.2%
associate-/r*80.2%
metadata-eval80.2%
neg-mul-180.2%
sub0-neg80.2%
associate-+l-80.2%
neg-sub080.2%
remove-double-neg80.2%
distribute-neg-in80.2%
sub-neg80.2%
mul-1-neg80.2%
metadata-eval80.2%
associate-/r*80.2%
metadata-eval80.2%
metadata-eval80.2%
metadata-eval80.2%
metadata-eval80.2%
associate-*l/80.2%
Simplified80.2%
sub-neg80.2%
distribute-neg-frac80.2%
metadata-eval80.2%
Applied egg-rr80.2%
*-rgt-identity80.2%
cancel-sign-sub80.2%
distribute-neg-frac80.2%
metadata-eval80.2%
*-rgt-identity80.2%
*-inverses80.2%
associate-/r*53.7%
distribute-lft-neg-in53.7%
distribute-rgt-neg-in53.7%
*-commutative53.7%
*-lft-identity53.7%
*-inverses53.7%
times-frac80.2%
div-sub81.2%
Simplified99.5%
Final simplification99.5%
(FPCore (x) :precision binary64 (if (<= x 1.0) 2.0 (/ -2.0 (+ 1.0 x))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = 2.0;
} else {
tmp = -2.0 / (1.0 + x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.0d0) then
tmp = 2.0d0
else
tmp = (-2.0d0) / (1.0d0 + x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = 2.0;
} else {
tmp = -2.0 / (1.0 + x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = 2.0 else: tmp = -2.0 / (1.0 + x) return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = 2.0; else tmp = Float64(-2.0 / Float64(1.0 + x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = 2.0; else tmp = -2.0 / (1.0 + x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], 2.0, N[(-2.0 / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{1 + x}\\
\end{array}
\end{array}
if x < 1Initial program 84.5%
sub-neg84.5%
+-commutative84.5%
distribute-neg-frac84.5%
metadata-eval84.5%
metadata-eval84.5%
metadata-eval84.5%
associate-/r*84.5%
metadata-eval84.5%
neg-mul-184.5%
sub0-neg84.5%
associate-+l-84.5%
neg-sub084.5%
remove-double-neg84.5%
distribute-neg-in84.5%
sub-neg84.5%
mul-1-neg84.5%
metadata-eval84.5%
associate-/r*84.5%
metadata-eval84.5%
metadata-eval84.5%
metadata-eval84.5%
metadata-eval84.5%
associate-*l/84.5%
Simplified84.5%
Taylor expanded in x around 0 66.6%
if 1 < x Initial program 68.3%
sub-neg68.3%
+-commutative68.3%
distribute-neg-frac68.3%
metadata-eval68.3%
metadata-eval68.3%
metadata-eval68.3%
associate-/r*68.3%
metadata-eval68.3%
neg-mul-168.3%
sub0-neg68.3%
associate-+l-68.3%
neg-sub068.3%
remove-double-neg68.3%
distribute-neg-in68.3%
sub-neg68.3%
mul-1-neg68.3%
metadata-eval68.3%
associate-/r*68.3%
metadata-eval68.3%
metadata-eval68.3%
metadata-eval68.3%
metadata-eval68.3%
associate-*l/68.3%
Simplified68.3%
frac-sub71.7%
*-rgt-identity71.7%
metadata-eval71.7%
div-inv71.7%
associate-/r*71.7%
*-un-lft-identity71.7%
metadata-eval71.7%
div-inv71.7%
associate--l-75.7%
div-inv75.7%
metadata-eval75.7%
*-rgt-identity75.7%
div-inv75.7%
metadata-eval75.7%
*-rgt-identity75.7%
Applied egg-rr75.7%
Taylor expanded in x around 0 5.5%
add-sqr-sqrt5.5%
sqrt-unprod60.8%
frac-times62.1%
metadata-eval62.1%
metadata-eval62.1%
pow262.1%
sub-neg62.1%
add-sqr-sqrt0.0%
sqrt-unprod62.1%
sqr-neg62.1%
sqrt-unprod62.1%
add-sqr-sqrt62.1%
+-commutative62.1%
pow262.1%
frac-times60.8%
sqrt-unprod5.5%
add-sqr-sqrt5.5%
frac-2neg5.5%
metadata-eval5.5%
div-inv5.5%
+-commutative5.5%
distribute-neg-in5.5%
metadata-eval5.5%
add-sqr-sqrt0.0%
Applied egg-rr7.5%
associate-*r/7.5%
metadata-eval7.5%
+-commutative7.5%
Simplified7.5%
Final simplification51.1%
(FPCore (x) :precision binary64 (if (<= x 1.0) 2.0 (/ -2.0 x)))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = 2.0;
} else {
tmp = -2.0 / x;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.0d0) then
tmp = 2.0d0
else
tmp = (-2.0d0) / x
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = 2.0;
} else {
tmp = -2.0 / x;
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = 2.0 else: tmp = -2.0 / x return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = 2.0; else tmp = Float64(-2.0 / x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = 2.0; else tmp = -2.0 / x; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], 2.0, N[(-2.0 / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{x}\\
\end{array}
\end{array}
if x < 1Initial program 84.5%
sub-neg84.5%
+-commutative84.5%
distribute-neg-frac84.5%
metadata-eval84.5%
metadata-eval84.5%
metadata-eval84.5%
associate-/r*84.5%
metadata-eval84.5%
neg-mul-184.5%
sub0-neg84.5%
associate-+l-84.5%
neg-sub084.5%
remove-double-neg84.5%
distribute-neg-in84.5%
sub-neg84.5%
mul-1-neg84.5%
metadata-eval84.5%
associate-/r*84.5%
metadata-eval84.5%
metadata-eval84.5%
metadata-eval84.5%
metadata-eval84.5%
associate-*l/84.5%
Simplified84.5%
Taylor expanded in x around 0 66.6%
if 1 < x Initial program 68.3%
sub-neg68.3%
+-commutative68.3%
distribute-neg-frac68.3%
metadata-eval68.3%
metadata-eval68.3%
metadata-eval68.3%
associate-/r*68.3%
metadata-eval68.3%
neg-mul-168.3%
sub0-neg68.3%
associate-+l-68.3%
neg-sub068.3%
remove-double-neg68.3%
distribute-neg-in68.3%
sub-neg68.3%
mul-1-neg68.3%
metadata-eval68.3%
associate-/r*68.3%
metadata-eval68.3%
metadata-eval68.3%
metadata-eval68.3%
metadata-eval68.3%
associate-*l/68.3%
Simplified68.3%
frac-sub71.7%
*-rgt-identity71.7%
metadata-eval71.7%
div-inv71.7%
associate-/r*71.7%
*-un-lft-identity71.7%
metadata-eval71.7%
div-inv71.7%
associate--l-75.7%
div-inv75.7%
metadata-eval75.7%
*-rgt-identity75.7%
div-inv75.7%
metadata-eval75.7%
*-rgt-identity75.7%
Applied egg-rr75.7%
Taylor expanded in x around 0 5.5%
add-sqr-sqrt5.5%
sqrt-unprod60.8%
frac-times62.1%
metadata-eval62.1%
metadata-eval62.1%
pow262.1%
sub-neg62.1%
add-sqr-sqrt0.0%
sqrt-unprod62.1%
sqr-neg62.1%
sqrt-unprod62.1%
add-sqr-sqrt62.1%
+-commutative62.1%
pow262.1%
frac-times60.8%
sqrt-unprod5.5%
add-sqr-sqrt5.5%
frac-2neg5.5%
metadata-eval5.5%
div-inv5.5%
+-commutative5.5%
distribute-neg-in5.5%
metadata-eval5.5%
add-sqr-sqrt0.0%
Applied egg-rr7.5%
associate-*r/7.5%
metadata-eval7.5%
+-commutative7.5%
Simplified7.5%
Taylor expanded in x around inf 7.5%
Final simplification51.1%
(FPCore (x) :precision binary64 -2.0)
double code(double x) {
return -2.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = -2.0d0
end function
public static double code(double x) {
return -2.0;
}
def code(x): return -2.0
function code(x) return -2.0 end
function tmp = code(x) tmp = -2.0; end
code[x_] := -2.0
\begin{array}{l}
\\
-2
\end{array}
Initial program 80.2%
sub-neg80.2%
+-commutative80.2%
distribute-neg-frac80.2%
metadata-eval80.2%
metadata-eval80.2%
metadata-eval80.2%
associate-/r*80.2%
metadata-eval80.2%
neg-mul-180.2%
sub0-neg80.2%
associate-+l-80.2%
neg-sub080.2%
remove-double-neg80.2%
distribute-neg-in80.2%
sub-neg80.2%
mul-1-neg80.2%
metadata-eval80.2%
associate-/r*80.2%
metadata-eval80.2%
metadata-eval80.2%
metadata-eval80.2%
metadata-eval80.2%
associate-*l/80.2%
Simplified80.2%
frac-sub81.2%
*-rgt-identity81.2%
metadata-eval81.2%
div-inv81.2%
associate-/r*81.2%
*-un-lft-identity81.2%
metadata-eval81.2%
div-inv81.2%
associate--l-83.7%
div-inv83.7%
metadata-eval83.7%
*-rgt-identity83.7%
div-inv83.7%
metadata-eval83.7%
*-rgt-identity83.7%
Applied egg-rr83.7%
Taylor expanded in x around 0 50.8%
add-sqr-sqrt48.5%
sqrt-unprod76.2%
frac-times77.0%
metadata-eval77.0%
metadata-eval77.0%
pow277.0%
sub-neg77.0%
add-sqr-sqrt35.6%
sqrt-unprod77.0%
sqr-neg77.0%
sqrt-unprod41.4%
add-sqr-sqrt77.0%
+-commutative77.0%
pow277.0%
frac-times76.2%
sqrt-unprod1.4%
add-sqr-sqrt3.8%
frac-2neg3.8%
metadata-eval3.8%
div-inv3.8%
+-commutative3.8%
distribute-neg-in3.8%
metadata-eval3.8%
add-sqr-sqrt1.9%
Applied egg-rr3.9%
associate-*r/3.9%
metadata-eval3.9%
+-commutative3.9%
Simplified3.9%
Taylor expanded in x around 0 2.9%
Final simplification2.9%
(FPCore (x) :precision binary64 2.0)
double code(double x) {
return 2.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 2.0d0
end function
public static double code(double x) {
return 2.0;
}
def code(x): return 2.0
function code(x) return 2.0 end
function tmp = code(x) tmp = 2.0; end
code[x_] := 2.0
\begin{array}{l}
\\
2
\end{array}
Initial program 80.2%
sub-neg80.2%
+-commutative80.2%
distribute-neg-frac80.2%
metadata-eval80.2%
metadata-eval80.2%
metadata-eval80.2%
associate-/r*80.2%
metadata-eval80.2%
neg-mul-180.2%
sub0-neg80.2%
associate-+l-80.2%
neg-sub080.2%
remove-double-neg80.2%
distribute-neg-in80.2%
sub-neg80.2%
mul-1-neg80.2%
metadata-eval80.2%
associate-/r*80.2%
metadata-eval80.2%
metadata-eval80.2%
metadata-eval80.2%
metadata-eval80.2%
associate-*l/80.2%
Simplified80.2%
Taylor expanded in x around 0 49.9%
Final simplification49.9%
herbie shell --seed 2023319
(FPCore (x)
:name "Asymptote A"
:precision binary64
(- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))