?

Average Error: 19.8 → 9.4
Time: 18.1s
Precision: binary64
Cost: 1352

?

\[ \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)} \]
\[\begin{array}{l} \mathbf{if}\;x \leq -3.4 \cdot 10^{+93}:\\ \;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-142}:\\ \;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
(FPCore (x y)
 :precision binary64
 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
(FPCore (x y)
 :precision binary64
 (if (<= x -3.4e+93)
   (/ y (* (+ 1.0 x) x))
   (if (<= x -9.5e-142)
     (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0)))
     (/ x (* y (+ y 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) {
	double tmp;
	if (x <= -3.4e+93) {
		tmp = y / ((1.0 + x) * x);
	} else if (x <= -9.5e-142) {
		tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
	} else {
		tmp = x / (y * (y + 1.0));
	}
	return tmp;
}
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
    real(8) :: tmp
    if (x <= (-3.4d+93)) then
        tmp = y / ((1.0d0 + x) * x)
    else if (x <= (-9.5d-142)) then
        tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
    else
        tmp = x / (y * (y + 1.0d0))
    end if
    code = tmp
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) {
	double tmp;
	if (x <= -3.4e+93) {
		tmp = y / ((1.0 + x) * x);
	} else if (x <= -9.5e-142) {
		tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
	} else {
		tmp = x / (y * (y + 1.0));
	}
	return tmp;
}
def code(x, y):
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
def code(x, y):
	tmp = 0
	if x <= -3.4e+93:
		tmp = y / ((1.0 + x) * x)
	elif x <= -9.5e-142:
		tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
	else:
		tmp = x / (y * (y + 1.0))
	return tmp
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)
	tmp = 0.0
	if (x <= -3.4e+93)
		tmp = Float64(y / Float64(Float64(1.0 + x) * x));
	elseif (x <= -9.5e-142)
		tmp = Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0)));
	else
		tmp = Float64(x / Float64(y * Float64(y + 1.0)));
	end
	return tmp
end
function tmp = code(x, y)
	tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -3.4e+93)
		tmp = y / ((1.0 + x) * x);
	elseif (x <= -9.5e-142)
		tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
	else
		tmp = x / (y * (y + 1.0));
	end
	tmp_2 = tmp;
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_] := If[LessEqual[x, -3.4e+93], N[(y / N[(N[(1.0 + x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.5e-142], 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], N[(x / N[(y * N[(y + 1.0), $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)}
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+93}:\\
\;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\

\mathbf{elif}\;x \leq -9.5 \cdot 10^{-142}:\\
\;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original19.8
Target0.1
Herbie9.4
\[\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}} \]

Derivation?

  1. Split input into 3 regimes
  2. if x < -3.4e93

    1. Initial program 26.1

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Taylor expanded in y around 0 11.2

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

    if -3.4e93 < x < -9.49999999999999967e-142

    1. Initial program 8.7

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

    if -9.49999999999999967e-142 < x

    1. Initial program 22.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. Taylor expanded in x around 0 8.4

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

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

      [Start]8.4

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

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

      \[ \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification9.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.4 \cdot 10^{+93}:\\ \;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\ \mathbf{elif}\;x \leq -9.5 \cdot 10^{-142}:\\ \;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]

Alternatives

Alternative 1
Error22.2
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq 1.7 \cdot 10^{-104}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
Alternative 2
Error13.1
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -6.2 \cdot 10^{-114}:\\ \;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
Alternative 3
Error35.9
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq -4.2 \cdot 10^{-180}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 4
Error61.4
Cost192
\[\frac{0.5}{y} \]
Alternative 5
Error47.4
Cost192
\[\frac{x}{y} \]
Alternative 6
Error61.6
Cost128
\[-y \]
Alternative 7
Error61.8
Cost64
\[0.5 \]

Error

Reproduce?

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