?

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

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

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

    [Start]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)} \]

    rational.json-simplify-46 [=>]16.9

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

    rational.json-simplify-44 [=>]16.8

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

    rational.json-simplify-1 [=>]16.8

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

    rational.json-simplify-1 [=>]16.8

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

    rational.json-simplify-41 [=>]16.8

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

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

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

Alternatives

Alternative 1
Error10.2
Cost1352
\[\begin{array}{l} t_0 := \frac{y}{x + y}\\ \mathbf{if}\;x \leq -8.6 \cdot 10^{+126}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-23}:\\ \;\;\;\;x \cdot \frac{t_0}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{x + y} \cdot t_0\\ \end{array} \]
Alternative 2
Error9.7
Cost1352
\[\begin{array}{l} \mathbf{if}\;x \leq -1.3 \cdot 10^{+150}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-47}:\\ \;\;\;\;y \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{x + y} \cdot \frac{y}{x + y}\\ \end{array} \]
Alternative 3
Error9.4
Cost1352
\[\begin{array}{l} \mathbf{if}\;x \leq -2.6 \cdot 10^{+137}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-51}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{x + y} \cdot \frac{y}{x + y}\\ \end{array} \]
Alternative 4
Error23.3
Cost1236
\[\begin{array}{l} \mathbf{if}\;y \leq 1.7 \cdot 10^{-135}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{x}\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-103}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-46}:\\ \;\;\;\;\frac{1}{x + 1} \cdot \frac{y}{x + y}\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{+25}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{x + y}\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{+144}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\ \end{array} \]
Alternative 5
Error23.8
Cost1224
\[\begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{+15}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{x}}{1 + x}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-124}:\\ \;\;\;\;x \cdot \frac{\frac{y}{x}}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 6
Error21.7
Cost1224
\[\begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+16}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{x}}{1 + x}\\ \mathbf{elif}\;x \leq -1.65 \cdot 10^{-152}:\\ \;\;\;\;y \cdot \frac{\frac{x}{y + 1}}{\left(x + y\right) \cdot \left(x + y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 7
Error24.8
Cost1108
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+21}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -0.00031:\\ \;\;\;\;\frac{\frac{x}{y}}{x + y}\\ \mathbf{elif}\;x \leq -2.05 \cdot 10^{-34}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{x}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-77}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-124}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 8
Error24.7
Cost1108
\[\begin{array}{l} \mathbf{if}\;x \leq -6 \cdot 10^{+16}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -1.25 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{x}{y}}{x + y}\\ \mathbf{elif}\;x \leq -4.6 \cdot 10^{-32}:\\ \;\;\;\;\frac{y}{x - -1} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -8.6 \cdot 10^{-77}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-124}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 9
Error24.8
Cost1108
\[\begin{array}{l} \mathbf{if}\;x \leq -4.1 \cdot 10^{+17}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -8.5 \cdot 10^{-7}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\ \mathbf{elif}\;x \leq -8.8 \cdot 10^{-33}:\\ \;\;\;\;\frac{y}{x - -1} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -8.6 \cdot 10^{-77}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-124}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 10
Error24.8
Cost1108
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+16}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{-6}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-33}:\\ \;\;\;\;\frac{y}{x - -1} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -1.02 \cdot 10^{-76}:\\ \;\;\;\;\frac{\frac{1}{1 + y}}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-124}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 11
Error24.8
Cost1108
\[\begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{+18}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -2.5 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\ \mathbf{elif}\;x \leq -2.5 \cdot 10^{-32}:\\ \;\;\;\;\frac{y}{x - -1} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-77}:\\ \;\;\;\;\frac{\frac{1}{1 + y}}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-124}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 12
Error24.8
Cost1108
\[\begin{array}{l} \mathbf{if}\;x \leq -5.6 \cdot 10^{+17}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -8.8 \cdot 10^{-7}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\ \mathbf{elif}\;x \leq -9.6 \cdot 10^{-33}:\\ \;\;\;\;\frac{y}{x - -1} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -8.6 \cdot 10^{-77}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{x + y}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-124}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 13
Error23.3
Cost1096
\[\begin{array}{l} \mathbf{if}\;y \leq 2.7 \cdot 10^{-192}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{x}\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{+144}:\\ \;\;\;\;x \cdot \frac{1}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\ \end{array} \]
Alternative 14
Error11.8
Cost1092
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+17}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{x}}{1 + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{x + y} \cdot \frac{y}{x + y}\\ \end{array} \]
Alternative 15
Error25.1
Cost976
\[\begin{array}{l} t_0 := \frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{if}\;x \leq -4.4 \cdot 10^{-32}:\\ \;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{-76}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-124}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{-43}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{x + y}\\ \end{array} \]
Alternative 16
Error35.3
Cost844
\[\begin{array}{l} \mathbf{if}\;y \leq 2.75 \cdot 10^{-192}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 2.25 \cdot 10^{-181}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{-135}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
Alternative 17
Error25.7
Cost844
\[\begin{array}{l} t_0 := \frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{if}\;x \leq -1.9 \cdot 10^{-33}:\\ \;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\ \mathbf{elif}\;x \leq -8.6 \cdot 10^{-77}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-124}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 18
Error25.1
Cost844
\[\begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{-33}:\\ \;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\ \mathbf{elif}\;x \leq -8.6 \cdot 10^{-77}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-124}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
Alternative 19
Error24.0
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{+17}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{1 + y}}{y}\\ \end{array} \]
Alternative 20
Error46.9
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq -7.5 \cdot 10^{+16}:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 21
Error42.6
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq -8.4 \cdot 10^{-137}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 22
Error61.3
Cost192
\[\frac{1}{x} \]
Alternative 23
Error61.8
Cost64
\[1 \]

Error

Reproduce?

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