Average Error: 21.8 → 0.1
Time: 12.3s
Precision: binary64
Cost: 968
\[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
\[\begin{array}{l} \mathbf{if}\;y \leq -6800000:\\ \;\;\;\;x + \frac{x + -1}{y} \cdot \left(-1 + \frac{1}{y}\right)\\ \mathbf{elif}\;y \leq 200000000:\\ \;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1 - x}{y}\\ \end{array} \]
(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
(FPCore (x y)
 :precision binary64
 (if (<= y -6800000.0)
   (+ x (* (/ (+ x -1.0) y) (+ -1.0 (/ 1.0 y))))
   (if (<= y 200000000.0)
     (+ 1.0 (/ (* y (+ x -1.0)) (+ y 1.0)))
     (+ x (/ (- 1.0 x) y)))))
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 <= -6800000.0) {
		tmp = x + (((x + -1.0) / y) * (-1.0 + (1.0 / y)));
	} else if (y <= 200000000.0) {
		tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
	} else {
		tmp = x + ((1.0 - x) / y);
	}
	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 <= (-6800000.0d0)) then
        tmp = x + (((x + (-1.0d0)) / y) * ((-1.0d0) + (1.0d0 / y)))
    else if (y <= 200000000.0d0) then
        tmp = 1.0d0 + ((y * (x + (-1.0d0))) / (y + 1.0d0))
    else
        tmp = x + ((1.0d0 - x) / y)
    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 <= -6800000.0) {
		tmp = x + (((x + -1.0) / y) * (-1.0 + (1.0 / y)));
	} else if (y <= 200000000.0) {
		tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
	} else {
		tmp = x + ((1.0 - x) / y);
	}
	return tmp;
}
def code(x, y):
	return 1.0 - (((1.0 - x) * y) / (y + 1.0))
def code(x, y):
	tmp = 0
	if y <= -6800000.0:
		tmp = x + (((x + -1.0) / y) * (-1.0 + (1.0 / y)))
	elif y <= 200000000.0:
		tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0))
	else:
		tmp = x + ((1.0 - x) / y)
	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 <= -6800000.0)
		tmp = Float64(x + Float64(Float64(Float64(x + -1.0) / y) * Float64(-1.0 + Float64(1.0 / y))));
	elseif (y <= 200000000.0)
		tmp = Float64(1.0 + Float64(Float64(y * Float64(x + -1.0)) / Float64(y + 1.0)));
	else
		tmp = Float64(x + Float64(Float64(1.0 - x) / y));
	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 <= -6800000.0)
		tmp = x + (((x + -1.0) / y) * (-1.0 + (1.0 / y)));
	elseif (y <= 200000000.0)
		tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
	else
		tmp = x + ((1.0 - x) / y);
	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, -6800000.0], N[(x + N[(N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] * N[(-1.0 + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 200000000.0], N[(1.0 + N[(N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
\mathbf{if}\;y \leq -6800000:\\
\;\;\;\;x + \frac{x + -1}{y} \cdot \left(-1 + \frac{1}{y}\right)\\

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

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


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original21.8
Target0.2
Herbie0.1
\[\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 < -6.8e6

    1. Initial program 44.9

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

      \[\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): 1 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, 1 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, 29 points decrease in error
      (+.f64 (Rewrite<= associate-/r/_binary64 (/.f64 (neg.f64 (-.f64 1 x)) (/.f64 (+.f64 y 1) y))) 1): 11 points increase in error, 16 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): 37 points increase in error, 6 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)))): 0 points increase in error, 0 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))): 12 points increase in error, 8 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)): 0 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 -6.8e6 < y < 2e8

    1. Initial program 0.1

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

    if 2e8 < y

    1. Initial program 45.6

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

      \[\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): 1 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, 1 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, 29 points decrease in error
      (+.f64 (Rewrite<= associate-/r/_binary64 (/.f64 (neg.f64 (-.f64 1 x)) (/.f64 (+.f64 y 1) y))) 1): 11 points increase in error, 16 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): 37 points increase in error, 6 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.1

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

      \[\leadsto \color{blue}{x + \frac{1 - x}{y}} \]
      Proof
      (+.f64 x (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 x (Rewrite=> div-sub_binary64 (-.f64 (/.f64 1 y) (/.f64 x y)))): 2 points increase in error, 1 points decrease in error
      (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 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) x)) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
  3. Recombined 3 regimes into one program.
  4. Final simplification0.1

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

Alternatives

Alternative 1
Error0.1
Cost968
\[\begin{array}{l} t_0 := x + \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -145000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 116000000:\\ \;\;\;\;1 + \frac{x + -1}{\frac{y + 1}{y}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error0.1
Cost968
\[\begin{array}{l} t_0 := x + \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -145000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 116000000:\\ \;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error0.1
Cost968
\[\begin{array}{l} t_0 := x + \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -145000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 140000000:\\ \;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error1.2
Cost712
\[\begin{array}{l} t_0 := x - \frac{-1}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.8:\\ \;\;\;\;1 + y \cdot \left(x + -1\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error1.0
Cost712
\[\begin{array}{l} t_0 := x + \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 + y \cdot \left(x + -1\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error15.7
Cost584
\[\begin{array}{l} t_0 := x - \frac{x}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error8.8
Cost584
\[\begin{array}{l} t_0 := x - \frac{-1}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.00192:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error1.3
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 9
Error15.9
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 0.6:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Error16.1
Cost328
\[\begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.8:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 11
Error38.6
Cost64
\[1 \]

Error

Reproduce

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