?

Average Accuracy: 100.0% → 100.0%
Time: 10.2s
Precision: binary64
Cost: 576

?

\[\frac{x - y}{2 - \left(x + y\right)} \]
\[\frac{x - y}{2 - \left(x + y\right)} \]
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
	return (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
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));
}
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))
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 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
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]
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x - y}{2 - \left(x + y\right)}
\frac{x - y}{2 - \left(x + y\right)}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original100.0%
Target100.0%
Herbie100.0%
\[\frac{x}{2 - \left(x + y\right)} - \frac{y}{2 - \left(x + y\right)} \]

Derivation?

  1. Initial program 100.0%

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

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

Alternatives

Alternative 1
Accuracy62.4%
Cost1376
\[\begin{array}{l} t_0 := 1 + \frac{2}{y}\\ \mathbf{if}\;y \leq -1.02 \cdot 10^{+120}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -3.4 \cdot 10^{+102}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -65000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.9 \cdot 10^{-36}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -2.55 \cdot 10^{-70}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -1.36 \cdot 10^{-272}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-286}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 8600:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Accuracy62.6%
Cost1376
\[\begin{array}{l} t_0 := 1 - \frac{x}{y}\\ \mathbf{if}\;y \leq -1.02 \cdot 10^{+120}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -3.4 \cdot 10^{+102}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -500000000000:\\ \;\;\;\;1 + \frac{2}{y}\\ \mathbf{elif}\;y \leq -4.4 \cdot 10^{-35}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -2.35 \cdot 10^{-69}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{-272}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{-284}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 420000000000:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Accuracy74.0%
Cost1242
\[\begin{array}{l} t_0 := \frac{y}{y + \left(x + -2\right)}\\ \mathbf{if}\;y \leq -1.02 \cdot 10^{+120}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -3.1 \cdot 10^{+102}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -105000000000 \lor \neg \left(y \leq -4.1 \cdot 10^{-35}\right) \land \left(y \leq -5.1 \cdot 10^{-70} \lor \neg \left(y \leq 3.1 \cdot 10^{-52}\right)\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \]
Alternative 4
Accuracy74.0%
Cost1242
\[\begin{array}{l} \mathbf{if}\;y \leq -1.02 \cdot 10^{+120}:\\ \;\;\;\;\frac{2 - \left(x + x\right)}{y} + 1\\ \mathbf{elif}\;y \leq -3.4 \cdot 10^{+102}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -145000000000 \lor \neg \left(y \leq -2.8 \cdot 10^{-35} \lor \neg \left(y \leq -5 \cdot 10^{-70}\right) \land y \leq 1.45 \cdot 10^{-52}\right):\\ \;\;\;\;\frac{y}{y + \left(x + -2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \]
Alternative 5
Accuracy62.3%
Cost1120
\[\begin{array}{l} \mathbf{if}\;y \leq -1.02 \cdot 10^{+120}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -3.4 \cdot 10^{+102}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -500000000000:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -1.65 \cdot 10^{-36}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -1.32 \cdot 10^{-70}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -2.25 \cdot 10^{-272}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{-284}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 24500000000:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 6
Accuracy73.8%
Cost1113
\[\begin{array}{l} \mathbf{if}\;y \leq -1.02 \cdot 10^{+120}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;y \leq -2 \cdot 10^{+102}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -300000000000:\\ \;\;\;\;1 + \frac{2}{y}\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{-36} \lor \neg \left(y \leq -6.5 \cdot 10^{-70}\right) \land y \leq 3.4 \cdot 10^{-53}:\\ \;\;\;\;\frac{x}{2 - x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{y + -2}\\ \end{array} \]
Alternative 7
Accuracy74.2%
Cost1112
\[\begin{array}{l} t_0 := 1 - \frac{x}{y}\\ t_1 := \frac{x}{2 - x}\\ \mathbf{if}\;y \leq -3.8 \cdot 10^{+120}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -3.4 \cdot 10^{+102}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -1850000000000:\\ \;\;\;\;1 + \frac{2}{y}\\ \mathbf{elif}\;y \leq -1.65 \cdot 10^{-35}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{-69}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 3550000000000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Accuracy62.2%
Cost856
\[\begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+120}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -3.4 \cdot 10^{+102}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -1450000000000:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -6.5 \cdot 10^{-36}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -1.3 \cdot 10^{-69}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 220000000:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 9
Accuracy62.5%
Cost592
\[\begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{+120}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -2 \cdot 10^{+102}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -2150000000000:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 250000000:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 10
Accuracy38.3%
Cost64
\[-1 \]

Error

Reproduce?

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