
(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}
(FPCore (x) :precision binary64 (/ (/ 2.0 (+ x -1.0)) (- -1.0 x)))
double code(double x) {
return (2.0 / (x + -1.0)) / (-1.0 - x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (2.0d0 / (x + (-1.0d0))) / ((-1.0d0) - x)
end function
public static double code(double x) {
return (2.0 / (x + -1.0)) / (-1.0 - x);
}
def code(x): return (2.0 / (x + -1.0)) / (-1.0 - x)
function code(x) return Float64(Float64(2.0 / Float64(x + -1.0)) / Float64(-1.0 - x)) end
function tmp = code(x) tmp = (2.0 / (x + -1.0)) / (-1.0 - x); end
code[x_] := N[(N[(2.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2}{x + -1}}{-1 - x}
\end{array}
Initial program 81.6%
sub-neg81.6%
+-commutative81.6%
neg-sub081.6%
associate-+l-81.6%
sub-neg81.6%
associate--r+81.6%
neg-sub081.6%
distribute-neg-frac81.6%
metadata-eval81.6%
metadata-eval81.6%
metadata-eval81.6%
associate-/r*81.6%
metadata-eval81.6%
neg-mul-181.6%
sub0-neg81.6%
associate-+l-81.6%
neg-sub081.6%
+-commutative81.6%
unsub-neg81.6%
distribute-neg-frac81.6%
metadata-eval81.6%
metadata-eval81.6%
metadata-eval81.6%
associate-/r*81.6%
metadata-eval81.6%
neg-mul-181.6%
Simplified81.6%
frac-sub81.9%
*-rgt-identity81.9%
metadata-eval81.9%
div-inv81.9%
associate-/r*81.9%
*-un-lft-identity81.9%
metadata-eval81.9%
div-inv81.9%
associate--l-84.3%
div-inv84.3%
metadata-eval84.3%
*-rgt-identity84.3%
div-inv84.3%
metadata-eval84.3%
*-rgt-identity84.3%
Applied egg-rr84.3%
div-sub84.3%
sub-neg84.3%
Applied egg-rr84.3%
metadata-eval84.3%
associate-*r/84.3%
neg-mul-184.3%
+-commutative84.3%
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+84.3%
associate-+l-81.9%
+-commutative81.9%
associate--l-81.9%
associate-*l/81.9%
associate-*r/81.9%
metadata-eval81.9%
times-frac81.9%
neg-mul-181.9%
neg-mul-181.9%
Simplified99.9%
Final simplification99.9%
(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 86.5%
sub-neg86.5%
+-commutative86.5%
neg-sub086.5%
associate-+l-86.5%
sub-neg86.5%
associate--r+86.5%
neg-sub086.5%
distribute-neg-frac86.5%
metadata-eval86.5%
metadata-eval86.5%
metadata-eval86.5%
associate-/r*86.5%
metadata-eval86.5%
neg-mul-186.5%
sub0-neg86.5%
associate-+l-86.5%
neg-sub086.5%
+-commutative86.5%
unsub-neg86.5%
distribute-neg-frac86.5%
metadata-eval86.5%
metadata-eval86.5%
metadata-eval86.5%
associate-/r*86.5%
metadata-eval86.5%
neg-mul-186.5%
Simplified86.5%
Taylor expanded in x around 0 67.4%
if 1 < x Initial program 66.1%
sub-neg66.1%
+-commutative66.1%
neg-sub066.1%
associate-+l-66.1%
sub-neg66.1%
associate--r+66.1%
neg-sub066.1%
distribute-neg-frac66.1%
metadata-eval66.1%
metadata-eval66.1%
metadata-eval66.1%
associate-/r*66.1%
metadata-eval66.1%
neg-mul-166.1%
sub0-neg66.1%
associate-+l-66.1%
neg-sub066.1%
+-commutative66.1%
unsub-neg66.1%
distribute-neg-frac66.1%
metadata-eval66.1%
metadata-eval66.1%
metadata-eval66.1%
associate-/r*66.1%
metadata-eval66.1%
neg-mul-166.1%
Simplified66.1%
frac-sub66.3%
*-rgt-identity66.3%
metadata-eval66.3%
div-inv66.3%
associate-/r*66.3%
*-un-lft-identity66.3%
metadata-eval66.3%
div-inv66.3%
associate--l-70.8%
div-inv70.8%
metadata-eval70.8%
*-rgt-identity70.8%
div-inv70.8%
metadata-eval70.8%
*-rgt-identity70.8%
Applied egg-rr70.8%
Taylor expanded in x around inf 97.4%
expm1-log1p-u97.4%
expm1-udef63.9%
Applied egg-rr63.9%
expm1-def97.4%
expm1-log1p97.4%
associate-/r*94.9%
Simplified94.9%
Final simplification74.0%
(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 86.5%
sub-neg86.5%
+-commutative86.5%
neg-sub086.5%
associate-+l-86.5%
sub-neg86.5%
associate--r+86.5%
neg-sub086.5%
distribute-neg-frac86.5%
metadata-eval86.5%
metadata-eval86.5%
metadata-eval86.5%
associate-/r*86.5%
metadata-eval86.5%
neg-mul-186.5%
sub0-neg86.5%
associate-+l-86.5%
neg-sub086.5%
+-commutative86.5%
unsub-neg86.5%
distribute-neg-frac86.5%
metadata-eval86.5%
metadata-eval86.5%
metadata-eval86.5%
associate-/r*86.5%
metadata-eval86.5%
neg-mul-186.5%
Simplified86.5%
Taylor expanded in x around 0 67.4%
if 1 < x Initial program 66.1%
sub-neg66.1%
+-commutative66.1%
neg-sub066.1%
associate-+l-66.1%
sub-neg66.1%
associate--r+66.1%
neg-sub066.1%
distribute-neg-frac66.1%
metadata-eval66.1%
metadata-eval66.1%
metadata-eval66.1%
associate-/r*66.1%
metadata-eval66.1%
neg-mul-166.1%
sub0-neg66.1%
associate-+l-66.1%
neg-sub066.1%
+-commutative66.1%
unsub-neg66.1%
distribute-neg-frac66.1%
metadata-eval66.1%
metadata-eval66.1%
metadata-eval66.1%
associate-/r*66.1%
metadata-eval66.1%
neg-mul-166.1%
Simplified66.1%
frac-sub66.3%
*-rgt-identity66.3%
metadata-eval66.3%
div-inv66.3%
associate-/r*66.3%
*-un-lft-identity66.3%
metadata-eval66.3%
div-inv66.3%
associate--l-70.8%
div-inv70.8%
metadata-eval70.8%
*-rgt-identity70.8%
div-inv70.8%
metadata-eval70.8%
*-rgt-identity70.8%
Applied egg-rr70.8%
Taylor expanded in x around inf 97.4%
Final simplification74.6%
(FPCore (x) :precision binary64 (if (<= x 1.0) 2.0 (/ (/ 2.0 (- -1.0 x)) x)))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = 2.0;
} else {
tmp = (2.0 / (-1.0 - x)) / 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)) / 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)) / x;
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = 2.0 else: tmp = (2.0 / (-1.0 - x)) / x return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = 2.0; else tmp = Float64(Float64(2.0 / Float64(-1.0 - x)) / 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)) / x; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], 2.0, N[(N[(2.0 / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{-1 - x}}{x}\\
\end{array}
\end{array}
if x < 1Initial program 86.5%
sub-neg86.5%
+-commutative86.5%
neg-sub086.5%
associate-+l-86.5%
sub-neg86.5%
associate--r+86.5%
neg-sub086.5%
distribute-neg-frac86.5%
metadata-eval86.5%
metadata-eval86.5%
metadata-eval86.5%
associate-/r*86.5%
metadata-eval86.5%
neg-mul-186.5%
sub0-neg86.5%
associate-+l-86.5%
neg-sub086.5%
+-commutative86.5%
unsub-neg86.5%
distribute-neg-frac86.5%
metadata-eval86.5%
metadata-eval86.5%
metadata-eval86.5%
associate-/r*86.5%
metadata-eval86.5%
neg-mul-186.5%
Simplified86.5%
Taylor expanded in x around 0 67.4%
if 1 < x Initial program 66.1%
sub-neg66.1%
+-commutative66.1%
neg-sub066.1%
associate-+l-66.1%
sub-neg66.1%
associate--r+66.1%
neg-sub066.1%
distribute-neg-frac66.1%
metadata-eval66.1%
metadata-eval66.1%
metadata-eval66.1%
associate-/r*66.1%
metadata-eval66.1%
neg-mul-166.1%
sub0-neg66.1%
associate-+l-66.1%
neg-sub066.1%
+-commutative66.1%
unsub-neg66.1%
distribute-neg-frac66.1%
metadata-eval66.1%
metadata-eval66.1%
metadata-eval66.1%
associate-/r*66.1%
metadata-eval66.1%
neg-mul-166.1%
Simplified66.1%
frac-sub66.3%
*-rgt-identity66.3%
metadata-eval66.3%
div-inv66.3%
associate-/r*66.3%
*-un-lft-identity66.3%
metadata-eval66.3%
div-inv66.3%
associate--l-70.8%
div-inv70.8%
metadata-eval70.8%
*-rgt-identity70.8%
div-inv70.8%
metadata-eval70.8%
*-rgt-identity70.8%
Applied egg-rr70.8%
Taylor expanded in x around inf 97.4%
add-cube-cbrt96.9%
pow396.9%
Applied egg-rr96.9%
rem-cube-cbrt97.4%
associate-/l/94.9%
associate-/r*97.4%
Applied egg-rr97.4%
Final simplification74.6%
(FPCore (x) :precision binary64 (/ 2.0 (* (+ x -1.0) (- -1.0 x))))
double code(double x) {
return 2.0 / ((x + -1.0) * (-1.0 - x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 2.0d0 / ((x + (-1.0d0)) * ((-1.0d0) - x))
end function
public static double code(double x) {
return 2.0 / ((x + -1.0) * (-1.0 - x));
}
def code(x): return 2.0 / ((x + -1.0) * (-1.0 - x))
function code(x) return Float64(2.0 / Float64(Float64(x + -1.0) * Float64(-1.0 - x))) end
function tmp = code(x) tmp = 2.0 / ((x + -1.0) * (-1.0 - x)); end
code[x_] := N[(2.0 / N[(N[(x + -1.0), $MachinePrecision] * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(x + -1\right) \cdot \left(-1 - x\right)}
\end{array}
Initial program 81.6%
sub-neg81.6%
+-commutative81.6%
neg-sub081.6%
associate-+l-81.6%
sub-neg81.6%
associate--r+81.6%
neg-sub081.6%
distribute-neg-frac81.6%
metadata-eval81.6%
metadata-eval81.6%
metadata-eval81.6%
associate-/r*81.6%
metadata-eval81.6%
neg-mul-181.6%
sub0-neg81.6%
associate-+l-81.6%
neg-sub081.6%
+-commutative81.6%
unsub-neg81.6%
distribute-neg-frac81.6%
metadata-eval81.6%
metadata-eval81.6%
metadata-eval81.6%
associate-/r*81.6%
metadata-eval81.6%
neg-mul-181.6%
Simplified81.6%
sub-neg81.6%
distribute-neg-frac81.6%
metadata-eval81.6%
Applied egg-rr81.6%
*-rgt-identity81.6%
cancel-sign-sub81.6%
distribute-neg-frac81.6%
metadata-eval81.6%
*-rgt-identity81.6%
*-inverses81.6%
associate-/r*56.5%
distribute-lft-neg-in56.5%
distribute-rgt-neg-in56.5%
*-commutative56.5%
*-lft-identity56.5%
*-inverses56.5%
times-frac81.6%
div-sub81.9%
Simplified98.8%
Final simplification98.8%
(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 86.5%
sub-neg86.5%
+-commutative86.5%
neg-sub086.5%
associate-+l-86.5%
sub-neg86.5%
associate--r+86.5%
neg-sub086.5%
distribute-neg-frac86.5%
metadata-eval86.5%
metadata-eval86.5%
metadata-eval86.5%
associate-/r*86.5%
metadata-eval86.5%
neg-mul-186.5%
sub0-neg86.5%
associate-+l-86.5%
neg-sub086.5%
+-commutative86.5%
unsub-neg86.5%
distribute-neg-frac86.5%
metadata-eval86.5%
metadata-eval86.5%
metadata-eval86.5%
associate-/r*86.5%
metadata-eval86.5%
neg-mul-186.5%
Simplified86.5%
Taylor expanded in x around 0 67.4%
if 1 < x Initial program 66.1%
sub-neg66.1%
+-commutative66.1%
neg-sub066.1%
associate-+l-66.1%
sub-neg66.1%
associate--r+66.1%
neg-sub066.1%
distribute-neg-frac66.1%
metadata-eval66.1%
metadata-eval66.1%
metadata-eval66.1%
associate-/r*66.1%
metadata-eval66.1%
neg-mul-166.1%
sub0-neg66.1%
associate-+l-66.1%
neg-sub066.1%
+-commutative66.1%
unsub-neg66.1%
distribute-neg-frac66.1%
metadata-eval66.1%
metadata-eval66.1%
metadata-eval66.1%
associate-/r*66.1%
metadata-eval66.1%
neg-mul-166.1%
Simplified66.1%
frac-sub66.3%
*-rgt-identity66.3%
metadata-eval66.3%
div-inv66.3%
associate-/r*66.3%
*-un-lft-identity66.3%
metadata-eval66.3%
div-inv66.3%
associate--l-70.8%
div-inv70.8%
metadata-eval70.8%
*-rgt-identity70.8%
div-inv70.8%
metadata-eval70.8%
*-rgt-identity70.8%
Applied egg-rr70.8%
Taylor expanded in x around inf 97.4%
Taylor expanded in x around 0 7.1%
Final simplification53.1%
(FPCore (x) :precision binary64 (/ -2.0 (- -1.0 x)))
double code(double x) {
return -2.0 / (-1.0 - x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (-2.0d0) / ((-1.0d0) - x)
end function
public static double code(double x) {
return -2.0 / (-1.0 - x);
}
def code(x): return -2.0 / (-1.0 - x)
function code(x) return Float64(-2.0 / Float64(-1.0 - x)) end
function tmp = code(x) tmp = -2.0 / (-1.0 - x); end
code[x_] := N[(-2.0 / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-2}{-1 - x}
\end{array}
Initial program 81.6%
sub-neg81.6%
+-commutative81.6%
neg-sub081.6%
associate-+l-81.6%
sub-neg81.6%
associate--r+81.6%
neg-sub081.6%
distribute-neg-frac81.6%
metadata-eval81.6%
metadata-eval81.6%
metadata-eval81.6%
associate-/r*81.6%
metadata-eval81.6%
neg-mul-181.6%
sub0-neg81.6%
associate-+l-81.6%
neg-sub081.6%
+-commutative81.6%
unsub-neg81.6%
distribute-neg-frac81.6%
metadata-eval81.6%
metadata-eval81.6%
metadata-eval81.6%
associate-/r*81.6%
metadata-eval81.6%
neg-mul-181.6%
Simplified81.6%
frac-sub81.9%
*-rgt-identity81.9%
metadata-eval81.9%
div-inv81.9%
associate-/r*81.9%
*-un-lft-identity81.9%
metadata-eval81.9%
div-inv81.9%
associate--l-84.3%
div-inv84.3%
metadata-eval84.3%
*-rgt-identity84.3%
div-inv84.3%
metadata-eval84.3%
*-rgt-identity84.3%
Applied egg-rr84.3%
Taylor expanded in x around 0 53.1%
Final simplification53.1%
(FPCore (x) :precision binary64 1.0)
double code(double x) {
return 1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0
end function
public static double code(double x) {
return 1.0;
}
def code(x): return 1.0
function code(x) return 1.0 end
function tmp = code(x) tmp = 1.0; end
code[x_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 81.6%
sub-neg81.6%
+-commutative81.6%
neg-sub081.6%
associate-+l-81.6%
sub-neg81.6%
associate--r+81.6%
neg-sub081.6%
distribute-neg-frac81.6%
metadata-eval81.6%
metadata-eval81.6%
metadata-eval81.6%
associate-/r*81.6%
metadata-eval81.6%
neg-mul-181.6%
sub0-neg81.6%
associate-+l-81.6%
neg-sub081.6%
+-commutative81.6%
unsub-neg81.6%
distribute-neg-frac81.6%
metadata-eval81.6%
metadata-eval81.6%
metadata-eval81.6%
associate-/r*81.6%
metadata-eval81.6%
neg-mul-181.6%
Simplified81.6%
Taylor expanded in x around 0 51.5%
Taylor expanded in x around inf 11.1%
Final simplification11.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 81.6%
sub-neg81.6%
+-commutative81.6%
neg-sub081.6%
associate-+l-81.6%
sub-neg81.6%
associate--r+81.6%
neg-sub081.6%
distribute-neg-frac81.6%
metadata-eval81.6%
metadata-eval81.6%
metadata-eval81.6%
associate-/r*81.6%
metadata-eval81.6%
neg-mul-181.6%
sub0-neg81.6%
associate-+l-81.6%
neg-sub081.6%
+-commutative81.6%
unsub-neg81.6%
distribute-neg-frac81.6%
metadata-eval81.6%
metadata-eval81.6%
metadata-eval81.6%
associate-/r*81.6%
metadata-eval81.6%
neg-mul-181.6%
Simplified81.6%
Taylor expanded in x around 0 52.0%
Final simplification52.0%
herbie shell --seed 2023313
(FPCore (x)
:name "Asymptote A"
:precision binary64
(- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))