?

Average Accuracy: 68.6% → 99.8%
Time: 19.7s
Precision: binary64
Cost: 1088

?

\[ \begin{array}{c}[x, y] = \mathsf{sort}([x, y])\\ \end{array} \]
\[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
\[\frac{\frac{y}{y + \left(x + 1\right)}}{y + x} \cdot \frac{x}{y + x} \]
(FPCore (x y)
 :precision binary64
 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
(FPCore (x y)
 :precision binary64
 (* (/ (/ y (+ y (+ x 1.0))) (+ y x)) (/ x (+ y x))))
double code(double x, double y) {
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
double code(double x, double y) {
	return ((y / (y + (x + 1.0))) / (y + x)) * (x / (y + x));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((y / (y + (x + 1.0d0))) / (y + x)) * (x / (y + x))
end function
public static double code(double x, double y) {
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
public static double code(double x, double y) {
	return ((y / (y + (x + 1.0))) / (y + x)) * (x / (y + x));
}
def code(x, y):
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
def code(x, y):
	return ((y / (y + (x + 1.0))) / (y + x)) * (x / (y + x))
function code(x, y)
	return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0)))
end
function code(x, y)
	return Float64(Float64(Float64(y / Float64(y + Float64(x + 1.0))) / Float64(y + x)) * Float64(x / Float64(y + x)))
end
function tmp = code(x, y)
	tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
end
function tmp = code(x, y)
	tmp = ((y / (y + (x + 1.0))) / (y + x)) * (x / (y + x));
end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\frac{\frac{y}{y + \left(x + 1\right)}}{y + x} \cdot \frac{x}{y + x}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original68.6%
Target99.8%
Herbie99.8%
\[\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}} \]

Derivation?

  1. Initial program 68.6%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Simplified87.4%

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

    [Start]68.6

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

    times-frac [=>]87.4

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

    /-rgt-identity [<=]87.4

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

    associate-/l/ [=>]87.4

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

    *-lft-identity [=>]87.4

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

    associate-+l+ [=>]87.4

    \[ \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
  3. Applied egg-rr99.3%

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

    [Start]87.4

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

    *-commutative [=>]87.4

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

    clear-num [=>]87.3

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

    associate-/r* [=>]99.7

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

    frac-times [=>]99.3

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

    *-un-lft-identity [<=]99.3

    \[ \frac{\color{blue}{\frac{x}{x + y}}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)} \]
  4. Applied egg-rr99.8%

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

    [Start]99.3

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

    div-inv [=>]99.2

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

    *-commutative [=>]99.2

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

    associate-/r* [=>]99.7

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

    clear-num [<=]99.8

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

    +-commutative [=>]99.8

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

    associate-+l+ [=>]99.8

    \[ \frac{\frac{y}{\color{blue}{y + \left(1 + x\right)}}}{x + y} \cdot \frac{x}{x + y} \]
  5. Final simplification99.8%

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

Alternatives

