?

Average Error: 0.04% → 0.04%
Time: 8.1s
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

Original0.04%
Target0.03%
Herbie0.04%
\[\frac{x}{2 - \left(x + y\right)} - \frac{y}{2 - \left(x + y\right)} \]

Derivation?

  1. Initial program 0.04

    \[\frac{x - y}{2 - \left(x + y\right)} \]
  2. Final simplification0.04

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

Alternatives

Alternative 1
Error27.2%
Cost1376
\[\begin{array}{l} t_0 := 1 - \frac{x}{y}\\ t_1 := \frac{x}{2 - x}\\ \mathbf{if}\;y \leq -2.5 \cdot 10^{+42}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -6.8 \cdot 10^{-48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{-75}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -9.4 \cdot 10^{-119}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.4 \cdot 10^{-128}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 3.9 \cdot 10^{+32}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{+60}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+111}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error38.93%
Cost1112
\[\begin{array}{l} t_0 := -1 + \frac{y}{x}\\ t_1 := 1 - \frac{x}{y}\\ \mathbf{if}\;x \leq -4.4 \cdot 10^{+63}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{-8}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -5.7 \cdot 10^{-51}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq -9.2 \cdot 10^{-220}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -4.8 \cdot 10^{-297}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 4.7 \cdot 10^{+36}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error39.18%
Cost856
\[\begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+63}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-8}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -2.05 \cdot 10^{-50}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-219}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-297}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+36}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 4
Error40.2%
Cost856
\[\begin{array}{l} t_0 := 1 - \frac{x}{y}\\ \mathbf{if}\;x \leq -2.4 \cdot 10^{+106}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{-8}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.85 \cdot 10^{-50}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{-219}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-297}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 4.7 \cdot 10^{+36}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 5
Error26.94%
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{+65}:\\ \;\;\;\;-1 + \frac{y}{x}\\ \mathbf{elif}\;x \leq -2.1 \cdot 10^{-6}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;x \leq -5.8 \cdot 10^{-51} \lor \neg \left(x \leq 4.15 \cdot 10^{-10}\right):\\ \;\;\;\;\frac{x}{2 - x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{y + -2}\\ \end{array} \]
Alternative 6
Error26.84%
Cost848
\[\begin{array}{l} \mathbf{if}\;x \leq -1.75 \cdot 10^{+64}:\\ \;\;\;\;-1 + \frac{y}{x}\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{-8}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;x \leq -9 \cdot 10^{-51}:\\ \;\;\;\;x \cdot \left(0.5 + x \cdot 0.25\right)\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-21}:\\ \;\;\;\;\frac{y}{y + -2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \]
Alternative 7
Error26.99%
Cost848
\[\begin{array}{l} \mathbf{if}\;x \leq -2.05 \cdot 10^{+64}:\\ \;\;\;\;\frac{-1}{\frac{x}{x - y}}\\ \mathbf{elif}\;x \leq -2.5 \cdot 10^{-6}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{-50}:\\ \;\;\;\;x \cdot \left(0.5 + x \cdot 0.25\right)\\ \mathbf{elif}\;x \leq 1.58 \cdot 10^{-12}:\\ \;\;\;\;\frac{y}{y + -2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \]
Alternative 8
Error39.14%
Cost592
\[\begin{array}{l} \mathbf{if}\;x \leq -4.35 \cdot 10^{+64}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -2.12 \cdot 10^{-219}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-295}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+36}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 9
Error38.8%
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+66}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 4.9 \cdot 10^{+36}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 10
Error61.93%
Cost64
\[-1 \]

Error

Reproduce?

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