Average Error: 22.2 → 0.0
Time: 9.2s
Precision: binary64
Cost: 1224
\[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
\[\begin{array}{l} \mathbf{if}\;y \leq -140000:\\ \;\;\;\;x + \left(\frac{-1}{y} + 1\right) \cdot \frac{1 - x}{y}\\ \mathbf{elif}\;y \leq 0.48:\\ \;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{y}{1 - x} + \frac{1}{1 - x}}\\ \end{array} \]
(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
(FPCore (x y)
 :precision binary64
 (if (<= y -140000.0)
   (+ x (* (+ (/ -1.0 y) 1.0) (/ (- 1.0 x) y)))
   (if (<= y 0.48)
     (+ 1.0 (/ (* y (+ x -1.0)) (+ y 1.0)))
     (+ x (/ 1.0 (+ (/ y (- 1.0 x)) (/ 1.0 (- 1.0 x))))))))
double code(double x, double y) {
	return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
double code(double x, double y) {
	double tmp;
	if (y <= -140000.0) {
		tmp = x + (((-1.0 / y) + 1.0) * ((1.0 - x) / y));
	} else if (y <= 0.48) {
		tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
	} else {
		tmp = x + (1.0 / ((y / (1.0 - x)) + (1.0 / (1.0 - x))));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 - (((1.0d0 - x) * y) / (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 (y <= (-140000.0d0)) then
        tmp = x + ((((-1.0d0) / y) + 1.0d0) * ((1.0d0 - x) / y))
    else if (y <= 0.48d0) then
        tmp = 1.0d0 + ((y * (x + (-1.0d0))) / (y + 1.0d0))
    else
        tmp = x + (1.0d0 / ((y / (1.0d0 - x)) + (1.0d0 / (1.0d0 - x))))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
public static double code(double x, double y) {
	double tmp;
	if (y <= -140000.0) {
		tmp = x + (((-1.0 / y) + 1.0) * ((1.0 - x) / y));
	} else if (y <= 0.48) {
		tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
	} else {
		tmp = x + (1.0 / ((y / (1.0 - x)) + (1.0 / (1.0 - x))));
	}
	return tmp;
}
def code(x, y):
	return 1.0 - (((1.0 - x) * y) / (y + 1.0))
def code(x, y):
	tmp = 0
	if y <= -140000.0:
		tmp = x + (((-1.0 / y) + 1.0) * ((1.0 - x) / y))
	elif y <= 0.48:
		tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0))
	else:
		tmp = x + (1.0 / ((y / (1.0 - x)) + (1.0 / (1.0 - x))))
	return tmp
function code(x, y)
	return Float64(1.0 - Float64(Float64(Float64(1.0 - x) * y) / Float64(y + 1.0)))
end
function code(x, y)
	tmp = 0.0
	if (y <= -140000.0)
		tmp = Float64(x + Float64(Float64(Float64(-1.0 / y) + 1.0) * Float64(Float64(1.0 - x) / y)));
	elseif (y <= 0.48)
		tmp = Float64(1.0 + Float64(Float64(y * Float64(x + -1.0)) / Float64(y + 1.0)));
	else
		tmp = Float64(x + Float64(1.0 / Float64(Float64(y / Float64(1.0 - x)) + Float64(1.0 / Float64(1.0 - x)))));
	end
	return tmp
end
function tmp = code(x, y)
	tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0));
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -140000.0)
		tmp = x + (((-1.0 / y) + 1.0) * ((1.0 - x) / y));
	elseif (y <= 0.48)
		tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
	else
		tmp = x + (1.0 / ((y / (1.0 - x)) + (1.0 / (1.0 - x))));
	end
	tmp_2 = tmp;
end
code[x_, y_] := N[(1.0 - N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := If[LessEqual[y, -140000.0], N[(x + N[(N[(N[(-1.0 / y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.48], N[(1.0 + N[(N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / N[(N[(y / N[(1.0 - x), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
\mathbf{if}\;y \leq -140000:\\
\;\;\;\;x + \left(\frac{-1}{y} + 1\right) \cdot \frac{1 - x}{y}\\

\mathbf{elif}\;y \leq 0.48:\\
\;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{1}{\frac{y}{1 - x} + \frac{1}{1 - x}}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original22.2
Target0.2
Herbie0.0
\[\begin{array}{l} \mathbf{if}\;y < -3693.8482788297247:\\ \;\;\;\;\frac{1}{y} - \left(\frac{x}{y} - x\right)\\ \mathbf{elif}\;y < 6799310503.41891:\\ \;\;\;\;1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y} - \left(\frac{x}{y} - x\right)\\ \end{array} \]

Derivation

  1. Split input into 3 regimes
  2. if y < -1.4e5

    1. Initial program 44.8

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Simplified27.8

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x - 1}{1 + y}, y, 1\right)} \]
      Proof
      (fma.f64 (/.f64 (-.f64 x 1) (+.f64 1 y)) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (/.f64 (-.f64 x 1) (Rewrite<= +-commutative_binary64 (+.f64 y 1))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (Rewrite=> div-sub_binary64 (-.f64 (/.f64 x (+.f64 y 1)) (/.f64 1 (+.f64 y 1)))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (Rewrite=> sub-neg_binary64 (+.f64 (/.f64 x (+.f64 y 1)) (neg.f64 (/.f64 1 (+.f64 y 1))))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (+.f64 (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (/.f64 x (+.f64 y 1))))) (neg.f64 (/.f64 1 (+.f64 y 1)))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (Rewrite<= distribute-neg-in_binary64 (neg.f64 (+.f64 (neg.f64 (/.f64 x (+.f64 y 1))) (/.f64 1 (+.f64 y 1))))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (neg.f64 (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 1 (+.f64 y 1)) (neg.f64 (/.f64 x (+.f64 y 1)))))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (neg.f64 (Rewrite<= sub-neg_binary64 (-.f64 (/.f64 1 (+.f64 y 1)) (/.f64 x (+.f64 y 1))))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (neg.f64 (Rewrite<= div-sub_binary64 (/.f64 (-.f64 1 x) (+.f64 y 1)))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (Rewrite=> distribute-neg-frac_binary64 (/.f64 (neg.f64 (-.f64 1 x)) (+.f64 y 1))) y 1): 0 points increase in error, 0 points decrease in error
      (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (/.f64 (neg.f64 (-.f64 1 x)) (+.f64 y 1)) y) 1)): 30 points increase in error, 37 points decrease in error
      (+.f64 (Rewrite<= associate-/r/_binary64 (/.f64 (neg.f64 (-.f64 1 x)) (/.f64 (+.f64 y 1) y))) 1): 17 points increase in error, 17 points decrease in error
      (+.f64 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 (-.f64 1 x) (/.f64 (+.f64 y 1) y)))) 1): 0 points increase in error, 0 points decrease in error
      (+.f64 (neg.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)))) 1): 35 points increase in error, 13 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 1 (neg.f64 (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= sub-neg_binary64 (-.f64 1 (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)))): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in y around inf 0.0

      \[\leadsto \color{blue}{\left(\frac{1}{y} + \left(\frac{x}{{y}^{2}} + x\right)\right) - \left(\frac{1}{{y}^{2}} + \frac{x}{y}\right)} \]
    4. Simplified0.0

      \[\leadsto \color{blue}{x + \left(\frac{-1}{y} + 1\right) \cdot \frac{1 - x}{y}} \]
      Proof
      (+.f64 x (*.f64 (+.f64 (/.f64 -1 y) 1) (/.f64 (-.f64 1 x) y))): 0 points increase in error, 0 points decrease in error
      (+.f64 x (Rewrite<= distribute-lft1-in_binary64 (+.f64 (*.f64 (/.f64 -1 y) (/.f64 (-.f64 1 x) y)) (/.f64 (-.f64 1 x) y)))): 1 points increase in error, 1 points decrease in error
      (+.f64 x (+.f64 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 -1 (-.f64 1 x)) (*.f64 y y))) (/.f64 (-.f64 1 x) y))): 8 points increase in error, 12 points decrease in error
      (+.f64 x (+.f64 (/.f64 (*.f64 -1 (-.f64 1 x)) (Rewrite<= unpow2_binary64 (pow.f64 y 2))) (/.f64 (-.f64 1 x) y))): 0 points increase in error, 0 points decrease in error
      (+.f64 x (+.f64 (Rewrite<= associate-*r/_binary64 (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2)))) (/.f64 (-.f64 1 x) y))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 x (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2)))) (/.f64 (-.f64 1 x) y))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2))) x)) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2))) x) (Rewrite=> div-sub_binary64 (-.f64 (/.f64 1 y) (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (+.f64 (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2))) x) (/.f64 1 y)) (/.f64 x y))): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 1 y) (+.f64 (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2))) x))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (Rewrite=> +-commutative_binary64 (+.f64 x (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2)))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (Rewrite=> mul-1-neg_binary64 (neg.f64 (/.f64 (-.f64 1 x) (pow.f64 y 2)))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (neg.f64 (Rewrite=> div-sub_binary64 (-.f64 (/.f64 1 (pow.f64 y 2)) (/.f64 x (pow.f64 y 2))))))) (/.f64 x y)): 2 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (neg.f64 (Rewrite=> sub-neg_binary64 (+.f64 (/.f64 1 (pow.f64 y 2)) (neg.f64 (/.f64 x (pow.f64 y 2)))))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (neg.f64 (Rewrite=> +-commutative_binary64 (+.f64 (neg.f64 (/.f64 x (pow.f64 y 2))) (/.f64 1 (pow.f64 y 2))))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (Rewrite=> distribute-neg-in_binary64 (+.f64 (neg.f64 (neg.f64 (/.f64 x (pow.f64 y 2)))) (neg.f64 (/.f64 1 (pow.f64 y 2))))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (+.f64 (Rewrite=> remove-double-neg_binary64 (/.f64 x (pow.f64 y 2))) (neg.f64 (/.f64 1 (pow.f64 y 2)))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (Rewrite=> unsub-neg_binary64 (-.f64 (/.f64 x (pow.f64 y 2)) (/.f64 1 (pow.f64 y 2)))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 x (/.f64 x (pow.f64 y 2))) (/.f64 1 (pow.f64 y 2))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (-.f64 (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 x (pow.f64 y 2)) x)) (/.f64 1 (pow.f64 y 2)))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (/.f64 1 y) (+.f64 (/.f64 x (pow.f64 y 2)) x)) (/.f64 1 (pow.f64 y 2)))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate--r+_binary64 (-.f64 (+.f64 (/.f64 1 y) (+.f64 (/.f64 x (pow.f64 y 2)) x)) (+.f64 (/.f64 1 (pow.f64 y 2)) (/.f64 x y)))): 0 points increase in error, 0 points decrease in error

    if -1.4e5 < y < 0.47999999999999998

    1. Initial program 0.0

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

    if 0.47999999999999998 < y

    1. Initial program 44.3

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Simplified28.4

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x - 1}{1 + y}, y, 1\right)} \]
      Proof
      (fma.f64 (/.f64 (-.f64 x 1) (+.f64 1 y)) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (/.f64 (-.f64 x 1) (Rewrite<= +-commutative_binary64 (+.f64 y 1))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (Rewrite=> div-sub_binary64 (-.f64 (/.f64 x (+.f64 y 1)) (/.f64 1 (+.f64 y 1)))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (Rewrite=> sub-neg_binary64 (+.f64 (/.f64 x (+.f64 y 1)) (neg.f64 (/.f64 1 (+.f64 y 1))))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (+.f64 (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (/.f64 x (+.f64 y 1))))) (neg.f64 (/.f64 1 (+.f64 y 1)))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (Rewrite<= distribute-neg-in_binary64 (neg.f64 (+.f64 (neg.f64 (/.f64 x (+.f64 y 1))) (/.f64 1 (+.f64 y 1))))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (neg.f64 (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 1 (+.f64 y 1)) (neg.f64 (/.f64 x (+.f64 y 1)))))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (neg.f64 (Rewrite<= sub-neg_binary64 (-.f64 (/.f64 1 (+.f64 y 1)) (/.f64 x (+.f64 y 1))))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (neg.f64 (Rewrite<= div-sub_binary64 (/.f64 (-.f64 1 x) (+.f64 y 1)))) y 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (Rewrite=> distribute-neg-frac_binary64 (/.f64 (neg.f64 (-.f64 1 x)) (+.f64 y 1))) y 1): 0 points increase in error, 0 points decrease in error
      (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (/.f64 (neg.f64 (-.f64 1 x)) (+.f64 y 1)) y) 1)): 30 points increase in error, 37 points decrease in error
      (+.f64 (Rewrite<= associate-/r/_binary64 (/.f64 (neg.f64 (-.f64 1 x)) (/.f64 (+.f64 y 1) y))) 1): 17 points increase in error, 17 points decrease in error
      (+.f64 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 (-.f64 1 x) (/.f64 (+.f64 y 1) y)))) 1): 0 points increase in error, 0 points decrease in error
      (+.f64 (neg.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)))) 1): 35 points increase in error, 13 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 1 (neg.f64 (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= sub-neg_binary64 (-.f64 1 (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)))): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in y around inf 0.5

      \[\leadsto \color{blue}{\left(\frac{1}{y} + \left(\frac{x}{{y}^{2}} + x\right)\right) - \left(\frac{1}{{y}^{2}} + \frac{x}{y}\right)} \]
    4. Simplified0.5

      \[\leadsto \color{blue}{x + \left(\frac{-1}{y} + 1\right) \cdot \frac{1 - x}{y}} \]
      Proof
      (+.f64 x (*.f64 (+.f64 (/.f64 -1 y) 1) (/.f64 (-.f64 1 x) y))): 0 points increase in error, 0 points decrease in error
      (+.f64 x (Rewrite<= distribute-lft1-in_binary64 (+.f64 (*.f64 (/.f64 -1 y) (/.f64 (-.f64 1 x) y)) (/.f64 (-.f64 1 x) y)))): 1 points increase in error, 1 points decrease in error
      (+.f64 x (+.f64 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 -1 (-.f64 1 x)) (*.f64 y y))) (/.f64 (-.f64 1 x) y))): 8 points increase in error, 12 points decrease in error
      (+.f64 x (+.f64 (/.f64 (*.f64 -1 (-.f64 1 x)) (Rewrite<= unpow2_binary64 (pow.f64 y 2))) (/.f64 (-.f64 1 x) y))): 0 points increase in error, 0 points decrease in error
      (+.f64 x (+.f64 (Rewrite<= associate-*r/_binary64 (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2)))) (/.f64 (-.f64 1 x) y))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 x (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2)))) (/.f64 (-.f64 1 x) y))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2))) x)) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2))) x) (Rewrite=> div-sub_binary64 (-.f64 (/.f64 1 y) (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (+.f64 (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2))) x) (/.f64 1 y)) (/.f64 x y))): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 1 y) (+.f64 (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2))) x))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (Rewrite=> +-commutative_binary64 (+.f64 x (*.f64 -1 (/.f64 (-.f64 1 x) (pow.f64 y 2)))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (Rewrite=> mul-1-neg_binary64 (neg.f64 (/.f64 (-.f64 1 x) (pow.f64 y 2)))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (neg.f64 (Rewrite=> div-sub_binary64 (-.f64 (/.f64 1 (pow.f64 y 2)) (/.f64 x (pow.f64 y 2))))))) (/.f64 x y)): 2 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (neg.f64 (Rewrite=> sub-neg_binary64 (+.f64 (/.f64 1 (pow.f64 y 2)) (neg.f64 (/.f64 x (pow.f64 y 2)))))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (neg.f64 (Rewrite=> +-commutative_binary64 (+.f64 (neg.f64 (/.f64 x (pow.f64 y 2))) (/.f64 1 (pow.f64 y 2))))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (Rewrite=> distribute-neg-in_binary64 (+.f64 (neg.f64 (neg.f64 (/.f64 x (pow.f64 y 2)))) (neg.f64 (/.f64 1 (pow.f64 y 2))))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (+.f64 (Rewrite=> remove-double-neg_binary64 (/.f64 x (pow.f64 y 2))) (neg.f64 (/.f64 1 (pow.f64 y 2)))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (+.f64 x (Rewrite=> unsub-neg_binary64 (-.f64 (/.f64 x (pow.f64 y 2)) (/.f64 1 (pow.f64 y 2)))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 x (/.f64 x (pow.f64 y 2))) (/.f64 1 (pow.f64 y 2))))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (/.f64 1 y) (-.f64 (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 x (pow.f64 y 2)) x)) (/.f64 1 (pow.f64 y 2)))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (/.f64 1 y) (+.f64 (/.f64 x (pow.f64 y 2)) x)) (/.f64 1 (pow.f64 y 2)))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate--r+_binary64 (-.f64 (+.f64 (/.f64 1 y) (+.f64 (/.f64 x (pow.f64 y 2)) x)) (+.f64 (/.f64 1 (pow.f64 y 2)) (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
    5. Applied egg-rr0.5

      \[\leadsto x + \color{blue}{\frac{1}{\frac{y}{\left(\frac{-1}{y} + 1\right) \cdot \left(1 - x\right)}}} \]
    6. Taylor expanded in y around inf 0.0

      \[\leadsto x + \frac{1}{\color{blue}{\frac{1}{1 - x} + \frac{y}{1 - x}}} \]
    7. Simplified0.0

      \[\leadsto x + \frac{1}{\color{blue}{\frac{y}{1 - x} + \frac{1}{1 - x}}} \]
      Proof
      (+.f64 (/.f64 y (-.f64 1 x)) (/.f64 1 (-.f64 1 x))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 1 (-.f64 1 x)) (/.f64 y (-.f64 1 x)))): 0 points increase in error, 0 points decrease in error
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -140000:\\ \;\;\;\;x + \left(\frac{-1}{y} + 1\right) \cdot \frac{1 - x}{y}\\ \mathbf{elif}\;y \leq 0.48:\\ \;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{y}{1 - x} + \frac{1}{1 - x}}\\ \end{array} \]

