
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
(FPCore (x y) :precision binary64 (let* ((t_0 (+ y (+ -2.0 x)))) (- (/ y t_0) (/ x t_0))))
double code(double x, double y) {
double t_0 = y + (-2.0 + x);
return (y / t_0) - (x / t_0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
t_0 = y + ((-2.0d0) + x)
code = (y / t_0) - (x / t_0)
end function
public static double code(double x, double y) {
double t_0 = y + (-2.0 + x);
return (y / t_0) - (x / t_0);
}
def code(x, y): t_0 = y + (-2.0 + x) return (y / t_0) - (x / t_0)
function code(x, y) t_0 = Float64(y + Float64(-2.0 + x)) return Float64(Float64(y / t_0) - Float64(x / t_0)) end
function tmp = code(x, y) t_0 = y + (-2.0 + x); tmp = (y / t_0) - (x / t_0); end
code[x_, y_] := Block[{t$95$0 = N[(y + N[(-2.0 + x), $MachinePrecision]), $MachinePrecision]}, N[(N[(y / t$95$0), $MachinePrecision] - N[(x / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \left(-2 + x\right)\\
\frac{y}{t\_0} - \frac{x}{t\_0}
\end{array}
\end{array}
Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
div-sub99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= x -1.1e+61)
-1.0
(if (<= x -2.5e-24)
1.0
(if (<= x -6.2e-96)
(* x 0.5)
(if (<= x -1.55e-300)
1.0
(if (<= x 2.8e-292)
(* y -0.5)
(if (<= x 2.02e-230)
1.0
(if (<= x 6e-203)
(* y -0.5)
(if (<= x 2.7e-186)
1.0
(if (<= x 6.5e-153)
(* x 0.5)
(if (<= x 75000000.0) 1.0 -1.0)))))))))))
double code(double x, double y) {
double tmp;
if (x <= -1.1e+61) {
tmp = -1.0;
} else if (x <= -2.5e-24) {
tmp = 1.0;
} else if (x <= -6.2e-96) {
tmp = x * 0.5;
} else if (x <= -1.55e-300) {
tmp = 1.0;
} else if (x <= 2.8e-292) {
tmp = y * -0.5;
} else if (x <= 2.02e-230) {
tmp = 1.0;
} else if (x <= 6e-203) {
tmp = y * -0.5;
} else if (x <= 2.7e-186) {
tmp = 1.0;
} else if (x <= 6.5e-153) {
tmp = x * 0.5;
} else if (x <= 75000000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.1d+61)) then
tmp = -1.0d0
else if (x <= (-2.5d-24)) then
tmp = 1.0d0
else if (x <= (-6.2d-96)) then
tmp = x * 0.5d0
else if (x <= (-1.55d-300)) then
tmp = 1.0d0
else if (x <= 2.8d-292) then
tmp = y * (-0.5d0)
else if (x <= 2.02d-230) then
tmp = 1.0d0
else if (x <= 6d-203) then
tmp = y * (-0.5d0)
else if (x <= 2.7d-186) then
tmp = 1.0d0
else if (x <= 6.5d-153) then
tmp = x * 0.5d0
else if (x <= 75000000.0d0) then
tmp = 1.0d0
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.1e+61) {
tmp = -1.0;
} else if (x <= -2.5e-24) {
tmp = 1.0;
} else if (x <= -6.2e-96) {
tmp = x * 0.5;
} else if (x <= -1.55e-300) {
tmp = 1.0;
} else if (x <= 2.8e-292) {
tmp = y * -0.5;
} else if (x <= 2.02e-230) {
tmp = 1.0;
} else if (x <= 6e-203) {
tmp = y * -0.5;
} else if (x <= 2.7e-186) {
tmp = 1.0;
} else if (x <= 6.5e-153) {
tmp = x * 0.5;
} else if (x <= 75000000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.1e+61: tmp = -1.0 elif x <= -2.5e-24: tmp = 1.0 elif x <= -6.2e-96: tmp = x * 0.5 elif x <= -1.55e-300: tmp = 1.0 elif x <= 2.8e-292: tmp = y * -0.5 elif x <= 2.02e-230: tmp = 1.0 elif x <= 6e-203: tmp = y * -0.5 elif x <= 2.7e-186: tmp = 1.0 elif x <= 6.5e-153: tmp = x * 0.5 elif x <= 75000000.0: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -1.1e+61) tmp = -1.0; elseif (x <= -2.5e-24) tmp = 1.0; elseif (x <= -6.2e-96) tmp = Float64(x * 0.5); elseif (x <= -1.55e-300) tmp = 1.0; elseif (x <= 2.8e-292) tmp = Float64(y * -0.5); elseif (x <= 2.02e-230) tmp = 1.0; elseif (x <= 6e-203) tmp = Float64(y * -0.5); elseif (x <= 2.7e-186) tmp = 1.0; elseif (x <= 6.5e-153) tmp = Float64(x * 0.5); elseif (x <= 75000000.0) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.1e+61) tmp = -1.0; elseif (x <= -2.5e-24) tmp = 1.0; elseif (x <= -6.2e-96) tmp = x * 0.5; elseif (x <= -1.55e-300) tmp = 1.0; elseif (x <= 2.8e-292) tmp = y * -0.5; elseif (x <= 2.02e-230) tmp = 1.0; elseif (x <= 6e-203) tmp = y * -0.5; elseif (x <= 2.7e-186) tmp = 1.0; elseif (x <= 6.5e-153) tmp = x * 0.5; elseif (x <= 75000000.0) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.1e+61], -1.0, If[LessEqual[x, -2.5e-24], 1.0, If[LessEqual[x, -6.2e-96], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, -1.55e-300], 1.0, If[LessEqual[x, 2.8e-292], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 2.02e-230], 1.0, If[LessEqual[x, 6e-203], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 2.7e-186], 1.0, If[LessEqual[x, 6.5e-153], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 75000000.0], 1.0, -1.0]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+61}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-24}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -6.2 \cdot 10^{-96}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-300}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-292}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 2.02 \cdot 10^{-230}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-203}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-186}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-153}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 75000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -1.1e61 or 7.5e7 < x Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 80.2%
if -1.1e61 < x < -2.4999999999999999e-24 or -6.1999999999999998e-96 < x < -1.5500000000000001e-300 or 2.8000000000000001e-292 < x < 2.0199999999999999e-230 or 6.0000000000000002e-203 < x < 2.6999999999999999e-186 or 6.50000000000000032e-153 < x < 7.5e7Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 62.9%
if -2.4999999999999999e-24 < x < -6.1999999999999998e-96 or 2.6999999999999999e-186 < x < 6.50000000000000032e-153Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 74.6%
mul-1-neg74.6%
distribute-neg-frac274.6%
sub-neg74.6%
metadata-eval74.6%
distribute-neg-in74.6%
metadata-eval74.6%
+-commutative74.6%
unsub-neg74.6%
Simplified74.6%
Taylor expanded in x around 0 74.6%
*-commutative74.6%
Simplified74.6%
if -1.5500000000000001e-300 < x < 2.8000000000000001e-292 or 2.0199999999999999e-230 < x < 6.0000000000000002e-203Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 89.1%
Taylor expanded in y around 0 76.4%
*-commutative76.4%
Simplified76.4%
Final simplification72.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (- y 2.0))) (t_1 (/ x (- 2.0 x))))
(if (<= y -9.2e-24)
t_0
(if (<= y 3e-73)
t_1
(if (<= y 3.6e-43)
t_0
(if (<= y 11000000000.0)
-1.0
(if (or (<= y 1.3e+83) (not (<= y 1.8e+117)))
(* (/ 1.0 y) (- y x))
t_1)))))))
double code(double x, double y) {
double t_0 = y / (y - 2.0);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -9.2e-24) {
tmp = t_0;
} else if (y <= 3e-73) {
tmp = t_1;
} else if (y <= 3.6e-43) {
tmp = t_0;
} else if (y <= 11000000000.0) {
tmp = -1.0;
} else if ((y <= 1.3e+83) || !(y <= 1.8e+117)) {
tmp = (1.0 / y) * (y - x);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y / (y - 2.0d0)
t_1 = x / (2.0d0 - x)
if (y <= (-9.2d-24)) then
tmp = t_0
else if (y <= 3d-73) then
tmp = t_1
else if (y <= 3.6d-43) then
tmp = t_0
else if (y <= 11000000000.0d0) then
tmp = -1.0d0
else if ((y <= 1.3d+83) .or. (.not. (y <= 1.8d+117))) then
tmp = (1.0d0 / y) * (y - x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / (y - 2.0);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -9.2e-24) {
tmp = t_0;
} else if (y <= 3e-73) {
tmp = t_1;
} else if (y <= 3.6e-43) {
tmp = t_0;
} else if (y <= 11000000000.0) {
tmp = -1.0;
} else if ((y <= 1.3e+83) || !(y <= 1.8e+117)) {
tmp = (1.0 / y) * (y - x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y): t_0 = y / (y - 2.0) t_1 = x / (2.0 - x) tmp = 0 if y <= -9.2e-24: tmp = t_0 elif y <= 3e-73: tmp = t_1 elif y <= 3.6e-43: tmp = t_0 elif y <= 11000000000.0: tmp = -1.0 elif (y <= 1.3e+83) or not (y <= 1.8e+117): tmp = (1.0 / y) * (y - x) else: tmp = t_1 return tmp
function code(x, y) t_0 = Float64(y / Float64(y - 2.0)) t_1 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -9.2e-24) tmp = t_0; elseif (y <= 3e-73) tmp = t_1; elseif (y <= 3.6e-43) tmp = t_0; elseif (y <= 11000000000.0) tmp = -1.0; elseif ((y <= 1.3e+83) || !(y <= 1.8e+117)) tmp = Float64(Float64(1.0 / y) * Float64(y - x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y) t_0 = y / (y - 2.0); t_1 = x / (2.0 - x); tmp = 0.0; if (y <= -9.2e-24) tmp = t_0; elseif (y <= 3e-73) tmp = t_1; elseif (y <= 3.6e-43) tmp = t_0; elseif (y <= 11000000000.0) tmp = -1.0; elseif ((y <= 1.3e+83) || ~((y <= 1.8e+117))) tmp = (1.0 / y) * (y - x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.2e-24], t$95$0, If[LessEqual[y, 3e-73], t$95$1, If[LessEqual[y, 3.6e-43], t$95$0, If[LessEqual[y, 11000000000.0], -1.0, If[Or[LessEqual[y, 1.3e+83], N[Not[LessEqual[y, 1.8e+117]], $MachinePrecision]], N[(N[(1.0 / y), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{y - 2}\\
t_1 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{-24}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{-43}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 11000000000:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+83} \lor \neg \left(y \leq 1.8 \cdot 10^{+117}\right):\\
\;\;\;\;\frac{1}{y} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.2000000000000004e-24 or 3e-73 < y < 3.5999999999999999e-43Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 76.9%
if -9.2000000000000004e-24 < y < 3e-73 or 1.3000000000000001e83 < y < 1.80000000000000006e117Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 86.0%
mul-1-neg86.0%
distribute-neg-frac286.0%
sub-neg86.0%
metadata-eval86.0%
distribute-neg-in86.0%
metadata-eval86.0%
+-commutative86.0%
unsub-neg86.0%
Simplified86.0%
if 3.5999999999999999e-43 < y < 1.1e10Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 79.7%
if 1.1e10 < y < 1.3000000000000001e83 or 1.80000000000000006e117 < y Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
clear-num99.9%
associate-/r/99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 84.2%
Final simplification82.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 2.0 x))))
(if (<= y -7.2e+31)
1.0
(if (<= y 8.5e-73)
t_0
(if (<= y 3.3e-43)
(* y -0.5)
(if (<= y 2000000000.0)
-1.0
(if (<= y 1.16e+83) 1.0 (if (<= y 2.8e+118) t_0 1.0))))))))
double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -7.2e+31) {
tmp = 1.0;
} else if (y <= 8.5e-73) {
tmp = t_0;
} else if (y <= 3.3e-43) {
tmp = y * -0.5;
} else if (y <= 2000000000.0) {
tmp = -1.0;
} else if (y <= 1.16e+83) {
tmp = 1.0;
} else if (y <= 2.8e+118) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (2.0d0 - x)
if (y <= (-7.2d+31)) then
tmp = 1.0d0
else if (y <= 8.5d-73) then
tmp = t_0
else if (y <= 3.3d-43) then
tmp = y * (-0.5d0)
else if (y <= 2000000000.0d0) then
tmp = -1.0d0
else if (y <= 1.16d+83) then
tmp = 1.0d0
else if (y <= 2.8d+118) then
tmp = t_0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -7.2e+31) {
tmp = 1.0;
} else if (y <= 8.5e-73) {
tmp = t_0;
} else if (y <= 3.3e-43) {
tmp = y * -0.5;
} else if (y <= 2000000000.0) {
tmp = -1.0;
} else if (y <= 1.16e+83) {
tmp = 1.0;
} else if (y <= 2.8e+118) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (2.0 - x) tmp = 0 if y <= -7.2e+31: tmp = 1.0 elif y <= 8.5e-73: tmp = t_0 elif y <= 3.3e-43: tmp = y * -0.5 elif y <= 2000000000.0: tmp = -1.0 elif y <= 1.16e+83: tmp = 1.0 elif y <= 2.8e+118: tmp = t_0 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -7.2e+31) tmp = 1.0; elseif (y <= 8.5e-73) tmp = t_0; elseif (y <= 3.3e-43) tmp = Float64(y * -0.5); elseif (y <= 2000000000.0) tmp = -1.0; elseif (y <= 1.16e+83) tmp = 1.0; elseif (y <= 2.8e+118) tmp = t_0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (2.0 - x); tmp = 0.0; if (y <= -7.2e+31) tmp = 1.0; elseif (y <= 8.5e-73) tmp = t_0; elseif (y <= 3.3e-43) tmp = y * -0.5; elseif (y <= 2000000000.0) tmp = -1.0; elseif (y <= 1.16e+83) tmp = 1.0; elseif (y <= 2.8e+118) tmp = t_0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.2e+31], 1.0, If[LessEqual[y, 8.5e-73], t$95$0, If[LessEqual[y, 3.3e-43], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 2000000000.0], -1.0, If[LessEqual[y, 1.16e+83], 1.0, If[LessEqual[y, 2.8e+118], t$95$0, 1.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -7.2 \cdot 10^{+31}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-73}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-43}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 2000000000:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 1.16 \cdot 10^{+83}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+118}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -7.19999999999999992e31 or 2e9 < y < 1.1600000000000001e83 or 2.79999999999999986e118 < y Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 81.0%
if -7.19999999999999992e31 < y < 8.4999999999999996e-73 or 1.1600000000000001e83 < y < 2.79999999999999986e118Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 80.9%
mul-1-neg80.9%
distribute-neg-frac280.9%
sub-neg80.9%
metadata-eval80.9%
distribute-neg-in80.9%
metadata-eval80.9%
+-commutative80.9%
unsub-neg80.9%
Simplified80.9%
if 8.4999999999999996e-73 < y < 3.30000000000000016e-43Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 79.3%
Taylor expanded in y around 0 79.3%
*-commutative79.3%
Simplified79.3%
if 3.30000000000000016e-43 < y < 2e9Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 79.7%
Final simplification80.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (- y 2.0))) (t_1 (/ x (- 2.0 x))))
(if (<= y -6.8e-24)
t_0
(if (<= y 2.35e-75)
t_1
(if (<= y 3.3e-43)
t_0
(if (<= y 1400000000000.0)
-1.0
(if (<= y 3.5e+79) t_0 (if (<= y 1.6e+117) t_1 1.0))))))))
double code(double x, double y) {
double t_0 = y / (y - 2.0);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -6.8e-24) {
tmp = t_0;
} else if (y <= 2.35e-75) {
tmp = t_1;
} else if (y <= 3.3e-43) {
tmp = t_0;
} else if (y <= 1400000000000.0) {
tmp = -1.0;
} else if (y <= 3.5e+79) {
tmp = t_0;
} else if (y <= 1.6e+117) {
tmp = t_1;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y / (y - 2.0d0)
t_1 = x / (2.0d0 - x)
if (y <= (-6.8d-24)) then
tmp = t_0
else if (y <= 2.35d-75) then
tmp = t_1
else if (y <= 3.3d-43) then
tmp = t_0
else if (y <= 1400000000000.0d0) then
tmp = -1.0d0
else if (y <= 3.5d+79) then
tmp = t_0
else if (y <= 1.6d+117) then
tmp = t_1
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / (y - 2.0);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -6.8e-24) {
tmp = t_0;
} else if (y <= 2.35e-75) {
tmp = t_1;
} else if (y <= 3.3e-43) {
tmp = t_0;
} else if (y <= 1400000000000.0) {
tmp = -1.0;
} else if (y <= 3.5e+79) {
tmp = t_0;
} else if (y <= 1.6e+117) {
tmp = t_1;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = y / (y - 2.0) t_1 = x / (2.0 - x) tmp = 0 if y <= -6.8e-24: tmp = t_0 elif y <= 2.35e-75: tmp = t_1 elif y <= 3.3e-43: tmp = t_0 elif y <= 1400000000000.0: tmp = -1.0 elif y <= 3.5e+79: tmp = t_0 elif y <= 1.6e+117: tmp = t_1 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(y / Float64(y - 2.0)) t_1 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -6.8e-24) tmp = t_0; elseif (y <= 2.35e-75) tmp = t_1; elseif (y <= 3.3e-43) tmp = t_0; elseif (y <= 1400000000000.0) tmp = -1.0; elseif (y <= 3.5e+79) tmp = t_0; elseif (y <= 1.6e+117) tmp = t_1; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = y / (y - 2.0); t_1 = x / (2.0 - x); tmp = 0.0; if (y <= -6.8e-24) tmp = t_0; elseif (y <= 2.35e-75) tmp = t_1; elseif (y <= 3.3e-43) tmp = t_0; elseif (y <= 1400000000000.0) tmp = -1.0; elseif (y <= 3.5e+79) tmp = t_0; elseif (y <= 1.6e+117) tmp = t_1; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.8e-24], t$95$0, If[LessEqual[y, 2.35e-75], t$95$1, If[LessEqual[y, 3.3e-43], t$95$0, If[LessEqual[y, 1400000000000.0], -1.0, If[LessEqual[y, 3.5e+79], t$95$0, If[LessEqual[y, 1.6e+117], t$95$1, 1.0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{y - 2}\\
t_1 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -6.8 \cdot 10^{-24}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{-75}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-43}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1400000000000:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+79}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -6.79999999999999985e-24 or 2.3499999999999999e-75 < y < 3.30000000000000016e-43 or 1.4e12 < y < 3.4999999999999998e79Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 76.0%
if -6.79999999999999985e-24 < y < 2.3499999999999999e-75 or 3.4999999999999998e79 < y < 1.60000000000000002e117Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 86.0%
mul-1-neg86.0%
distribute-neg-frac286.0%
sub-neg86.0%
metadata-eval86.0%
distribute-neg-in86.0%
metadata-eval86.0%
+-commutative86.0%
unsub-neg86.0%
Simplified86.0%
if 3.30000000000000016e-43 < y < 1.4e12Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 79.7%
if 1.60000000000000002e117 < y Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 87.7%
Final simplification82.7%
(FPCore (x y)
:precision binary64
(if (<= x -7.5e+60)
-1.0
(if (<= x -2e-22)
1.0
(if (<= x -6e-96)
(* x 0.5)
(if (<= x 1.2e-186)
1.0
(if (<= x 1.25e-152) (* x 0.5) (if (<= x 52000.0) 1.0 -1.0)))))))
double code(double x, double y) {
double tmp;
if (x <= -7.5e+60) {
tmp = -1.0;
} else if (x <= -2e-22) {
tmp = 1.0;
} else if (x <= -6e-96) {
tmp = x * 0.5;
} else if (x <= 1.2e-186) {
tmp = 1.0;
} else if (x <= 1.25e-152) {
tmp = x * 0.5;
} else if (x <= 52000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-7.5d+60)) then
tmp = -1.0d0
else if (x <= (-2d-22)) then
tmp = 1.0d0
else if (x <= (-6d-96)) then
tmp = x * 0.5d0
else if (x <= 1.2d-186) then
tmp = 1.0d0
else if (x <= 1.25d-152) then
tmp = x * 0.5d0
else if (x <= 52000.0d0) then
tmp = 1.0d0
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -7.5e+60) {
tmp = -1.0;
} else if (x <= -2e-22) {
tmp = 1.0;
} else if (x <= -6e-96) {
tmp = x * 0.5;
} else if (x <= 1.2e-186) {
tmp = 1.0;
} else if (x <= 1.25e-152) {
tmp = x * 0.5;
} else if (x <= 52000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -7.5e+60: tmp = -1.0 elif x <= -2e-22: tmp = 1.0 elif x <= -6e-96: tmp = x * 0.5 elif x <= 1.2e-186: tmp = 1.0 elif x <= 1.25e-152: tmp = x * 0.5 elif x <= 52000.0: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -7.5e+60) tmp = -1.0; elseif (x <= -2e-22) tmp = 1.0; elseif (x <= -6e-96) tmp = Float64(x * 0.5); elseif (x <= 1.2e-186) tmp = 1.0; elseif (x <= 1.25e-152) tmp = Float64(x * 0.5); elseif (x <= 52000.0) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -7.5e+60) tmp = -1.0; elseif (x <= -2e-22) tmp = 1.0; elseif (x <= -6e-96) tmp = x * 0.5; elseif (x <= 1.2e-186) tmp = 1.0; elseif (x <= 1.25e-152) tmp = x * 0.5; elseif (x <= 52000.0) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -7.5e+60], -1.0, If[LessEqual[x, -2e-22], 1.0, If[LessEqual[x, -6e-96], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 1.2e-186], 1.0, If[LessEqual[x, 1.25e-152], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 52000.0], 1.0, -1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+60}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-22}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-96}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-186}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-152}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 52000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -7.5e60 or 52000 < x Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 80.2%
if -7.5e60 < x < -2.0000000000000001e-22 or -6e-96 < x < 1.20000000000000002e-186 or 1.2499999999999999e-152 < x < 52000Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 57.1%
if -2.0000000000000001e-22 < x < -6e-96 or 1.20000000000000002e-186 < x < 1.2499999999999999e-152Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 74.6%
mul-1-neg74.6%
distribute-neg-frac274.6%
sub-neg74.6%
metadata-eval74.6%
distribute-neg-in74.6%
metadata-eval74.6%
+-commutative74.6%
unsub-neg74.6%
Simplified74.6%
Taylor expanded in x around 0 74.6%
*-commutative74.6%
Simplified74.6%
Final simplification69.0%
(FPCore (x y) :precision binary64 (if (<= x -5.8e+60) -1.0 (if (<= x 52000.0) 1.0 -1.0)))
double code(double x, double y) {
double tmp;
if (x <= -5.8e+60) {
tmp = -1.0;
} else if (x <= 52000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-5.8d+60)) then
tmp = -1.0d0
else if (x <= 52000.0d0) then
tmp = 1.0d0
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -5.8e+60) {
tmp = -1.0;
} else if (x <= 52000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5.8e+60: tmp = -1.0 elif x <= 52000.0: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -5.8e+60) tmp = -1.0; elseif (x <= 52000.0) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5.8e+60) tmp = -1.0; elseif (x <= 52000.0) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5.8e+60], -1.0, If[LessEqual[x, 52000.0], 1.0, -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+60}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 52000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -5.79999999999999999e60 or 52000 < x Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 80.2%
if -5.79999999999999999e60 < x < 52000Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 51.1%
Final simplification64.4%
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ y x))))
double code(double x, double y) {
return (x - y) / (2.0 - (y + x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (y + x))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (y + x));
}
def code(x, y): return (x - y) / (2.0 - (y + x))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(y + x))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (y + x)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(y + x\right)}
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 -1.0)
double code(double x, double y) {
return -1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = -1.0d0
end function
public static double code(double x, double y) {
return -1.0;
}
def code(x, y): return -1.0
function code(x, y) return -1.0 end
function tmp = code(x, y) tmp = -1.0; end
code[x_, y_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 39.6%
Final simplification39.6%
(FPCore (x y) :precision binary64 (let* ((t_0 (- 2.0 (+ x y)))) (- (/ x t_0) (/ y t_0))))
double code(double x, double y) {
double t_0 = 2.0 - (x + y);
return (x / t_0) - (y / t_0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
t_0 = 2.0d0 - (x + y)
code = (x / t_0) - (y / t_0)
end function
public static double code(double x, double y) {
double t_0 = 2.0 - (x + y);
return (x / t_0) - (y / t_0);
}
def code(x, y): t_0 = 2.0 - (x + y) return (x / t_0) - (y / t_0)
function code(x, y) t_0 = Float64(2.0 - Float64(x + y)) return Float64(Float64(x / t_0) - Float64(y / t_0)) end
function tmp = code(x, y) t_0 = 2.0 - (x + y); tmp = (x / t_0) - (y / t_0); end
code[x_, y_] := Block[{t$95$0 = N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]}, N[(N[(x / t$95$0), $MachinePrecision] - N[(y / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 - \left(x + y\right)\\
\frac{x}{t\_0} - \frac{y}{t\_0}
\end{array}
\end{array}
herbie shell --seed 2024046
(FPCore (x y)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, C"
:precision binary64
:alt
(- (/ x (- 2.0 (+ x y))) (/ y (- 2.0 (+ x y))))
(/ (- x y) (- 2.0 (+ x y))))