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

    \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    Proof
    (*.f64 (/.f64 x (*.f64 (+.f64 x y) (+.f64 x y))) (/.f64 y (+.f64 x (+.f64 y 1)))): 0 points increase in error, 0 points decrease in error
    (*.f64 (/.f64 x (*.f64 (+.f64 x y) (+.f64 x y))) (/.f64 y (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 x y) 1)))): 0 points increase in error, 1 points decrease in error
    (*.f64 (/.f64 x (*.f64 (+.f64 x y) (+.f64 x y))) (/.f64 y (Rewrite<= *-lft-identity_binary64 (*.f64 1 (+.f64 (+.f64 x y) 1))))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= times-frac_binary64 (/.f64 (*.f64 x y) (*.f64 (*.f64 (+.f64 x y) (+.f64 x y)) (*.f64 1 (+.f64 (+.f64 x y) 1))))): 89 points increase in error, 9 points decrease in error
    (/.f64 (*.f64 x y) (*.f64 (*.f64 (+.f64 x y) (+.f64 x y)) (Rewrite=> *-lft-identity_binary64 (+.f64 (+.f64 x y) 1)))): 0 points increase in error, 0 points decrease in error
  3. Applied egg-rr0.1

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

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

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

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

Alternatives

Alternative 1
Error7.7
Cost1360
\[\begin{array}{l} t_0 := \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ t_1 := \frac{\frac{y}{1 + \left(y + x\right)}}{y + x}\\ \mathbf{if}\;x \leq -1.8 \cdot 10^{+186}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -58000000000:\\ \;\;\;\;t_0 \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -3.2 \cdot 10^{-7}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-161}:\\ \;\;\;\;y \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y + x}}{2 + \frac{y + 1}{x}}\\ \end{array} \]
Alternative 2
Error6.0
Cost1356
\[\begin{array}{l} t_0 := \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{if}\;x \leq -9 \cdot 10^{+185}:\\ \;\;\;\;\frac{\frac{y}{1 + \left(y + x\right)}}{y + x}\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-12}:\\ \;\;\;\;t_0 \cdot \frac{y}{1 + x}\\ \mathbf{elif}\;x \leq -9.8 \cdot 10^{-163}:\\ \;\;\;\;t_0 \cdot \frac{y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y + x}}{2 + \frac{y + 1}{x}}\\ \end{array} \]
Alternative 3
Error2.6
Cost1352
\[\begin{array}{l} \mathbf{if}\;x \leq -7 \cdot 10^{+195}:\\ \;\;\;\;\frac{\frac{1}{\frac{1}{y} + \left(2 + \frac{x}{y}\right)}}{y + x}\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{x + \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{\frac{y}{y + 1}}{y + x}}{y + x}\\ \end{array} \]
Alternative 4
Error7.8
Cost1232
\[\begin{array}{l} t_0 := \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{if}\;x \leq -9.5 \cdot 10^{+185}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{elif}\;x \leq -1650000000:\\ \;\;\;\;t_0 \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{x}\\ \mathbf{elif}\;x \leq -4.3 \cdot 10^{-162}:\\ \;\;\;\;y \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 5
Error7.8
Cost1232
\[\begin{array}{l} t_0 := \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ t_1 := \frac{\frac{y}{1 + \left(y + x\right)}}{y + x}\\ \mathbf{if}\;x \leq -1.15 \cdot 10^{+191}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -57000000000:\\ \;\;\;\;t_0 \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -3.9 \cdot 10^{-5}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{-161}:\\ \;\;\;\;y \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 6
Error7.4
Cost1224
\[\begin{array}{l} \mathbf{if}\;x \leq -3.5 \cdot 10^{+195}:\\ \;\;\;\;\frac{\frac{y}{1 + \left(y + x\right)}}{y + x}\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{-162}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{1 + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y + x}}{2 + \frac{y + 1}{x}}\\ \end{array} \]
Alternative 7
Error3.9
Cost1224
\[\begin{array}{l} \mathbf{if}\;x \leq -7 \cdot 10^{+189}:\\ \;\;\;\;\frac{\frac{y}{1 + \left(y + x\right)}}{y + x}\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{1 + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{y + 1}}{y + x}\\ \end{array} \]
Alternative 8
Error4.0
Cost1224
\[\begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+193}:\\ \;\;\;\;\frac{\frac{y}{1 + \left(y + x\right)}}{y + x}\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{1 + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{\frac{y}{y + 1}}{y + x}}{y + x}\\ \end{array} \]
Alternative 9
Error4.6
Cost1092
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0007:\\ \;\;\;\;\frac{\frac{1}{\frac{1}{y} + \left(2 + \frac{x}{y}\right)}}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{\frac{y}{y + 1}}{y + x}}{y + x}\\ \end{array} \]
Alternative 10
Error0.1
Cost1088
\[\frac{\frac{y}{1 + \left(y + x\right)} \cdot \frac{x}{y + x}}{y + x} \]
Alternative 11
Error8.4
Cost968
\[\begin{array}{l} \mathbf{if}\;x \leq -7.2 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{y + x}\\ \mathbf{elif}\;x \leq -8.5 \cdot 10^{-162}:\\ \;\;\;\;y \cdot \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 12
Error17.0
Cost844
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq -1.38 \cdot 10^{-163}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-145}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + x}\\ \end{array} \]
Alternative 13
Error12.0
Cost836
\[\begin{array}{l} \mathbf{if}\;x \leq -1.38 \cdot 10^{-163}:\\ \;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \end{array} \]
Alternative 14
Error17.8
Cost716
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq -1.38 \cdot 10^{-163}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq 7.6 \cdot 10^{-143}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]
Alternative 15
Error12.2
Cost708
\[\begin{array}{l} \mathbf{if}\;x \leq -1.38 \cdot 10^{-163}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \end{array} \]
Alternative 16
Error12.0
Cost708
\[\begin{array}{l} \mathbf{if}\;x \leq -1.38 \cdot 10^{-163}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \end{array} \]
Alternative 17
Error22.2
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq 6.6 \cdot 10^{-187}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 5:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]
Alternative 18
Error14.4
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0034:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 19
Error12.9
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0034:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 20
Error12.1
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -1.38 \cdot 10^{-163}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 21
Error45.6
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0034:\\ \;\;\;\;\frac{0.5}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 22
Error35.6
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq -2.95 \cdot 10^{-164}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 23
Error61.2
Cost192
\[\frac{0.5}{x} \]
Alternative 24
Error61.8
Cost64
\[0.5 \]

Error

Reproduce

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