Alternatives

Alternative 1
Error0.2
Cost1992
\[\begin{array}{l} t_0 := \frac{y \cdot \left(1 - x\right)}{y + 1}\\ \mathbf{if}\;t_0 \leq 0.99995:\\ \;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\ \mathbf{elif}\;t_0 \leq 2:\\ \;\;\;\;x + \frac{1}{\frac{y}{\frac{-1}{y} + 1}}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{x + -1}{\frac{y + 1}{y}}\\ \end{array} \]
Alternative 2
Error0.1
Cost1096
\[\begin{array}{l} t_0 := x + \left(\frac{-1}{y} + 1\right) \cdot \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -520000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 260000:\\ \;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error9.2
Cost980
\[\begin{array}{l} t_0 := x + \frac{1}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.35 \cdot 10^{-75}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{-29}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-10}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 17500000000000:\\ \;\;\;\;\frac{1}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error0.8
Cost968
\[\begin{array}{l} t_0 := \frac{-1}{y} + 1\\ \mathbf{if}\;y \leq -3100:\\ \;\;\;\;x + \frac{t_0}{y}\\ \mathbf{elif}\;y \leq 320:\\ \;\;\;\;1 + \frac{y}{\frac{y + 1}{x}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{y}{t_0}}\\ \end{array} \]
Alternative 5
Error0.2
Cost968
\[\begin{array}{l} t_0 := \frac{-1}{y} + 1\\ \mathbf{if}\;y \leq -4200000000:\\ \;\;\;\;x + \frac{t_0}{y}\\ \mathbf{elif}\;y \leq 480000000:\\ \;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{y}{t_0}}\\ \end{array} \]
Alternative 6
Error0.2
Cost968
\[\begin{array}{l} t_0 := \frac{-1}{y} + 1\\ \mathbf{if}\;y \leq -35000000:\\ \;\;\;\;x + \frac{t_0}{y}\\ \mathbf{elif}\;y \leq 62000000:\\ \;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{y}{t_0}}\\ \end{array} \]
Alternative 7
Error9.3
Cost848
\[\begin{array}{l} t_0 := x + \frac{1}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{-70}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{-26}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 0.02:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error1.1
Cost840
\[\begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x + \frac{1 - x}{y}\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 + \left(y \cdot x - y\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{-1}{y} + 1}{y}\\ \end{array} \]
Alternative 9
Error1.1
Cost840
\[\begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x + \frac{1 - x}{y}\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 + x \cdot \left(y - y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{-1}{y} + 1}{y}\\ \end{array} \]
Alternative 10
Error0.8
Cost840
\[\begin{array}{l} t_0 := x + \frac{\frac{-1}{y} + 1}{y}\\ \mathbf{if}\;y \leq -76000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 9500:\\ \;\;\;\;1 + \frac{y}{\frac{y + 1}{x}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 11
Error17.0
Cost720
\[\begin{array}{l} \mathbf{if}\;y \leq -3.3 \cdot 10^{-6}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -3.7 \cdot 10^{-69}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{-29}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 17500000000000:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 12
Error1.3
Cost712
\[\begin{array}{l} t_0 := x + \frac{1}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.82:\\ \;\;\;\;1 + \left(y \cdot x - y\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 13
Error1.1
Cost712
\[\begin{array}{l} t_0 := x + \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 + \left(y \cdot x - y\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 14
Error1.4
Cost584
\[\begin{array}{l} t_0 := x + \frac{1}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 + y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 15
Error16.9
Cost328
\[\begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-25}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 16
Error39.1
Cost64
\[1 \]

Error

Reproduce

herbie shell --seed 2022338 
(FPCore (x y)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, D"
  :precision binary64

  :herbie-target
  (if (< y -3693.8482788297247) (- (/ 1.0 y) (- (/ x y) x)) (if (< y 6799310503.41891) (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))) (- (/ 1.0 y) (- (/ x y) x))))

  (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))