
(FPCore (x) :precision binary64 (+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- x 1.0))))
double code(double x) {
return ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x - 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((1.0d0 / (x + 1.0d0)) - (2.0d0 / x)) + (1.0d0 / (x - 1.0d0))
end function
public static double code(double x) {
return ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x - 1.0));
}
def code(x): return ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x - 1.0))
function code(x) return Float64(Float64(Float64(1.0 / Float64(x + 1.0)) - Float64(2.0 / x)) + Float64(1.0 / Float64(x - 1.0))) end
function tmp = code(x) tmp = ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x - 1.0)); end
code[x_] := N[(N[(N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(2.0 / x), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- x 1.0))))
double code(double x) {
return ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x - 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((1.0d0 / (x + 1.0d0)) - (2.0d0 / x)) + (1.0d0 / (x - 1.0d0))
end function
public static double code(double x) {
return ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x - 1.0));
}
def code(x): return ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x - 1.0))
function code(x) return Float64(Float64(Float64(1.0 / Float64(x + 1.0)) - Float64(2.0 / x)) + Float64(1.0 / Float64(x - 1.0))) end
function tmp = code(x) tmp = ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x - 1.0)); end
code[x_] := N[(N[(N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(2.0 / x), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (* x (- 1.0 x))))
(if (<= x -7e+89)
(/ (/ -2.0 (+ x -1.0)) t_0)
(/ 2.0 (- (* x (+ x -1.0)) (* x t_0))))))
double code(double x) {
double t_0 = x * (1.0 - x);
double tmp;
if (x <= -7e+89) {
tmp = (-2.0 / (x + -1.0)) / t_0;
} else {
tmp = 2.0 / ((x * (x + -1.0)) - (x * t_0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = x * (1.0d0 - x)
if (x <= (-7d+89)) then
tmp = ((-2.0d0) / (x + (-1.0d0))) / t_0
else
tmp = 2.0d0 / ((x * (x + (-1.0d0))) - (x * t_0))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = x * (1.0 - x);
double tmp;
if (x <= -7e+89) {
tmp = (-2.0 / (x + -1.0)) / t_0;
} else {
tmp = 2.0 / ((x * (x + -1.0)) - (x * t_0));
}
return tmp;
}
def code(x): t_0 = x * (1.0 - x) tmp = 0 if x <= -7e+89: tmp = (-2.0 / (x + -1.0)) / t_0 else: tmp = 2.0 / ((x * (x + -1.0)) - (x * t_0)) return tmp
function code(x) t_0 = Float64(x * Float64(1.0 - x)) tmp = 0.0 if (x <= -7e+89) tmp = Float64(Float64(-2.0 / Float64(x + -1.0)) / t_0); else tmp = Float64(2.0 / Float64(Float64(x * Float64(x + -1.0)) - Float64(x * t_0))); end return tmp end
function tmp_2 = code(x) t_0 = x * (1.0 - x); tmp = 0.0; if (x <= -7e+89) tmp = (-2.0 / (x + -1.0)) / t_0; else tmp = 2.0 / ((x * (x + -1.0)) - (x * t_0)); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7e+89], N[(N[(-2.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(2.0 / N[(N[(x * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(1 - x\right)\\
\mathbf{if}\;x \leq -7 \cdot 10^{+89}:\\
\;\;\;\;\frac{\frac{-2}{x + -1}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{x \cdot \left(x + -1\right) - x \cdot t_0}\\
\end{array}
\end{array}
if x < -7.0000000000000001e89Initial program 93.2%
remove-double-neg93.2%
sub-neg93.2%
sub-neg93.2%
distribute-neg-frac93.2%
metadata-eval93.2%
metadata-eval93.2%
metadata-eval93.2%
associate-/r*93.2%
metadata-eval93.2%
neg-mul-193.2%
associate--l+93.2%
+-commutative93.2%
distribute-neg-frac93.2%
metadata-eval93.2%
metadata-eval93.2%
metadata-eval93.2%
associate-/r*93.2%
metadata-eval93.2%
neg-mul-193.2%
sub0-neg93.2%
associate-+l-93.2%
neg-sub093.2%
Simplified93.2%
frac-2neg93.2%
metadata-eval93.2%
frac-sub17.2%
frac-add20.1%
fma-def20.1%
+-commutative20.1%
distribute-neg-in20.1%
neg-mul-120.1%
metadata-eval20.1%
fma-def20.1%
*-rgt-identity20.1%
+-commutative20.1%
distribute-neg-in20.1%
neg-mul-120.1%
metadata-eval20.1%
fma-def20.1%
Applied egg-rr20.1%
Taylor expanded in x around 0 98.3%
expm1-log1p-u98.3%
expm1-udef93.2%
Applied egg-rr93.2%
expm1-def98.3%
expm1-log1p98.3%
associate-/r*100.0%
Simplified100.0%
Applied egg-rr100.0%
neg-sub0100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
if -7.0000000000000001e89 < x Initial program 82.0%
remove-double-neg82.0%
sub-neg82.0%
sub-neg82.0%
distribute-neg-frac82.0%
metadata-eval82.0%
metadata-eval82.0%
metadata-eval82.0%
associate-/r*82.0%
metadata-eval82.0%
neg-mul-182.0%
associate--l+82.0%
+-commutative82.0%
distribute-neg-frac82.0%
metadata-eval82.0%
metadata-eval82.0%
metadata-eval82.0%
associate-/r*82.0%
metadata-eval82.0%
neg-mul-182.0%
sub0-neg82.0%
associate-+l-82.0%
neg-sub082.0%
Simplified82.0%
frac-2neg82.0%
metadata-eval82.0%
frac-sub68.7%
frac-add68.6%
fma-def68.6%
+-commutative68.6%
distribute-neg-in68.6%
neg-mul-168.6%
metadata-eval68.6%
fma-def68.6%
*-rgt-identity68.6%
+-commutative68.6%
distribute-neg-in68.6%
neg-mul-168.6%
metadata-eval68.6%
fma-def68.6%
Applied egg-rr68.6%
Taylor expanded in x around 0 99.9%
*-commutative99.9%
fma-udef99.9%
neg-mul-199.9%
distribute-lft-in99.9%
*-commutative99.9%
neg-mul-199.9%
distribute-rgt-neg-in99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x) :precision binary64 (/ (/ 2.0 (fma x x x)) (+ x -1.0)))
double code(double x) {
return (2.0 / fma(x, x, x)) / (x + -1.0);
}
function code(x) return Float64(Float64(2.0 / fma(x, x, x)) / Float64(x + -1.0)) end
code[x_] := N[(N[(2.0 / N[(x * x + x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2}{\mathsf{fma}\left(x, x, x\right)}}{x + -1}
\end{array}
Initial program 84.3%
remove-double-neg84.3%
sub-neg84.3%
sub-neg84.3%
distribute-neg-frac84.3%
metadata-eval84.3%
metadata-eval84.3%
metadata-eval84.3%
associate-/r*84.3%
metadata-eval84.3%
neg-mul-184.3%
associate--l+84.3%
+-commutative84.3%
distribute-neg-frac84.3%
metadata-eval84.3%
metadata-eval84.3%
metadata-eval84.3%
associate-/r*84.3%
metadata-eval84.3%
neg-mul-184.3%
sub0-neg84.3%
associate-+l-84.3%
neg-sub084.3%
Simplified84.3%
frac-2neg84.3%
metadata-eval84.3%
frac-sub58.2%
frac-add58.7%
fma-def58.7%
+-commutative58.7%
distribute-neg-in58.7%
neg-mul-158.7%
metadata-eval58.7%
fma-def58.7%
*-rgt-identity58.7%
+-commutative58.7%
distribute-neg-in58.7%
neg-mul-158.7%
metadata-eval58.7%
fma-def58.7%
Applied egg-rr58.7%
Taylor expanded in x around 0 99.6%
expm1-log1p-u70.9%
expm1-udef55.5%
Applied egg-rr55.5%
expm1-def70.9%
expm1-log1p99.6%
associate-/r*99.9%
Simplified99.9%
Applied egg-rr99.9%
associate-*r*99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-*l/99.9%
associate-*r/99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x) :precision binary64 (if (or (<= x -340000.0) (not (<= x 450000.0))) (/ (/ -2.0 (+ x -1.0)) (* x (- 1.0 x))) (+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (+ x -1.0)))))
double code(double x) {
double tmp;
if ((x <= -340000.0) || !(x <= 450000.0)) {
tmp = (-2.0 / (x + -1.0)) / (x * (1.0 - x));
} else {
tmp = ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x + -1.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-340000.0d0)) .or. (.not. (x <= 450000.0d0))) then
tmp = ((-2.0d0) / (x + (-1.0d0))) / (x * (1.0d0 - x))
else
tmp = ((1.0d0 / (x + 1.0d0)) - (2.0d0 / x)) + (1.0d0 / (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((x <= -340000.0) || !(x <= 450000.0)) {
tmp = (-2.0 / (x + -1.0)) / (x * (1.0 - x));
} else {
tmp = ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x + -1.0));
}
return tmp;
}
def code(x): tmp = 0 if (x <= -340000.0) or not (x <= 450000.0): tmp = (-2.0 / (x + -1.0)) / (x * (1.0 - x)) else: tmp = ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x + -1.0)) return tmp
function code(x) tmp = 0.0 if ((x <= -340000.0) || !(x <= 450000.0)) tmp = Float64(Float64(-2.0 / Float64(x + -1.0)) / Float64(x * Float64(1.0 - x))); else tmp = Float64(Float64(Float64(1.0 / Float64(x + 1.0)) - Float64(2.0 / x)) + Float64(1.0 / Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((x <= -340000.0) || ~((x <= 450000.0))) tmp = (-2.0 / (x + -1.0)) / (x * (1.0 - x)); else tmp = ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x + -1.0)); end tmp_2 = tmp; end
code[x_] := If[Or[LessEqual[x, -340000.0], N[Not[LessEqual[x, 450000.0]], $MachinePrecision]], N[(N[(-2.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(2.0 / x), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -340000 \lor \neg \left(x \leq 450000\right):\\
\;\;\;\;\frac{\frac{-2}{x + -1}}{x \cdot \left(1 - x\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x + -1}\\
\end{array}
\end{array}
if x < -3.4e5 or 4.5e5 < x Initial program 68.1%
remove-double-neg68.1%
sub-neg68.1%
sub-neg68.1%
distribute-neg-frac68.1%
metadata-eval68.1%
metadata-eval68.1%
metadata-eval68.1%
associate-/r*68.1%
metadata-eval68.1%
neg-mul-168.1%
associate--l+68.1%
+-commutative68.1%
distribute-neg-frac68.1%
metadata-eval68.1%
metadata-eval68.1%
metadata-eval68.1%
associate-/r*68.1%
metadata-eval68.1%
neg-mul-168.1%
sub0-neg68.1%
associate-+l-68.1%
neg-sub068.1%
Simplified68.1%
frac-2neg68.1%
metadata-eval68.1%
frac-sub14.2%
frac-add14.8%
fma-def14.8%
+-commutative14.8%
distribute-neg-in14.8%
neg-mul-114.8%
metadata-eval14.8%
fma-def14.8%
*-rgt-identity14.8%
+-commutative14.8%
distribute-neg-in14.8%
neg-mul-114.8%
metadata-eval14.8%
fma-def14.8%
Applied egg-rr14.8%
Taylor expanded in x around 0 99.1%
expm1-log1p-u99.1%
expm1-udef68.1%
Applied egg-rr68.1%
expm1-def99.1%
expm1-log1p99.1%
associate-/r*99.8%
Simplified99.8%
Applied egg-rr99.2%
neg-sub099.2%
distribute-neg-frac99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
if -3.4e5 < x < 4.5e5Initial program 99.6%
Final simplification99.4%
(FPCore (x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (/ (/ -2.0 (+ x -1.0)) (* x (- 1.0 x))) (- (* x -2.0) (/ 2.0 x))))
double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (-2.0 / (x + -1.0)) / (x * (1.0 - x));
} else {
tmp = (x * -2.0) - (2.0 / x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = ((-2.0d0) / (x + (-1.0d0))) / (x * (1.0d0 - x))
else
tmp = (x * (-2.0d0)) - (2.0d0 / x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (-2.0 / (x + -1.0)) / (x * (1.0 - x));
} else {
tmp = (x * -2.0) - (2.0 / x);
}
return tmp;
}
def code(x): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = (-2.0 / (x + -1.0)) / (x * (1.0 - x)) else: tmp = (x * -2.0) - (2.0 / x) return tmp
function code(x) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(Float64(-2.0 / Float64(x + -1.0)) / Float64(x * Float64(1.0 - x))); else tmp = Float64(Float64(x * -2.0) - Float64(2.0 / x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = (-2.0 / (x + -1.0)) / (x * (1.0 - x)); else tmp = (x * -2.0) - (2.0 / x); end tmp_2 = tmp; end
code[x_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(-2.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * -2.0), $MachinePrecision] - N[(2.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{\frac{-2}{x + -1}}{x \cdot \left(1 - x\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot -2 - \frac{2}{x}\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 68.1%
remove-double-neg68.1%
sub-neg68.1%
sub-neg68.1%
distribute-neg-frac68.1%
metadata-eval68.1%
metadata-eval68.1%
metadata-eval68.1%
associate-/r*68.1%
metadata-eval68.1%
neg-mul-168.1%
associate--l+68.1%
+-commutative68.1%
distribute-neg-frac68.1%
metadata-eval68.1%
metadata-eval68.1%
metadata-eval68.1%
associate-/r*68.1%
metadata-eval68.1%
neg-mul-168.1%
sub0-neg68.1%
associate-+l-68.1%
neg-sub068.1%
Simplified68.1%
frac-2neg68.1%
metadata-eval68.1%
frac-sub15.1%
frac-add16.2%
fma-def16.2%
+-commutative16.2%
distribute-neg-in16.2%
neg-mul-116.2%
metadata-eval16.2%
fma-def16.2%
*-rgt-identity16.2%
+-commutative16.2%
distribute-neg-in16.2%
neg-mul-116.2%
metadata-eval16.2%
fma-def16.2%
Applied egg-rr16.2%
Taylor expanded in x around 0 99.2%
expm1-log1p-u99.2%
expm1-udef67.9%
Applied egg-rr67.9%
expm1-def99.2%
expm1-log1p99.2%
associate-/r*99.8%
Simplified99.8%
Applied egg-rr98.2%
neg-sub098.2%
distribute-neg-frac98.2%
metadata-eval98.2%
+-commutative98.2%
Simplified98.2%
if -1 < x < 1Initial program 100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--l+100.0%
+-commutative100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub0-neg100.0%
associate-+l-100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification99.1%
(FPCore (x)
:precision binary64
(if (<= x -1.0)
(+ (/ -1.0 x) (/ 1.0 x))
(if (<= x 0.65)
(- (* x -2.0) (/ 2.0 x))
(+ (/ -1.0 x) (/ 1.0 (+ x -1.0))))))
double code(double x) {
double tmp;
if (x <= -1.0) {
tmp = (-1.0 / x) + (1.0 / x);
} else if (x <= 0.65) {
tmp = (x * -2.0) - (2.0 / x);
} else {
tmp = (-1.0 / x) + (1.0 / (x + -1.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = ((-1.0d0) / x) + (1.0d0 / x)
else if (x <= 0.65d0) then
tmp = (x * (-2.0d0)) - (2.0d0 / x)
else
tmp = ((-1.0d0) / x) + (1.0d0 / (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -1.0) {
tmp = (-1.0 / x) + (1.0 / x);
} else if (x <= 0.65) {
tmp = (x * -2.0) - (2.0 / x);
} else {
tmp = (-1.0 / x) + (1.0 / (x + -1.0));
}
return tmp;
}
def code(x): tmp = 0 if x <= -1.0: tmp = (-1.0 / x) + (1.0 / x) elif x <= 0.65: tmp = (x * -2.0) - (2.0 / x) else: tmp = (-1.0 / x) + (1.0 / (x + -1.0)) return tmp
function code(x) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(-1.0 / x) + Float64(1.0 / x)); elseif (x <= 0.65) tmp = Float64(Float64(x * -2.0) - Float64(2.0 / x)); else tmp = Float64(Float64(-1.0 / x) + Float64(1.0 / Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -1.0) tmp = (-1.0 / x) + (1.0 / x); elseif (x <= 0.65) tmp = (x * -2.0) - (2.0 / x); else tmp = (-1.0 / x) + (1.0 / (x + -1.0)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -1.0], N[(N[(-1.0 / x), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.65], N[(N[(x * -2.0), $MachinePrecision] - N[(2.0 / x), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / x), $MachinePrecision] + N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{-1}{x} + \frac{1}{x}\\
\mathbf{elif}\;x \leq 0.65:\\
\;\;\;\;x \cdot -2 - \frac{2}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{x} + \frac{1}{x + -1}\\
\end{array}
\end{array}
if x < -1Initial program 72.5%
remove-double-neg72.5%
sub-neg72.5%
sub-neg72.5%
distribute-neg-frac72.5%
metadata-eval72.5%
metadata-eval72.5%
metadata-eval72.5%
associate-/r*72.5%
metadata-eval72.5%
neg-mul-172.5%
associate--l+72.5%
+-commutative72.5%
distribute-neg-frac72.5%
metadata-eval72.5%
metadata-eval72.5%
metadata-eval72.5%
associate-/r*72.5%
metadata-eval72.5%
neg-mul-172.5%
sub0-neg72.5%
associate-+l-72.5%
neg-sub072.5%
Simplified72.5%
Taylor expanded in x around inf 70.4%
Taylor expanded in x around inf 70.5%
if -1 < x < 0.650000000000000022Initial program 100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--l+100.0%
+-commutative100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub0-neg100.0%
associate-+l-100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if 0.650000000000000022 < x Initial program 62.7%
remove-double-neg62.7%
sub-neg62.7%
sub-neg62.7%
distribute-neg-frac62.7%
metadata-eval62.7%
metadata-eval62.7%
metadata-eval62.7%
associate-/r*62.7%
metadata-eval62.7%
neg-mul-162.7%
associate--l+62.7%
+-commutative62.7%
distribute-neg-frac62.7%
metadata-eval62.7%
metadata-eval62.7%
metadata-eval62.7%
associate-/r*62.7%
metadata-eval62.7%
neg-mul-162.7%
sub0-neg62.7%
associate-+l-62.7%
neg-sub062.7%
Simplified62.7%
Taylor expanded in x around inf 62.6%
Applied egg-rr7.7%
fma-udef36.2%
pow-sqr63.1%
metadata-eval63.1%
metadata-eval63.1%
+-commutative63.1%
metadata-eval63.1%
unpow-163.1%
+-commutative63.1%
Simplified63.1%
Final simplification83.9%
(FPCore (x)
:precision binary64
(if (<= x -0.65)
(+ (/ -1.0 x) (/ 1.0 (+ x 1.0)))
(if (<= x 0.65)
(- (* x -2.0) (/ 2.0 x))
(+ (/ -1.0 x) (/ 1.0 (+ x -1.0))))))
double code(double x) {
double tmp;
if (x <= -0.65) {
tmp = (-1.0 / x) + (1.0 / (x + 1.0));
} else if (x <= 0.65) {
tmp = (x * -2.0) - (2.0 / x);
} else {
tmp = (-1.0 / x) + (1.0 / (x + -1.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-0.65d0)) then
tmp = ((-1.0d0) / x) + (1.0d0 / (x + 1.0d0))
else if (x <= 0.65d0) then
tmp = (x * (-2.0d0)) - (2.0d0 / x)
else
tmp = ((-1.0d0) / x) + (1.0d0 / (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -0.65) {
tmp = (-1.0 / x) + (1.0 / (x + 1.0));
} else if (x <= 0.65) {
tmp = (x * -2.0) - (2.0 / x);
} else {
tmp = (-1.0 / x) + (1.0 / (x + -1.0));
}
return tmp;
}
def code(x): tmp = 0 if x <= -0.65: tmp = (-1.0 / x) + (1.0 / (x + 1.0)) elif x <= 0.65: tmp = (x * -2.0) - (2.0 / x) else: tmp = (-1.0 / x) + (1.0 / (x + -1.0)) return tmp
function code(x) tmp = 0.0 if (x <= -0.65) tmp = Float64(Float64(-1.0 / x) + Float64(1.0 / Float64(x + 1.0))); elseif (x <= 0.65) tmp = Float64(Float64(x * -2.0) - Float64(2.0 / x)); else tmp = Float64(Float64(-1.0 / x) + Float64(1.0 / Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -0.65) tmp = (-1.0 / x) + (1.0 / (x + 1.0)); elseif (x <= 0.65) tmp = (x * -2.0) - (2.0 / x); else tmp = (-1.0 / x) + (1.0 / (x + -1.0)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -0.65], N[(N[(-1.0 / x), $MachinePrecision] + N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.65], N[(N[(x * -2.0), $MachinePrecision] - N[(2.0 / x), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / x), $MachinePrecision] + N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.65:\\
\;\;\;\;\frac{-1}{x} + \frac{1}{x + 1}\\
\mathbf{elif}\;x \leq 0.65:\\
\;\;\;\;x \cdot -2 - \frac{2}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{x} + \frac{1}{x + -1}\\
\end{array}
\end{array}
if x < -0.650000000000000022Initial program 72.5%
remove-double-neg72.5%
sub-neg72.5%
sub-neg72.5%
distribute-neg-frac72.5%
metadata-eval72.5%
metadata-eval72.5%
metadata-eval72.5%
associate-/r*72.5%
metadata-eval72.5%
neg-mul-172.5%
associate--l+72.5%
+-commutative72.5%
distribute-neg-frac72.5%
metadata-eval72.5%
metadata-eval72.5%
metadata-eval72.5%
associate-/r*72.5%
metadata-eval72.5%
neg-mul-172.5%
sub0-neg72.5%
associate-+l-72.5%
neg-sub072.5%
Simplified72.5%
Taylor expanded in x around inf 70.8%
if -0.650000000000000022 < x < 0.650000000000000022Initial program 100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--l+100.0%
+-commutative100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub0-neg100.0%
associate-+l-100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if 0.650000000000000022 < x Initial program 62.7%
remove-double-neg62.7%
sub-neg62.7%
sub-neg62.7%
distribute-neg-frac62.7%
metadata-eval62.7%
metadata-eval62.7%
metadata-eval62.7%
associate-/r*62.7%
metadata-eval62.7%
neg-mul-162.7%
associate--l+62.7%
+-commutative62.7%
distribute-neg-frac62.7%
metadata-eval62.7%
metadata-eval62.7%
metadata-eval62.7%
associate-/r*62.7%
metadata-eval62.7%
neg-mul-162.7%
sub0-neg62.7%
associate-+l-62.7%
neg-sub062.7%
Simplified62.7%
Taylor expanded in x around inf 62.6%
Applied egg-rr7.7%
fma-udef36.2%
pow-sqr63.1%
metadata-eval63.1%
metadata-eval63.1%
+-commutative63.1%
metadata-eval63.1%
unpow-163.1%
+-commutative63.1%
Simplified63.1%
Final simplification83.9%
(FPCore (x)
:precision binary64
(if (<= x -1.0)
(- (/ -1.0 (+ x -1.0)) (/ -1.0 x))
(if (<= x 0.65)
(- (* x -2.0) (/ 2.0 x))
(+ (/ -1.0 x) (/ 1.0 (+ x -1.0))))))
double code(double x) {
double tmp;
if (x <= -1.0) {
tmp = (-1.0 / (x + -1.0)) - (-1.0 / x);
} else if (x <= 0.65) {
tmp = (x * -2.0) - (2.0 / x);
} else {
tmp = (-1.0 / x) + (1.0 / (x + -1.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = ((-1.0d0) / (x + (-1.0d0))) - ((-1.0d0) / x)
else if (x <= 0.65d0) then
tmp = (x * (-2.0d0)) - (2.0d0 / x)
else
tmp = ((-1.0d0) / x) + (1.0d0 / (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -1.0) {
tmp = (-1.0 / (x + -1.0)) - (-1.0 / x);
} else if (x <= 0.65) {
tmp = (x * -2.0) - (2.0 / x);
} else {
tmp = (-1.0 / x) + (1.0 / (x + -1.0));
}
return tmp;
}
def code(x): tmp = 0 if x <= -1.0: tmp = (-1.0 / (x + -1.0)) - (-1.0 / x) elif x <= 0.65: tmp = (x * -2.0) - (2.0 / x) else: tmp = (-1.0 / x) + (1.0 / (x + -1.0)) return tmp
function code(x) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(-1.0 / Float64(x + -1.0)) - Float64(-1.0 / x)); elseif (x <= 0.65) tmp = Float64(Float64(x * -2.0) - Float64(2.0 / x)); else tmp = Float64(Float64(-1.0 / x) + Float64(1.0 / Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -1.0) tmp = (-1.0 / (x + -1.0)) - (-1.0 / x); elseif (x <= 0.65) tmp = (x * -2.0) - (2.0 / x); else tmp = (-1.0 / x) + (1.0 / (x + -1.0)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -1.0], N[(N[(-1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.65], N[(N[(x * -2.0), $MachinePrecision] - N[(2.0 / x), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / x), $MachinePrecision] + N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{-1}{x + -1} - \frac{-1}{x}\\
\mathbf{elif}\;x \leq 0.65:\\
\;\;\;\;x \cdot -2 - \frac{2}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{x} + \frac{1}{x + -1}\\
\end{array}
\end{array}
if x < -1Initial program 72.5%
remove-double-neg72.5%
sub-neg72.5%
sub-neg72.5%
distribute-neg-frac72.5%
metadata-eval72.5%
metadata-eval72.5%
metadata-eval72.5%
associate-/r*72.5%
metadata-eval72.5%
neg-mul-172.5%
associate--l+72.5%
+-commutative72.5%
distribute-neg-frac72.5%
metadata-eval72.5%
metadata-eval72.5%
metadata-eval72.5%
associate-/r*72.5%
metadata-eval72.5%
neg-mul-172.5%
sub0-neg72.5%
associate-+l-72.5%
neg-sub072.5%
Simplified72.5%
Taylor expanded in x around inf 70.8%
add-sqr-sqrt40.0%
sqrt-unprod20.1%
frac-times15.8%
metadata-eval15.8%
metadata-eval15.8%
frac-times20.1%
sqrt-unprod0.0%
add-sqr-sqrt6.0%
*-un-lft-identity6.0%
metadata-eval6.0%
cancel-sign-sub-inv6.0%
Applied egg-rr70.8%
+-commutative70.8%
Simplified70.8%
if -1 < x < 0.650000000000000022Initial program 100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--l+100.0%
+-commutative100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub0-neg100.0%
associate-+l-100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if 0.650000000000000022 < x Initial program 62.7%
remove-double-neg62.7%
sub-neg62.7%
sub-neg62.7%
distribute-neg-frac62.7%
metadata-eval62.7%
metadata-eval62.7%
metadata-eval62.7%
associate-/r*62.7%
metadata-eval62.7%
neg-mul-162.7%
associate--l+62.7%
+-commutative62.7%
distribute-neg-frac62.7%
metadata-eval62.7%
metadata-eval62.7%
metadata-eval62.7%
associate-/r*62.7%
metadata-eval62.7%
neg-mul-162.7%
sub0-neg62.7%
associate-+l-62.7%
neg-sub062.7%
Simplified62.7%
Taylor expanded in x around inf 62.6%
Applied egg-rr7.7%
fma-udef36.2%
pow-sqr63.1%
metadata-eval63.1%
metadata-eval63.1%
+-commutative63.1%
metadata-eval63.1%
unpow-163.1%
+-commutative63.1%
Simplified63.1%
Final simplification83.9%
(FPCore (x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (+ (/ -1.0 x) (/ 1.0 x)) (- (- (/ 2.0 x)) x)))
double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (-1.0 / x) + (1.0 / x);
} else {
tmp = -(2.0 / x) - x;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = ((-1.0d0) / x) + (1.0d0 / x)
else
tmp = -(2.0d0 / x) - x
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (-1.0 / x) + (1.0 / x);
} else {
tmp = -(2.0 / x) - x;
}
return tmp;
}
def code(x): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = (-1.0 / x) + (1.0 / x) else: tmp = -(2.0 / x) - x return tmp
function code(x) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(Float64(-1.0 / x) + Float64(1.0 / x)); else tmp = Float64(Float64(-Float64(2.0 / x)) - x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = (-1.0 / x) + (1.0 / x); else tmp = -(2.0 / x) - x; end tmp_2 = tmp; end
code[x_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(-1.0 / x), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[((-N[(2.0 / x), $MachinePrecision]) - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-1}{x} + \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{2}{x}\right) - x\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 68.1%
remove-double-neg68.1%
sub-neg68.1%
sub-neg68.1%
distribute-neg-frac68.1%
metadata-eval68.1%
metadata-eval68.1%
metadata-eval68.1%
associate-/r*68.1%
metadata-eval68.1%
neg-mul-168.1%
associate--l+68.1%
+-commutative68.1%
distribute-neg-frac68.1%
metadata-eval68.1%
metadata-eval68.1%
metadata-eval68.1%
associate-/r*68.1%
metadata-eval68.1%
neg-mul-168.1%
sub0-neg68.1%
associate-+l-68.1%
neg-sub068.1%
Simplified68.1%
Taylor expanded in x around inf 67.2%
Taylor expanded in x around inf 67.0%
if -1 < x < 1Initial program 100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--l+100.0%
+-commutative100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub0-neg100.0%
associate-+l-100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in x around 0 99.7%
Taylor expanded in x around 0 99.7%
neg-mul-199.7%
associate-*r/99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification83.6%
(FPCore (x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (+ (/ -1.0 x) (/ 1.0 x)) (- (* x -2.0) (/ 2.0 x))))
double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (-1.0 / x) + (1.0 / x);
} else {
tmp = (x * -2.0) - (2.0 / x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = ((-1.0d0) / x) + (1.0d0 / x)
else
tmp = (x * (-2.0d0)) - (2.0d0 / x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (-1.0 / x) + (1.0 / x);
} else {
tmp = (x * -2.0) - (2.0 / x);
}
return tmp;
}
def code(x): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = (-1.0 / x) + (1.0 / x) else: tmp = (x * -2.0) - (2.0 / x) return tmp
function code(x) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(Float64(-1.0 / x) + Float64(1.0 / x)); else tmp = Float64(Float64(x * -2.0) - Float64(2.0 / x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = (-1.0 / x) + (1.0 / x); else tmp = (x * -2.0) - (2.0 / x); end tmp_2 = tmp; end
code[x_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(-1.0 / x), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(N[(x * -2.0), $MachinePrecision] - N[(2.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-1}{x} + \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot -2 - \frac{2}{x}\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 68.1%
remove-double-neg68.1%
sub-neg68.1%
sub-neg68.1%
distribute-neg-frac68.1%
metadata-eval68.1%
metadata-eval68.1%
metadata-eval68.1%
associate-/r*68.1%
metadata-eval68.1%
neg-mul-168.1%
associate--l+68.1%
+-commutative68.1%
distribute-neg-frac68.1%
metadata-eval68.1%
metadata-eval68.1%
metadata-eval68.1%
associate-/r*68.1%
metadata-eval68.1%
neg-mul-168.1%
sub0-neg68.1%
associate-+l-68.1%
neg-sub068.1%
Simplified68.1%
Taylor expanded in x around inf 67.2%
Taylor expanded in x around inf 67.0%
if -1 < x < 1Initial program 100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--l+100.0%
+-commutative100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub0-neg100.0%
associate-+l-100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification83.8%
(FPCore (x) :precision binary64 (/ -2.0 x))
double code(double x) {
return -2.0 / x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (-2.0d0) / x
end function
public static double code(double x) {
return -2.0 / x;
}
def code(x): return -2.0 / x
function code(x) return Float64(-2.0 / x) end
function tmp = code(x) tmp = -2.0 / x; end
code[x_] := N[(-2.0 / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{-2}{x}
\end{array}
Initial program 84.3%
remove-double-neg84.3%
sub-neg84.3%
sub-neg84.3%
distribute-neg-frac84.3%
metadata-eval84.3%
metadata-eval84.3%
metadata-eval84.3%
associate-/r*84.3%
metadata-eval84.3%
neg-mul-184.3%
associate--l+84.3%
+-commutative84.3%
distribute-neg-frac84.3%
metadata-eval84.3%
metadata-eval84.3%
metadata-eval84.3%
associate-/r*84.3%
metadata-eval84.3%
neg-mul-184.3%
sub0-neg84.3%
associate-+l-84.3%
neg-sub084.3%
Simplified84.3%
Taylor expanded in x around 0 53.0%
Final simplification53.0%
(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 84.3%
remove-double-neg84.3%
sub-neg84.3%
sub-neg84.3%
distribute-neg-frac84.3%
metadata-eval84.3%
metadata-eval84.3%
metadata-eval84.3%
associate-/r*84.3%
metadata-eval84.3%
neg-mul-184.3%
associate--l+84.3%
+-commutative84.3%
distribute-neg-frac84.3%
metadata-eval84.3%
metadata-eval84.3%
metadata-eval84.3%
associate-/r*84.3%
metadata-eval84.3%
neg-mul-184.3%
sub0-neg84.3%
associate-+l-84.3%
neg-sub084.3%
Simplified84.3%
Taylor expanded in x around 0 52.2%
Taylor expanded in x around inf 3.2%
Final simplification3.2%
(FPCore (x) :precision binary64 (/ 2.0 (* x (- (* x x) 1.0))))
double code(double x) {
return 2.0 / (x * ((x * x) - 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 2.0d0 / (x * ((x * x) - 1.0d0))
end function
public static double code(double x) {
return 2.0 / (x * ((x * x) - 1.0));
}
def code(x): return 2.0 / (x * ((x * x) - 1.0))
function code(x) return Float64(2.0 / Float64(x * Float64(Float64(x * x) - 1.0))) end
function tmp = code(x) tmp = 2.0 / (x * ((x * x) - 1.0)); end
code[x_] := N[(2.0 / N[(x * N[(N[(x * x), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{x \cdot \left(x \cdot x - 1\right)}
\end{array}
herbie shell --seed 2023305
(FPCore (x)
:name "3frac (problem 3.3.3)"
:precision binary64
:herbie-target
(/ 2.0 (* x (- (* x x) 1.0)))
(+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- x 1.0))))