Average Error: 19.6 → 0.1
Time: 12.8s
Precision: binary64
Cost: 1088
\[\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.6
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.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. Simplified7.8

    \[\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))))): 91 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
Error4.4
Cost1484
\[\begin{array}{l} t_0 := \frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{x + \left(y + 1\right)}\\ \mathbf{if}\;y \leq -1.45 \cdot 10^{-209}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-142}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{y + \left(x + 1\right)}{y}\right)}\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+147}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{y + 1}}{y + x}\\ \end{array} \]
Alternative 2
Error20.1
Cost1224
\[\begin{array}{l} t_0 := \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{if}\;x \leq -860:\\ \;\;\;\;t_0 \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-160}:\\ \;\;\;\;t_0 \cdot \frac{y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \end{array} \]
Alternative 3
Error9.6
Cost1220
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{x + \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{y + 1}}{y + x}\\ \end{array} \]
Alternative 4
Error10.9
Cost1092
\[\begin{array}{l} \mathbf{if}\;x \leq -5800:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{y + 1}}{y + x}\\ \end{array} \]
Alternative 5
Error29.8
Cost716
\[\begin{array}{l} t_0 := \frac{x}{y \cdot y}\\ \mathbf{if}\;x \leq -13500:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq -3.3 \cdot 10^{-247}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{-193}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error29.3
Cost716
\[\begin{array}{l} t_0 := \frac{\frac{x}{y}}{y}\\ \mathbf{if}\;x \leq -13500:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{-247}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{-192}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error29.0
Cost716
\[\begin{array}{l} t_0 := \frac{\frac{x}{y}}{y}\\ \mathbf{if}\;x \leq -13500:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -7.6 \cdot 10^{-248}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{-192}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error25.4
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq 3 \cdot 10^{-50}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;y \leq 0.65:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + x}\\ \end{array} \]
Alternative 9
Error24.7
Cost708
\[\begin{array}{l} \mathbf{if}\;y \leq 3.2 \cdot 10^{-48}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \end{array} \]
Alternative 10
Error24.4
Cost708
\[\begin{array}{l} \mathbf{if}\;y \leq 1.95 \cdot 10^{-44}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \end{array} \]
Alternative 11
Error25.4
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq 1.04 \cdot 10^{-44}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;y \leq 0.76:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 12
Error25.1
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq 1.95 \cdot 10^{-44}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 13
Error25.1
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq 2.9 \cdot 10^{-45}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \end{array} \]
Alternative 14
Error24.7
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq 1.08 \cdot 10^{-47}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \end{array} \]
Alternative 15
Error44.2
Cost452
\[\begin{array}{l} \mathbf{if}\;y \leq 0.75:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]
Alternative 16
Error46.8
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq -650:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 17
Error61.3
Cost192
\[\frac{1}{x} \]

Error

Reproduce

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