?

Average Error: 0.0 → 0.1
Time: 9.9s
Precision: binary64
Cost: 1216

?

\[\frac{x - y}{2 - \left(x + y\right)} \]
\[\begin{array}{l} t_0 := x + \left(y + -2\right)\\ \frac{y + x}{t_0} - \frac{2 \cdot x}{t_0} \end{array} \]
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ x (+ y -2.0)))) (- (/ (+ y x) t_0) (/ (* 2.0 x) t_0))))
double code(double x, double y) {
	return (x - y) / (2.0 - (x + y));
}
double code(double x, double y) {
	double t_0 = x + (y + -2.0);
	return ((y + x) / t_0) - ((2.0 * x) / t_0);
}
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
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    t_0 = x + (y + (-2.0d0))
    code = ((y + x) / t_0) - ((2.0d0 * x) / t_0)
end function
public static double code(double x, double y) {
	return (x - y) / (2.0 - (x + y));
}
public static double code(double x, double y) {
	double t_0 = x + (y + -2.0);
	return ((y + x) / t_0) - ((2.0 * x) / t_0);
}
def code(x, y):
	return (x - y) / (2.0 - (x + y))
def code(x, y):
	t_0 = x + (y + -2.0)
	return ((y + x) / t_0) - ((2.0 * x) / t_0)
function code(x, y)
	return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y)))
end
function code(x, y)
	t_0 = Float64(x + Float64(y + -2.0))
	return Float64(Float64(Float64(y + x) / t_0) - Float64(Float64(2.0 * x) / t_0))
end
function tmp = code(x, y)
	tmp = (x - y) / (2.0 - (x + y));
end
function tmp = code(x, y)
	t_0 = x + (y + -2.0);
	tmp = ((y + x) / t_0) - ((2.0 * x) / t_0);
end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + -2.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(y + x), $MachinePrecision] / t$95$0), $MachinePrecision] - N[(N[(2.0 * x), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\frac{x - y}{2 - \left(x + y\right)}
\begin{array}{l}
t_0 := x + \left(y + -2\right)\\
\frac{y + x}{t_0} - \frac{2 \cdot x}{t_0}
\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.1
\[\frac{x}{2 - \left(x + y\right)} - \frac{y}{2 - \left(x + y\right)} \]

Derivation?

  1. Initial program 0.0

    \[\frac{x - y}{2 - \left(x + y\right)} \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\frac{x - y}{\left(2 - y\right) - x}} \]
    Proof

    [Start]0.0

    \[ \frac{x - y}{2 - \left(x + y\right)} \]

    rational_best-simplify-58 [=>]0.0

    \[ \frac{x - y}{\color{blue}{\left(2 - y\right) - x}} \]
  3. Applied egg-rr0.0

    \[\leadsto \color{blue}{\left(\frac{y}{x + \left(y + -2\right)} + \frac{x}{x + \left(y + -2\right)}\right) - 2 \cdot \frac{x}{x + \left(y + -2\right)}} \]
  4. Simplified0.1

    \[\leadsto \color{blue}{\frac{y + x}{x + \left(y + -2\right)} - \frac{2 \cdot x}{x + \left(y + -2\right)}} \]
    Proof

    [Start]0.0

    \[ \left(\frac{y}{x + \left(y + -2\right)} + \frac{x}{x + \left(y + -2\right)}\right) - 2 \cdot \frac{x}{x + \left(y + -2\right)} \]

    rational_best-simplify-76 [=>]0.0

    \[ \color{blue}{\frac{y + x}{x + \left(y + -2\right)}} - 2 \cdot \frac{x}{x + \left(y + -2\right)} \]

    rational_best-simplify-62 [=>]0.1

    \[ \frac{y + x}{x + \left(y + -2\right)} - \color{blue}{\frac{x \cdot 2}{x + \left(y + -2\right)}} \]

    rational_best-simplify-1 [<=]0.1

    \[ \frac{y + x}{x + \left(y + -2\right)} - \frac{\color{blue}{2 \cdot x}}{x + \left(y + -2\right)} \]
  5. Final simplification0.1

    \[\leadsto \frac{y + x}{x + \left(y + -2\right)} - \frac{2 \cdot x}{x + \left(y + -2\right)} \]

Alternatives

Alternative 1
Error0.0
Cost960
\[\begin{array}{l} t_0 := x + \left(y + -2\right)\\ \frac{y}{t_0} - \frac{x}{t_0} \end{array} \]
Alternative 2
Error25.0
Cost856
\[\begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+36}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-138}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -4.2 \cdot 10^{-194}:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{elif}\;x \leq -1.25 \cdot 10^{-276}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 8.6 \cdot 10^{-252}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{+41}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 3
Error0.1
Cost832
\[\frac{\left(y + x\right) - 2 \cdot x}{y + \left(x + -2\right)} \]
Alternative 4
Error15.9
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -2.05 \cdot 10^{+17}:\\ \;\;\;\;1 - 2 \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{-6}:\\ \;\;\;\;\frac{x}{\left(2 - y\right) - x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{y - 2}\\ \end{array} \]
Alternative 5
Error15.9
Cost712
\[\begin{array}{l} t_0 := \frac{y}{y + \left(x + -2\right)}\\ \mathbf{if}\;y \leq -6.3 \cdot 10^{-41}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.0055:\\ \;\;\;\;\frac{x}{2 - x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error24.3
Cost592
\[\begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{+36}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -1.46 \cdot 10^{-276}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-250}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{+41}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 7
Error16.0
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -90000000000000:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 61000:\\ \;\;\;\;\frac{x}{2 - x}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 8
Error16.2
Cost584
\[\begin{array}{l} t_0 := \frac{y}{y - 2}\\ \mathbf{if}\;y \leq -1.1 \cdot 10^{-33}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.054:\\ \;\;\;\;\frac{x}{2 - x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error0.0
Cost576
\[\frac{x - y}{2 - \left(x + y\right)} \]
Alternative 10
Error23.9
Cost328
\[\begin{array}{l} \mathbf{if}\;y \leq -3800000000000:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 61000:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 11
Error39.4
Cost64
\[-1 \]

Error

Reproduce?

herbie shell --seed 2023101 
(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))))