Average Error: 19.8 → 0.1
Time: 13.2s
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}{\left(y + x\right) + 1} \cdot \frac{x}{y + 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)) (/ 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 ((y / ((y + x) + 1.0)) * (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 = ((y / ((y + x) + 1.0d0)) * (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 ((y / ((y + x) + 1.0)) * (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 ((y / ((y + x) + 1.0)) * (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(Float64(y / Float64(Float64(y + x) + 1.0)) * Float64(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 = ((y / ((y + x) + 1.0)) * (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[(N[(y / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x / 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{\frac{y}{\left(y + x\right) + 1} \cdot \frac{x}{y + x}}{y + x}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original19.8
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.8

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

    \[\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, 0 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))))): 81 points increase in error, 8 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. Final simplification0.1

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

Alternatives

Alternative 1
Error6.0
Cost1356
\[\begin{array}{l} t_0 := \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{if}\;x \leq -1.6 \cdot 10^{+140}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{elif}\;x \leq -122000000:\\ \;\;\;\;\frac{y}{x} \cdot t_0\\ \mathbf{elif}\;x \leq -2.9 \cdot 10^{-152}:\\ \;\;\;\;t_0 \cdot \frac{y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 2
Error2.1
Cost1352
\[\begin{array}{l} \mathbf{if}\;x \leq -1.6 \cdot 10^{+140}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{-5}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{x + \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y \cdot \frac{x}{y + x}}{y + 1}}{y + x}\\ \end{array} \]
Alternative 3
Error3.8
Cost1224
\[\begin{array}{l} \mathbf{if}\;x \leq -1.6 \cdot 10^{+140}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{elif}\;x \leq -165000000:\\ \;\;\;\;\frac{y}{x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{y + 1}}{y + x}\\ \end{array} \]
Alternative 4
Error3.8
Cost1224
\[\begin{array}{l} \mathbf{if}\;x \leq -1.6 \cdot 10^{+140}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{elif}\;x \leq -75000:\\ \;\;\;\;\frac{y}{x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y \cdot \frac{x}{y + x}}{y + 1}}{y + x}\\ \end{array} \]
Alternative 5
Error12.0
Cost1096
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1 \cdot 10^{+140}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{elif}\;x \leq -10500000000:\\ \;\;\;\;\frac{y}{x} \cdot \frac{x}{x \cdot \left(x + y \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 6
Error11.5
Cost1096
\[\begin{array}{l} \mathbf{if}\;x \leq -1.6 \cdot 10^{+140}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{elif}\;x \leq -400000000:\\ \;\;\;\;\frac{y}{x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 7
Error10.5
Cost972
\[\begin{array}{l} t_0 := \frac{\frac{x}{y + 1}}{y + x}\\ \mathbf{if}\;y \leq 4.6 \cdot 10^{-73}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+22}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{+183}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error10.5
Cost972
\[\begin{array}{l} \mathbf{if}\;y \leq 5.4 \cdot 10^{-73}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+22}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{+182}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{y + x}\\ \end{array} \]
Alternative 9
Error18.7
Cost848
\[\begin{array}{l} t_0 := \frac{y}{x \cdot x}\\ \mathbf{if}\;y \leq -1.75 \cdot 10^{-97}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{-214}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 4.3 \cdot 10^{-74}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.76:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]
Alternative 10
Error18.7
Cost848
\[\begin{array}{l} t_0 := \frac{y}{x \cdot x}\\ \mathbf{if}\;y \leq -1.85 \cdot 10^{-98}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{-215}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-73}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.76:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]
Alternative 11
Error17.3
Cost848
\[\begin{array}{l} t_0 := \frac{y}{x \cdot x}\\ \mathbf{if}\;y \leq -2.4 \cdot 10^{-98}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-213}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-73}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.76:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 12
Error16.4
Cost848
\[\begin{array}{l} t_0 := \frac{\frac{y}{x}}{x}\\ \mathbf{if}\;y \leq -1.5 \cdot 10^{-96}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-213}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{-74}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.76:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 13
Error16.3
Cost848
\[\begin{array}{l} \mathbf{if}\;y \leq -1.85 \cdot 10^{-98}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{-214}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{elif}\;y \leq 6.3 \cdot 10^{-74}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;y \leq 0.76:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 14
Error12.3
Cost836
\[\begin{array}{l} \mathbf{if}\;x \leq -0.00017:\\ \;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 15
Error12.8
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -210000000:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{+32}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 16
Error12.8
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -14500000000:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq 660:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + x}\\ \end{array} \]
Alternative 17
Error12.3
Cost708
\[\begin{array}{l} \mathbf{if}\;x \leq -5.4 \cdot 10^{-5}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 18
Error23.3
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq 1.5 \cdot 10^{-227}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 0.76:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]
Alternative 19
Error12.8
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -30000000000000:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 20
Error12.4
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -0.000116:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 21
Error36.9
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{-78}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 22
Error61.4
Cost192
\[\frac{1}{y} \]
Alternative 23
Error47.6
Cost192
\[\frac{x}{y} \]
Alternative 24
Error61.8
Cost64
\[1 \]

Error

Reproduce

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