?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original20.7
Target0.2
Herbie0.1
\[\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}} \]

Derivation?

  1. Initial program 20.7

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

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

    [Start]20.7

    \[ \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* [=>]17.3

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

    associate-+l+ [=>]17.3

    \[ \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{\frac{x}{x + y}}{1} \cdot \frac{\frac{y}{x + y}}{y + \left(x + 1\right)}} \]
  4. Final simplification0.1

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

Alternatives

Alternative 1
Error13.7
Cost1352
\[\begin{array}{l} t_0 := x + \left(y + 1\right)\\ \mathbf{if}\;x \leq -4.8 \cdot 10^{+75}:\\ \;\;\;\;\frac{\frac{y}{x}}{t_0 \cdot \frac{x + y}{x}}\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-28}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \frac{y + \left(x + 1\right)}{y}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{t_0}\\ \end{array} \]
Alternative 2
Error13.6
Cost1352
\[\begin{array}{l} t_0 := x + \left(y + 1\right)\\ \mathbf{if}\;x \leq -4.3 \cdot 10^{+75}:\\ \;\;\;\;\frac{\frac{y}{x}}{t_0 \cdot \frac{x + y}{x}}\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-28}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(t_0 \cdot \frac{x + y}{y}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{t_0}\\ \end{array} \]
Alternative 3
Error25.9
Cost1101
\[\begin{array}{l} t_0 := \frac{y}{x + y}\\ \mathbf{if}\;x \leq -7.5 \cdot 10^{+74}:\\ \;\;\;\;\frac{t_0}{x}\\ \mathbf{elif}\;x \leq -3.7 \cdot 10^{-36} \lor \neg \left(x \leq -1.4 \cdot 10^{-164}\right):\\ \;\;\;\;\frac{\frac{x}{x + y}}{x + \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{x + 1}\\ \end{array} \]
Alternative 4
Error25.5
Cost1100
\[\begin{array}{l} t_0 := x + \left(y + 1\right)\\ t_1 := \frac{\frac{y}{x + y}}{t_0}\\ \mathbf{if}\;x \leq -2.75 \cdot 10^{+42}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -4.3 \cdot 10^{-38}:\\ \;\;\;\;\frac{\frac{x}{y}}{t_0}\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{-164}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{t_0}\\ \end{array} \]
Alternative 5
Error0.1
Cost1088
\[\frac{\frac{x}{x + y} \cdot \frac{y}{x + y}}{x + \left(y + 1\right)} \]
Alternative 6
Error0.1
Cost1088
\[\frac{\frac{x \cdot \frac{y}{x + y}}{x + y}}{x + \left(y + 1\right)} \]
Alternative 7
Error22.4
Cost1032
\[\begin{array}{l} \mathbf{if}\;y \leq 3 \cdot 10^{-129}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{x + 1}\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{+156}:\\ \;\;\;\;\frac{-x}{\left(x + y\right) \cdot \left(\left(-1 - y\right) - x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{x + \left(y + 1\right)}\\ \end{array} \]
Alternative 8
Error30.4
Cost981
\[\begin{array}{l} t_0 := \frac{x}{y \cdot y}\\ \mathbf{if}\;x \leq -82000000000000:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq -1.08 \cdot 10^{-35}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-162}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-204} \lor \neg \left(x \leq 1.9 \cdot 10^{-181}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 9
Error29.6
Cost980
\[\begin{array}{l} t_0 := \frac{\frac{x}{y}}{y}\\ \mathbf{if}\;x \leq -3.5 \cdot 10^{+43}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{-38}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-162}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-204}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{-183}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 10
Error29.6
Cost980
\[\begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+36}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{-38}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{-162}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-204}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-184}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 11
Error26.3
Cost976
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+42}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-36}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-162}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-28}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 12
Error26.3
Cost976
\[\begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{+41}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{x}\\ \mathbf{elif}\;x \leq -4.6 \cdot 10^{-38}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-162}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-28}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 13
Error26.1
Cost973
\[\begin{array}{l} \mathbf{if}\;x \leq -9.2 \cdot 10^{+36}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{x}\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-38} \lor \neg \left(x \leq -3 \cdot 10^{-162}\right):\\ \;\;\;\;\frac{\frac{x}{y}}{x + \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x}\\ \end{array} \]
Alternative 14
Error26.0
Cost973
\[\begin{array}{l} t_0 := x + \left(y + 1\right)\\ \mathbf{if}\;x \leq -2.4 \cdot 10^{+38}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{x}\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{-38} \lor \neg \left(x \leq -3 \cdot 10^{-162}\right):\\ \;\;\;\;\frac{\frac{x}{y}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x}}{t_0}\\ \end{array} \]
Alternative 15
Error26.0
Cost973
\[\begin{array}{l} t_0 := \frac{y}{x + y}\\ \mathbf{if}\;x \leq -8 \cdot 10^{+42}:\\ \;\;\;\;\frac{t_0}{x}\\ \mathbf{elif}\;x \leq -3.7 \cdot 10^{-36} \lor \neg \left(x \leq -3 \cdot 10^{-162}\right):\\ \;\;\;\;\frac{\frac{x}{y}}{x + \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{x + 1}\\ \end{array} \]
Alternative 16
Error29.6
Cost848
\[\begin{array}{l} t_0 := \frac{y}{x \cdot x}\\ \mathbf{if}\;y \leq -1.15 \cdot 10^{-145}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-113}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 1.95 \cdot 10^{-10}:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{+24}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 17
Error35.5
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq 6.4 \cdot 10^{-111}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 250:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]
Alternative 18
Error43.3
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{-209}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 19
Error61.3
Cost192
\[\frac{1}{x} \]
Alternative 20
Error47.3
Cost192
\[\frac{x}{y} \]
Alternative 21
Error61.8
Cost64
\[1 \]

Error

Reproduce?

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