?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

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

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

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

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

Alternatives

Alternative 1
Error13.7
Cost1620
\[\begin{array}{l} t_0 := \frac{x}{\left(x + y\right) \cdot \left(1 + \left(x + y\right)\right)}\\ \mathbf{if}\;y \leq -1.95 \cdot 10^{+174}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\ \mathbf{elif}\;y \leq -5.6 \cdot 10^{+55}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-154}:\\ \;\;\;\;\frac{\frac{y}{x} \cdot \frac{x}{1 + x}}{x}\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-115}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.115:\\ \;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error21.5
Cost1368
\[\begin{array}{l} t_0 := \frac{\frac{y}{x}}{x + y}\\ t_1 := \frac{y}{\left(y - -1\right) \cdot x}\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{-161}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{-154}:\\ \;\;\;\;\frac{x}{y \cdot \left(1 + x\right)}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-69}:\\ \;\;\;\;\frac{\frac{x}{y}}{x + y}\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-35}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 42000000000:\\ \;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error17.0
Cost1368
\[\begin{array}{l} t_0 := \frac{\frac{y}{x}}{x + y}\\ t_1 := \frac{\frac{x}{y - -1}}{x + y}\\ \mathbf{if}\;x \leq -5.6 \cdot 10^{+23}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.75 \cdot 10^{-33}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{-133}:\\ \;\;\;\;\frac{y}{\left(y - -1\right) \cdot x}\\ \mathbf{elif}\;x \leq 1.85 \cdot 10^{-55}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-35}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq 42000000000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error11.9
Cost1356
\[\begin{array}{l} t_0 := \frac{y}{\left(x + y\right) \cdot \left(1 + \left(x + y\right)\right)}\\ \mathbf{if}\;x \leq -7.5 \cdot 10^{-163}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 5.7 \cdot 10^{-160}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{x + y}\\ \mathbf{elif}\;x \leq 2:\\ \;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + y\right)}\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \ne 0:\\ \;\;\;\;\frac{\frac{1}{x}}{\frac{y + x}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{y + x}}{x}\\ \end{array} \]
Alternative 5
Error6.8
Cost1356
\[\begin{array}{l} t_0 := \frac{x}{x + y}\\ t_1 := \frac{x}{\left(x + y\right) \cdot \left(1 + \left(x + y\right)\right)}\\ \mathbf{if}\;y \leq -7.5 \cdot 10^{+174}:\\ \;\;\;\;\frac{t_0}{x + y}\\ \mathbf{elif}\;y \leq -5.6 \cdot 10^{+55}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 0.125:\\ \;\;\;\;\frac{\frac{y}{x - -1} \cdot t_0}{x + y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error21.8
Cost1244
\[\begin{array}{l} t_0 := \frac{x}{y \cdot \left(1 + x\right)}\\ t_1 := \frac{y}{x \cdot x}\\ \mathbf{if}\;y \leq -2.3 \cdot 10^{+26}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \mathbf{elif}\;y \leq -2.2 \cdot 10^{-143}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 7 \cdot 10^{-166}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{-139}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{-125}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 9.2 \cdot 10^{-65}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 116000000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]
Alternative 7
Error21.8
Cost1244
\[\begin{array}{l} t_0 := \frac{x}{y \cdot \left(1 + x\right)}\\ t_1 := \frac{y}{x \cdot x}\\ \mathbf{if}\;y \leq -2.5 \cdot 10^{+24}:\\ \;\;\;\;\frac{\frac{x}{y}}{x + y}\\ \mathbf{elif}\;y \leq -2.9 \cdot 10^{-142}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{-167}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{-139}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{-124}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{-65}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 620000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]
Alternative 8
Error21.5
Cost1240
\[\begin{array}{l} t_0 := \frac{\frac{y}{x}}{x + y}\\ t_1 := \frac{\frac{x}{y}}{x + y}\\ t_2 := \frac{y}{\left(y - -1\right) \cdot x}\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{-161}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-156}:\\ \;\;\;\;\frac{x}{y \cdot \left(1 + x\right)}\\ \mathbf{elif}\;x \leq 4.1 \cdot 10^{-68}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-35}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 35000000000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error5.9
Cost1224
\[\begin{array}{l} t_0 := \frac{y}{y + x}\\ t_1 := \frac{y}{\left(x + y\right) \cdot \left(1 + \left(x + y\right)\right)}\\ \mathbf{if}\;x \leq -2.3 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 8.5:\\ \;\;\;\;\frac{t_0 \cdot x}{\left(y + x\right) \cdot \left(1 + y\right)}\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \ne 0:\\ \;\;\;\;\frac{\frac{1}{x}}{\frac{y + x}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{x}\\ \end{array} \]
Alternative 10
Error13.1
Cost1104
\[\begin{array}{l} t_0 := \frac{y}{\left(x + y\right) \cdot \left(1 + \left(x + y\right)\right)}\\ \mathbf{if}\;x \leq -1.15 \cdot 10^{-161}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{-56}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{x + y}\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \ne 0:\\ \;\;\;\;\frac{\frac{1}{x}}{\frac{y + x}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{y + x}}{x}\\ \end{array} \]
Alternative 11
Error15.0
Cost1100
\[\begin{array}{l} t_0 := \frac{x}{\left(x + y\right) \cdot \left(1 + \left(x + y\right)\right)}\\ \mathbf{if}\;y \leq -7.5 \cdot 10^{+174}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\ \mathbf{elif}\;y \leq -5.6 \cdot 10^{+55}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-154}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 12
Error13.0
Cost1100
\[\begin{array}{l} t_0 := \frac{y}{\left(x + y\right) \cdot \left(1 + \left(x + y\right)\right)}\\ \mathbf{if}\;x \leq -1.15 \cdot 10^{-161}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-56}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{x + y}\\ \mathbf{elif}\;x \leq 2.45 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \end{array} \]
Alternative 13
Error0.1
Cost1088
\[\frac{\frac{y}{x + y}}{\left(x + y\right) + 1} \cdot \frac{x}{x + y} \]
Alternative 14
Error0.1
Cost1088
\[\frac{\frac{y}{1 + \left(x + y\right)} \cdot \frac{x}{x + y}}{x + y} \]
Alternative 15
Error21.4
Cost848
\[\begin{array}{l} t_0 := \frac{x}{y \cdot y}\\ t_1 := \frac{y}{x \cdot x}\\ \mathbf{if}\;y \leq -8.5 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2.3 \cdot 10^{-143}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-177}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 260000000000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 16
Error21.0
Cost848
\[\begin{array}{l} t_0 := \frac{y}{x \cdot x}\\ \mathbf{if}\;y \leq -1.95 \cdot 10^{+21}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-132}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{-177}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 340000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]
Alternative 17
Error17.4
Cost840
\[\begin{array}{l} t_0 := \frac{\frac{y}{1 + x}}{x + y}\\ \mathbf{if}\;x \leq -1.42 \cdot 10^{-133}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{-56}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 18
Error25.3
Cost584
\[\begin{array}{l} t_0 := \frac{x}{y \cdot y}\\ \mathbf{if}\;y \leq -2000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.115:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 19
Error61.3
Cost192
\[\frac{1}{x} \]
Alternative 20
Error47.0
Cost192
\[\frac{y}{x} \]

Error

Reproduce?

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