Average Error: 19.9 → 0.1
Time: 14.7s
Precision: binary64
Cost: 1216
\[ \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{1}{\frac{y + x}{x}} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{y + x} \]
(FPCore (x y)
 :precision binary64
 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
(FPCore (x y)
 :precision binary64
 (* (/ 1.0 (/ (+ y x) x)) (/ (/ y (+ y (+ 1.0 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 (1.0 / ((y + x) / x)) * ((y / (y + (1.0 + 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 = (1.0d0 / ((y + x) / x)) * ((y / (y + (1.0d0 + 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 (1.0 / ((y + x) / x)) * ((y / (y + (1.0 + x))) / (y + x));
}
def code(x, y):
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
def code(x, y):
	return (1.0 / ((y + x) / x)) * ((y / (y + (1.0 + 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(1.0 / Float64(Float64(y + x) / x)) * Float64(Float64(y / Float64(y + Float64(1.0 + 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 = (1.0 / ((y + x) / x)) * ((y / (y + (1.0 + 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[(1.0 / N[(N[(y + x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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{1}{\frac{y + x}{x}} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{y + x}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original19.9
Target0.1
Herbie0.1
\[\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}} \]

Derivation

  1. Initial program 19.9

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Simplified16.7

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

    [Start]19.9

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

    associate-/r* [=>]16.7

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

    associate-+l+ [=>]16.7

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

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

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

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

    [Start]0.2

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

    unpow-1 [=>]0.2

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

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

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

Alternatives

Alternative 1
Error8.7
Cost1360
\[\begin{array}{l} t_0 := \frac{y}{\left(y + \left(1 + x\right)\right) \cdot \left(x + y \cdot 2\right)}\\ t_1 := x + \left(1 + y\right)\\ \mathbf{if}\;x \leq -8.5 \cdot 10^{+137}:\\ \;\;\;\;\frac{\frac{y}{y + x}}{t_1}\\ \mathbf{elif}\;x \leq -2.15 \cdot 10^{-60}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{-113}:\\ \;\;\;\;\frac{x}{y \cdot \left(1 + y\right)}\\ \mathbf{elif}\;x \leq -7.8 \cdot 10^{-159}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{t_1}\\ \end{array} \]
Alternative 2
Error5.4
Cost1352
\[\begin{array}{l} t_0 := x + \left(1 + y\right)\\ \mathbf{if}\;x \leq -1.12 \cdot 10^{+84}:\\ \;\;\;\;\frac{\frac{y}{y + x}}{t_0}\\ \mathbf{elif}\;x \leq -1.55 \cdot 10^{-162}:\\ \;\;\;\;\frac{x}{\frac{y + \left(1 + x\right)}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{t_0}\\ \end{array} \]
Alternative 3
Error3.2
Cost1352
\[\begin{array}{l} t_0 := x + \left(1 + y\right)\\ \mathbf{if}\;x \leq -8.5 \cdot 10^{+137}:\\ \;\;\;\;\frac{\frac{y}{y + x}}{t_0}\\ \mathbf{elif}\;x \leq -1.25 \cdot 10^{-307}:\\ \;\;\;\;\frac{y}{\left(y + \left(1 + x\right)\right) \cdot \left(\frac{y + x}{x} \cdot \left(y + x\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{t_0}\\ \end{array} \]
Alternative 4
Error16.0
Cost1108
\[\begin{array}{l} \mathbf{if}\;x \leq -116:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-33}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{-114}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \mathbf{elif}\;x \leq -1.95 \cdot 10^{-150}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-157}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\ \end{array} \]
Alternative 5
Error0.1
Cost1088
\[\frac{\frac{x \cdot \frac{y}{y + x}}{y + x}}{x + \left(1 + y\right)} \]
Alternative 6
Error18.2
Cost980
\[\begin{array}{l} t_0 := \frac{x}{y \cdot y}\\ \mathbf{if}\;x \leq -116:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{-32}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-115}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{-150}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{-157}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error17.2
Cost980
\[\begin{array}{l} \mathbf{if}\;x \leq -116:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{-32}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{-114}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \mathbf{elif}\;x \leq -1.95 \cdot 10^{-150}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq 10^{-156}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 8
Error16.0
Cost980
\[\begin{array}{l} \mathbf{if}\;x \leq -116:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -1.5 \cdot 10^{-32}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-115}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{-150}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq 2.75 \cdot 10^{-157}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 9
Error13.5
Cost977
\[\begin{array}{l} \mathbf{if}\;x \leq -116:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{-32}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-115} \lor \neg \left(x \leq -4.1 \cdot 10^{-150}\right):\\ \;\;\;\;\frac{x}{y \cdot \left(1 + y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x}\\ \end{array} \]
Alternative 10
Error12.1
Cost972
\[\begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{-32}:\\ \;\;\;\;\frac{\frac{y}{x}}{1 + x}\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-115}:\\ \;\;\;\;\frac{x}{y \cdot \left(1 + y\right)}\\ \mathbf{elif}\;x \leq -3.4 \cdot 10^{-150}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{x + \left(1 + y\right)}\\ \end{array} \]
Alternative 11
Error10.4
Cost968
\[\begin{array}{l} \mathbf{if}\;y \leq 1.55 \cdot 10^{-95}:\\ \;\;\;\;\frac{\frac{y}{x}}{1 + x}\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{+139}:\\ \;\;\;\;\frac{x}{\frac{y + \left(1 + x\right)}{\frac{1}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + x} \cdot \frac{1}{y}\\ \end{array} \]
Alternative 12
Error10.4
Cost968
\[\begin{array}{l} \mathbf{if}\;y \leq 1.65 \cdot 10^{-96}:\\ \;\;\;\;\frac{\frac{y}{x}}{1 + x}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+138}:\\ \;\;\;\;\frac{x}{\frac{y + \left(1 + x\right)}{\frac{1}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{1 + \left(y + x\right)}}{\frac{y}{x}}\\ \end{array} \]
Alternative 13
Error10.3
Cost968
\[\begin{array}{l} \mathbf{if}\;y \leq 1.55 \cdot 10^{-95}:\\ \;\;\;\;\frac{\frac{y}{x}}{1 + x}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+138}:\\ \;\;\;\;\frac{x}{\frac{y + \left(1 + x\right)}{\frac{1}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{x + \left(1 + y\right)}\\ \end{array} \]
Alternative 14
Error13.0
Cost845
\[\begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{-32}:\\ \;\;\;\;\frac{\frac{y}{x}}{1 + x}\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-115} \lor \neg \left(x \leq -4.1 \cdot 10^{-150}\right):\\ \;\;\;\;\frac{x}{y \cdot \left(1 + y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x}\\ \end{array} \]
Alternative 15
Error22.6
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq 1.1 \cdot 10^{-134}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 0.75:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]
Alternative 16
Error35.7
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq -3.75 \cdot 10^{-150}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 17
Error61.4
Cost192
\[\frac{1}{y} \]
Alternative 18
Error47.3
Cost192
\[\frac{x}{y} \]

Error

Reproduce

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