Alternative 1
Accuracy91.3%
Cost1356
\[\begin{array}{l} t_0 := \frac{x}{y + x}\\ \mathbf{if}\;y \leq -6.7 \cdot 10^{-304}:\\ \;\;\;\;\frac{\frac{y}{\left(y + x\right) + 1}}{x}\\ \mathbf{elif}\;y \leq 10^{-159}:\\ \;\;\;\;y \cdot \frac{t_0}{y + x}\\ \mathbf{elif}\;y \leq 1.32:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{y - \left(\left(-1 - x\right) - x\right)}\\ \end{array} \]
Alternative 2
Accuracy97.1%
Cost1352
\[\begin{array}{l} t_0 := \frac{x}{y + x}\\ \mathbf{if}\;x \leq -2.3 \cdot 10^{+160}:\\ \;\;\;\;\frac{t_0}{y + x} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-7}:\\ \;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{\frac{y + x}{\frac{y}{y + 1}}}\\ \end{array} \]
Alternative 3
Accuracy87.4%
Cost1232
\[\begin{array}{l} t_0 := \frac{x}{y + x}\\ t_1 := \frac{\frac{y}{\left(y + x\right) + 1}}{x}\\ t_2 := \frac{t_0}{y + 1}\\ \mathbf{if}\;x \leq -6.2 \cdot 10^{+82}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{+49}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -4 \cdot 10^{-7}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{-260}:\\ \;\;\;\;y \cdot \frac{t_0}{y + x}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Accuracy90.4%
Cost1232
\[\begin{array}{l} t_0 := \frac{\frac{y}{\left(y + x\right) + 1}}{x}\\ t_1 := \frac{x}{y + x}\\ \mathbf{if}\;x \leq -2.6 \cdot 10^{+160}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{+46}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{elif}\;x \leq -4 \cdot 10^{-7}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-260}:\\ \;\;\;\;y \cdot \frac{t_1}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1}{y + 1}\\ \end{array} \]
Alternative 5
Accuracy91.2%
Cost1228
\[\begin{array}{l} t_0 := \frac{x}{y + x}\\ t_1 := \frac{t_0}{y + x}\\ \mathbf{if}\;x \leq -8.6 \cdot 10^{+46}:\\ \;\;\;\;t_1 \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-7}:\\ \;\;\;\;\frac{\frac{y}{\left(y + x\right) + 1}}{x}\\ \mathbf{elif}\;x \leq -1.85 \cdot 10^{-259}:\\ \;\;\;\;y \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{y - \left(\left(-1 - x\right) - x\right)}\\ \end{array} \]
Alternative 6
Accuracy95.4%
Cost1224
\[\begin{array}{l} t_0 := \frac{\frac{x}{y + x}}{y + x}\\ \mathbf{if}\;x \leq -3 \cdot 10^{+84}:\\ \;\;\;\;t_0 \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -3.6 \cdot 10^{-7}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \frac{y}{y + 1}\\ \end{array} \]
Alternative 7
Accuracy95.4%
Cost1224
\[\begin{array}{l} t_0 := \frac{x}{y + x}\\ \mathbf{if}\;x \leq -1 \cdot 10^{+86}:\\ \;\;\;\;\frac{t_0}{y + x} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -4.2 \cdot 10^{-7}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{\frac{y + x}{\frac{y}{y + 1}}}\\ \end{array} \]
Alternative 8
Accuracy91.0%
Cost1100
\[\begin{array}{l} t_0 := \frac{x}{y + x}\\ t_1 := \frac{t_0}{y + x}\\ \mathbf{if}\;x \leq -1.15 \cdot 10^{+46}:\\ \;\;\;\;t_1 \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -3.1 \cdot 10^{-7}:\\ \;\;\;\;\frac{\frac{y}{\left(y + x\right) + 1}}{x}\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-259}:\\ \;\;\;\;y \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{y + 1}\\ \end{array} \]
Alternative 9
Accuracy99.8%
Cost1088
\[\frac{\frac{x}{y + x}}{y + x} \cdot \frac{y}{x + \left(y + 1\right)} \]
Alternative 10
Accuracy79.4%
Cost972
\[\begin{array}{l} t_0 := \frac{\frac{y}{\left(y + x\right) + 1}}{x}\\ \mathbf{if}\;x \leq -5.9 \cdot 10^{+82}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+47}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{y + 1}\\ \mathbf{elif}\;x \leq -3.4 \cdot 10^{-7}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 11
Accuracy86.2%
Cost968
\[\begin{array}{l} \mathbf{if}\;y \leq 2.5 \cdot 10^{-162}:\\ \;\;\;\;\frac{\frac{y}{\left(y + x\right) + 1}}{x}\\ \mathbf{elif}\;y \leq 0.033:\\ \;\;\;\;y \cdot \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{y + 1}\\ \end{array} \]
Alternative 12
Accuracy79.2%
Cost845
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+83}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -4.2 \cdot 10^{+48} \lor \neg \left(x \leq -4 \cdot 10^{-7}\right):\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \end{array} \]
Alternative 13
Accuracy76.8%
Cost844
\[\begin{array}{l} t_0 := \frac{\frac{y}{x}}{x}\\ \mathbf{if}\;x \leq -6.2 \cdot 10^{+82}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -6.4 \cdot 10^{+47}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \mathbf{elif}\;x \leq -0.38:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + y \cdot y}\\ \end{array} \]
Alternative 14
Accuracy81.6%
Cost844
\[\begin{array}{l} \mathbf{if}\;y \leq -3.7 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{-150}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+99}:\\ \;\;\;\;\frac{x}{y + y \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 15
Accuracy79.3%
Cost844
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+83}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{+49}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{y}\\ \mathbf{elif}\;x \leq -3.6 \cdot 10^{-7}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 16
Accuracy79.2%
Cost844
\[\begin{array}{l} \mathbf{if}\;x \leq -2.05 \cdot 10^{+83}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{+47}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{y}\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{-7}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 17
Accuracy79.1%
Cost844
\[\begin{array}{l} \mathbf{if}\;x \leq -2.15 \cdot 10^{+85}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -3.35 \cdot 10^{+47}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{y + 1}\\ \mathbf{elif}\;x \leq -4 \cdot 10^{-7}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 18
Accuracy71.6%
Cost716
\[\begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{-224}:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{-151}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 0.74:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]
Alternative 19
Accuracy74.0%
Cost716
\[\begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{-226}:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;y \leq 1.26 \cdot 10^{-151}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 0.74:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 20
Accuracy75.4%
Cost716
\[\begin{array}{l} \mathbf{if}\;y \leq -5.8 \cdot 10^{-224}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{-150}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 0.72:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 21
Accuracy65.1%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq 1.42 \cdot 10^{-151}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 0.74:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]
Alternative 22
Accuracy28.9%
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq -0.36:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 23
Accuracy44.7%
Cost324
\[\begin{array}{l} \mathbf{if}\;y \leq 1.35 \cdot 10^{-150}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 24
Accuracy4.3%
Cost192
\[\frac{1}{x} \]

Error

Reproduce?

herbie shell --seed 2023147 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))

  (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))