
(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 7 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 (/ (- 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}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))) (t_1 (/ x (- 2.0 x))))
(if (<= y -1.7e+42)
t_0
(if (<= y -1.6e-101)
t_1
(if (<= y -6.7e-134) (* y -0.5) (if (<= y 58.0) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -1.7e+42) {
tmp = t_0;
} else if (y <= -1.6e-101) {
tmp = t_1;
} else if (y <= -6.7e-134) {
tmp = y * -0.5;
} else if (y <= 58.0) {
tmp = t_1;
} else {
tmp = t_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 = 1.0d0 - (x / y)
t_1 = x / (2.0d0 - x)
if (y <= (-1.7d+42)) then
tmp = t_0
else if (y <= (-1.6d-101)) then
tmp = t_1
else if (y <= (-6.7d-134)) then
tmp = y * (-0.5d0)
else if (y <= 58.0d0) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -1.7e+42) {
tmp = t_0;
} else if (y <= -1.6e-101) {
tmp = t_1;
} else if (y <= -6.7e-134) {
tmp = y * -0.5;
} else if (y <= 58.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) t_1 = x / (2.0 - x) tmp = 0 if y <= -1.7e+42: tmp = t_0 elif y <= -1.6e-101: tmp = t_1 elif y <= -6.7e-134: tmp = y * -0.5 elif y <= 58.0: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) t_1 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -1.7e+42) tmp = t_0; elseif (y <= -1.6e-101) tmp = t_1; elseif (y <= -6.7e-134) tmp = Float64(y * -0.5); elseif (y <= 58.0) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (x / y); t_1 = x / (2.0 - x); tmp = 0.0; if (y <= -1.7e+42) tmp = t_0; elseif (y <= -1.6e-101) tmp = t_1; elseif (y <= -6.7e-134) tmp = y * -0.5; elseif (y <= 58.0) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.7e+42], t$95$0, If[LessEqual[y, -1.6e-101], t$95$1, If[LessEqual[y, -6.7e-134], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 58.0], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
t_1 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -1.7 \cdot 10^{+42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-101}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -6.7 \cdot 10^{-134}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 58:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.69999999999999988e42 or 58 < y Initial program 100.0%
clear-num99.9%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 76.9%
Taylor expanded in y around 0 77.0%
mul-1-neg77.0%
unsub-neg77.0%
Simplified77.0%
if -1.69999999999999988e42 < y < -1.59999999999999989e-101 or -6.69999999999999996e-134 < y < 58Initial program 100.0%
Taylor expanded in y around 0 81.9%
if -1.59999999999999989e-101 < y < -6.69999999999999996e-134Initial program 100.0%
Taylor expanded in x around 0 100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification80.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 2.0 x))))
(if (<= y -3.1e+41)
(- 1.0 (/ x y))
(if (<= y -8.5e-102)
t_0
(if (<= y -6.7e-134)
(* y -0.5)
(if (<= y 1.15e-7) t_0 (/ y (+ y -2.0))))))))
double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -3.1e+41) {
tmp = 1.0 - (x / y);
} else if (y <= -8.5e-102) {
tmp = t_0;
} else if (y <= -6.7e-134) {
tmp = y * -0.5;
} else if (y <= 1.15e-7) {
tmp = t_0;
} else {
tmp = y / (y + -2.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 <= (-3.1d+41)) then
tmp = 1.0d0 - (x / y)
else if (y <= (-8.5d-102)) then
tmp = t_0
else if (y <= (-6.7d-134)) then
tmp = y * (-0.5d0)
else if (y <= 1.15d-7) then
tmp = t_0
else
tmp = y / (y + (-2.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 <= -3.1e+41) {
tmp = 1.0 - (x / y);
} else if (y <= -8.5e-102) {
tmp = t_0;
} else if (y <= -6.7e-134) {
tmp = y * -0.5;
} else if (y <= 1.15e-7) {
tmp = t_0;
} else {
tmp = y / (y + -2.0);
}
return tmp;
}
def code(x, y): t_0 = x / (2.0 - x) tmp = 0 if y <= -3.1e+41: tmp = 1.0 - (x / y) elif y <= -8.5e-102: tmp = t_0 elif y <= -6.7e-134: tmp = y * -0.5 elif y <= 1.15e-7: tmp = t_0 else: tmp = y / (y + -2.0) return tmp
function code(x, y) t_0 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -3.1e+41) tmp = Float64(1.0 - Float64(x / y)); elseif (y <= -8.5e-102) tmp = t_0; elseif (y <= -6.7e-134) tmp = Float64(y * -0.5); elseif (y <= 1.15e-7) tmp = t_0; else tmp = Float64(y / Float64(y + -2.0)); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (2.0 - x); tmp = 0.0; if (y <= -3.1e+41) tmp = 1.0 - (x / y); elseif (y <= -8.5e-102) tmp = t_0; elseif (y <= -6.7e-134) tmp = y * -0.5; elseif (y <= 1.15e-7) tmp = t_0; else tmp = y / (y + -2.0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.1e+41], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -8.5e-102], t$95$0, If[LessEqual[y, -6.7e-134], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.15e-7], t$95$0, N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -3.1 \cdot 10^{+41}:\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{elif}\;y \leq -8.5 \cdot 10^{-102}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -6.7 \cdot 10^{-134}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + -2}\\
\end{array}
\end{array}
if y < -3.1e41Initial program 100.0%
clear-num99.9%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 86.4%
Taylor expanded in y around 0 86.6%
mul-1-neg86.6%
unsub-neg86.6%
Simplified86.6%
if -3.1e41 < y < -8.49999999999999973e-102 or -6.69999999999999996e-134 < y < 1.14999999999999997e-7Initial program 100.0%
Taylor expanded in y around 0 81.9%
if -8.49999999999999973e-102 < y < -6.69999999999999996e-134Initial program 100.0%
Taylor expanded in x around 0 100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
*-commutative100.0%
Simplified100.0%
if 1.14999999999999997e-7 < y Initial program 99.9%
Taylor expanded in x around 0 72.4%
mul-1-neg72.4%
distribute-neg-frac72.4%
Simplified72.4%
frac-2neg72.4%
div-inv72.2%
remove-double-neg72.2%
sub-neg72.2%
distribute-neg-in72.2%
metadata-eval72.2%
remove-double-neg72.2%
Applied egg-rr72.2%
associate-*r/72.4%
*-rgt-identity72.4%
+-commutative72.4%
Simplified72.4%
Final simplification81.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 2.0 x))))
(if (<= y -1e+41)
(+ 1.0 (/ (- (- 2.0 x) x) y))
(if (<= y -4.5e-102)
t_0
(if (<= y -6.7e-134)
(* y -0.5)
(if (<= y 1.9e-9) t_0 (/ y (+ y -2.0))))))))
double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -1e+41) {
tmp = 1.0 + (((2.0 - x) - x) / y);
} else if (y <= -4.5e-102) {
tmp = t_0;
} else if (y <= -6.7e-134) {
tmp = y * -0.5;
} else if (y <= 1.9e-9) {
tmp = t_0;
} else {
tmp = y / (y + -2.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 <= (-1d+41)) then
tmp = 1.0d0 + (((2.0d0 - x) - x) / y)
else if (y <= (-4.5d-102)) then
tmp = t_0
else if (y <= (-6.7d-134)) then
tmp = y * (-0.5d0)
else if (y <= 1.9d-9) then
tmp = t_0
else
tmp = y / (y + (-2.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 <= -1e+41) {
tmp = 1.0 + (((2.0 - x) - x) / y);
} else if (y <= -4.5e-102) {
tmp = t_0;
} else if (y <= -6.7e-134) {
tmp = y * -0.5;
} else if (y <= 1.9e-9) {
tmp = t_0;
} else {
tmp = y / (y + -2.0);
}
return tmp;
}
def code(x, y): t_0 = x / (2.0 - x) tmp = 0 if y <= -1e+41: tmp = 1.0 + (((2.0 - x) - x) / y) elif y <= -4.5e-102: tmp = t_0 elif y <= -6.7e-134: tmp = y * -0.5 elif y <= 1.9e-9: tmp = t_0 else: tmp = y / (y + -2.0) return tmp
function code(x, y) t_0 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -1e+41) tmp = Float64(1.0 + Float64(Float64(Float64(2.0 - x) - x) / y)); elseif (y <= -4.5e-102) tmp = t_0; elseif (y <= -6.7e-134) tmp = Float64(y * -0.5); elseif (y <= 1.9e-9) tmp = t_0; else tmp = Float64(y / Float64(y + -2.0)); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (2.0 - x); tmp = 0.0; if (y <= -1e+41) tmp = 1.0 + (((2.0 - x) - x) / y); elseif (y <= -4.5e-102) tmp = t_0; elseif (y <= -6.7e-134) tmp = y * -0.5; elseif (y <= 1.9e-9) tmp = t_0; else tmp = y / (y + -2.0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1e+41], N[(1.0 + N[(N[(N[(2.0 - x), $MachinePrecision] - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4.5e-102], t$95$0, If[LessEqual[y, -6.7e-134], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.9e-9], t$95$0, N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -1 \cdot 10^{+41}:\\
\;\;\;\;1 + \frac{\left(2 - x\right) - x}{y}\\
\mathbf{elif}\;y \leq -4.5 \cdot 10^{-102}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -6.7 \cdot 10^{-134}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{-9}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + -2}\\
\end{array}
\end{array}
if y < -1.00000000000000001e41Initial program 100.0%
clear-num99.9%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 87.0%
associate--l+87.0%
associate-*r/87.0%
neg-mul-187.0%
associate-*r/87.0%
div-sub87.0%
cancel-sign-sub-inv87.0%
metadata-eval87.0%
*-lft-identity87.0%
+-commutative87.0%
unsub-neg87.0%
Simplified87.0%
if -1.00000000000000001e41 < y < -4.49999999999999999e-102 or -6.69999999999999996e-134 < y < 1.90000000000000006e-9Initial program 100.0%
Taylor expanded in y around 0 81.9%
if -4.49999999999999999e-102 < y < -6.69999999999999996e-134Initial program 100.0%
Taylor expanded in x around 0 100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
*-commutative100.0%
Simplified100.0%
if 1.90000000000000006e-9 < y Initial program 99.9%
Taylor expanded in x around 0 72.4%
mul-1-neg72.4%
distribute-neg-frac72.4%
Simplified72.4%
frac-2neg72.4%
div-inv72.2%
remove-double-neg72.2%
sub-neg72.2%
distribute-neg-in72.2%
metadata-eval72.2%
remove-double-neg72.2%
Applied egg-rr72.2%
associate-*r/72.4%
*-rgt-identity72.4%
+-commutative72.4%
Simplified72.4%
Final simplification81.2%
(FPCore (x y) :precision binary64 (if (or (<= x -3.1e+54) (not (<= x 235000000.0))) (+ (/ y x) -1.0) 1.0))
double code(double x, double y) {
double tmp;
if ((x <= -3.1e+54) || !(x <= 235000000.0)) {
tmp = (y / x) + -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 <= (-3.1d+54)) .or. (.not. (x <= 235000000.0d0))) then
tmp = (y / x) + (-1.0d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -3.1e+54) || !(x <= 235000000.0)) {
tmp = (y / x) + -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -3.1e+54) or not (x <= 235000000.0): tmp = (y / x) + -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((x <= -3.1e+54) || !(x <= 235000000.0)) tmp = Float64(Float64(y / x) + -1.0); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -3.1e+54) || ~((x <= 235000000.0))) tmp = (y / x) + -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -3.1e+54], N[Not[LessEqual[x, 235000000.0]], $MachinePrecision]], N[(N[(y / x), $MachinePrecision] + -1.0), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+54} \lor \neg \left(x \leq 235000000\right):\\
\;\;\;\;\frac{y}{x} + -1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.0999999999999999e54 or 2.35e8 < x Initial program 100.0%
clear-num99.9%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 82.8%
Taylor expanded in x around 0 83.0%
if -3.0999999999999999e54 < x < 2.35e8Initial program 100.0%
Taylor expanded in y around inf 48.9%
Final simplification64.3%
(FPCore (x y) :precision binary64 (if (<= x -7.8e+48) -1.0 (if (<= x 105000000.0) 1.0 -1.0)))
double code(double x, double y) {
double tmp;
if (x <= -7.8e+48) {
tmp = -1.0;
} else if (x <= 105000000.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.8d+48)) then
tmp = -1.0d0
else if (x <= 105000000.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.8e+48) {
tmp = -1.0;
} else if (x <= 105000000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -7.8e+48: tmp = -1.0 elif x <= 105000000.0: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -7.8e+48) tmp = -1.0; elseif (x <= 105000000.0) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -7.8e+48) tmp = -1.0; elseif (x <= 105000000.0) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -7.8e+48], -1.0, If[LessEqual[x, 105000000.0], 1.0, -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{+48}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 105000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -7.8000000000000002e48 or 1.05e8 < x Initial program 100.0%
Taylor expanded in x around inf 82.4%
if -7.8000000000000002e48 < x < 1.05e8Initial program 100.0%
Taylor expanded in y around inf 48.9%
Final simplification64.1%
(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 100.0%
Taylor expanded in x around inf 40.3%
Final simplification40.3%
(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 2024041
(FPCore (x y)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, C"
:precision binary64
:herbie-target
(- (/ x (- 2.0 (+ x y))) (/ y (- 2.0 (+ x y))))
(/ (- x y) (- 2.0 (+ x y))))