Average Error: 21.8 → 0.6
Time: 9.2s
Precision: binary64
Cost: 8264
\[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
\[\begin{array}{l} t_0 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\ t_1 := \mathsf{fma}\left(1 - x, \frac{y}{-1 - y}, 1\right)\\ \mathbf{if}\;t_0 \leq 5 \cdot 10^{-11}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 1.01:\\ \;\;\;\;x + \frac{x + -1}{y} \cdot \left(-1 + \frac{1}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (* (- 1.0 x) y) (+ 1.0 y)))
        (t_1 (fma (- 1.0 x) (/ y (- -1.0 y)) 1.0)))
   (if (<= t_0 5e-11)
     t_1
     (if (<= t_0 1.01) (+ x (* (/ (+ x -1.0) y) (+ -1.0 (/ 1.0 y)))) t_1))))
double code(double x, double y) {
	return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
double code(double x, double y) {
	double t_0 = ((1.0 - x) * y) / (1.0 + y);
	double t_1 = fma((1.0 - x), (y / (-1.0 - y)), 1.0);
	double tmp;
	if (t_0 <= 5e-11) {
		tmp = t_1;
	} else if (t_0 <= 1.01) {
		tmp = x + (((x + -1.0) / y) * (-1.0 + (1.0 / y)));
	} else {
		tmp = t_1;
	}
	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)
	t_0 = Float64(Float64(Float64(1.0 - x) * y) / Float64(1.0 + y))
	t_1 = fma(Float64(1.0 - x), Float64(y / Float64(-1.0 - y)), 1.0)
	tmp = 0.0
	if (t_0 <= 5e-11)
		tmp = t_1;
	elseif (t_0 <= 1.01)
		tmp = Float64(x + Float64(Float64(Float64(x + -1.0) / y) * Float64(-1.0 + Float64(1.0 / y))));
	else
		tmp = t_1;
	end
	return 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_] := Block[{t$95$0 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-11], t$95$1, If[LessEqual[t$95$0, 1.01], N[(x + N[(N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] * N[(-1.0 + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
t_0 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\
t_1 := \mathsf{fma}\left(1 - x, \frac{y}{-1 - y}, 1\right)\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-11}:\\
\;\;\;\;t_1\\

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error

Target

Original21.8
Target0.2
Herbie0.6
\[\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 2 regimes
  2. if (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) < 5.00000000000000018e-11 or 1.01000000000000001 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1))

    1. Initial program 10.8

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(1 - x, \frac{y}{-1 - y}, 1\right)} \]
      Proof
      (fma.f64 (-.f64 1 x) (/.f64 y (-.f64 -1 y)) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (/.f64 y (Rewrite=> sub-neg_binary64 (+.f64 -1 (neg.f64 y)))) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (/.f64 y (+.f64 (Rewrite<= metadata-eval (*.f64 -1 1)) (neg.f64 y))) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (/.f64 y (+.f64 (*.f64 -1 1) (Rewrite=> neg-mul-1_binary64 (*.f64 -1 y)))) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (/.f64 y (Rewrite<= distribute-lft-in_binary64 (*.f64 -1 (+.f64 1 y)))) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (/.f64 y (*.f64 -1 (Rewrite<= +-commutative_binary64 (+.f64 y 1)))) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (/.f64 y (*.f64 (Rewrite<= metadata-eval (/.f64 1 -1)) (+.f64 y 1))) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (/.f64 y (Rewrite<= associate-/r/_binary64 (/.f64 1 (/.f64 -1 (+.f64 y 1))))) 1): 19 points increase in error, 6 points decrease in error
      (fma.f64 (-.f64 1 x) (/.f64 y (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 1 (+.f64 y 1)) -1))) 1): 6 points increase in error, 19 points decrease in error
      (fma.f64 (-.f64 1 x) (/.f64 y (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 (+.f64 y 1) 1)) -1)) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (/.f64 y (Rewrite=> associate-/l*_binary64 (/.f64 (+.f64 y 1) (/.f64 -1 1)))) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (/.f64 y (/.f64 (+.f64 y 1) (Rewrite=> metadata-eval -1))) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (Rewrite=> associate-/r/_binary64 (*.f64 (/.f64 y (+.f64 y 1)) -1)) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (Rewrite=> *-commutative_binary64 (*.f64 -1 (/.f64 y (+.f64 y 1)))) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (Rewrite<= neg-mul-1_binary64 (neg.f64 (/.f64 y (+.f64 y 1)))) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (neg.f64 (/.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 y)) (+.f64 y 1))) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (-.f64 1 x) (neg.f64 (Rewrite=> associate-/l*_binary64 (/.f64 1 (/.f64 (+.f64 y 1) y)))) 1): 5 points increase in error, 0 points decrease in error
      (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (-.f64 1 x) (neg.f64 (/.f64 1 (/.f64 (+.f64 y 1) y)))) 1)): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 (-.f64 1 x) (neg.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 1 y) (+.f64 y 1))))) 1): 0 points increase in error, 5 points decrease in error
      (+.f64 (*.f64 (-.f64 1 x) (neg.f64 (/.f64 (Rewrite=> *-lft-identity_binary64 y) (+.f64 y 1)))) 1): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 (-.f64 1 x) (Rewrite=> distribute-neg-frac_binary64 (/.f64 (neg.f64 y) (+.f64 y 1)))) 1): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (-.f64 1 x) (neg.f64 y)) (+.f64 y 1))) 1): 37 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 (-.f64 1 x) y))) (+.f64 y 1)) 1): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)))) 1): 0 points increase in error, 0 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

    if 5.00000000000000018e-11 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) < 1.01000000000000001

    1. Initial program 56.4

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

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

      \[\leadsto \color{blue}{x + \frac{-1 + x}{y} \cdot \left(\frac{1}{y} + -1\right)} \]
      Proof
      (+.f64 x (*.f64 (/.f64 (+.f64 -1 x) y) (+.f64 (/.f64 1 y) -1))): 0 points increase in error, 0 points decrease in error
      (+.f64 x (*.f64 (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 x -1)) y) (+.f64 (/.f64 1 y) -1))): 0 points increase in error, 0 points decrease in error
      (+.f64 x (*.f64 (/.f64 (+.f64 x (Rewrite<= metadata-eval (neg.f64 1))) y) (+.f64 (/.f64 1 y) -1))): 0 points increase in error, 0 points decrease in error
      (+.f64 x (*.f64 (/.f64 (Rewrite<= sub-neg_binary64 (-.f64 x 1)) y) (+.f64 (/.f64 1 y) -1))): 0 points increase in error, 0 points decrease in error
      (+.f64 x (Rewrite<= distribute-rgt-out_binary64 (+.f64 (*.f64 (/.f64 1 y) (/.f64 (-.f64 x 1) y)) (*.f64 -1 (/.f64 (-.f64 x 1) y))))): 0 points increase in error, 0 points decrease in error
      (+.f64 x (+.f64 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 1 (-.f64 x 1)) (*.f64 y y))) (*.f64 -1 (/.f64 (-.f64 x 1) y)))): 12 points increase in error, 8 points decrease in error
      (+.f64 x (+.f64 (/.f64 (*.f64 1 (-.f64 x 1)) (Rewrite<= unpow2_binary64 (pow.f64 y 2))) (*.f64 -1 (/.f64 (-.f64 x 1) y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 x (+.f64 (/.f64 (*.f64 1 (-.f64 x 1)) (Rewrite<= *-lft-identity_binary64 (*.f64 1 (pow.f64 y 2)))) (*.f64 -1 (/.f64 (-.f64 x 1) y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 x (+.f64 (Rewrite=> times-frac_binary64 (*.f64 (/.f64 1 1) (/.f64 (-.f64 x 1) (pow.f64 y 2)))) (*.f64 -1 (/.f64 (-.f64 x 1) y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 x (+.f64 (*.f64 (Rewrite=> metadata-eval 1) (/.f64 (-.f64 x 1) (pow.f64 y 2))) (*.f64 -1 (/.f64 (-.f64 x 1) y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 x (+.f64 (Rewrite=> *-lft-identity_binary64 (/.f64 (-.f64 x 1) (pow.f64 y 2))) (*.f64 -1 (/.f64 (-.f64 x 1) y)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 x (/.f64 (-.f64 x 1) (pow.f64 y 2))) (*.f64 -1 (/.f64 (-.f64 x 1) y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite=> +-commutative_binary64 (+.f64 (/.f64 (-.f64 x 1) (pow.f64 y 2)) x)) (*.f64 -1 (/.f64 (-.f64 x 1) y))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-+l+_binary64 (+.f64 (/.f64 (-.f64 x 1) (pow.f64 y 2)) (+.f64 x (*.f64 -1 (/.f64 (-.f64 x 1) y))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (-.f64 x 1) (pow.f64 y 2)) (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) x))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) x) (/.f64 (-.f64 x 1) (pow.f64 y 2)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) x) (Rewrite=> div-sub_binary64 (-.f64 (/.f64 x (pow.f64 y 2)) (/.f64 1 (pow.f64 y 2))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) x) (/.f64 x (pow.f64 y 2))) (/.f64 1 (pow.f64 y 2)))): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 x (pow.f64 y 2)) (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) x))) (/.f64 1 (pow.f64 y 2))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate--l+_binary64 (+.f64 (/.f64 x (pow.f64 y 2)) (-.f64 (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) x) (/.f64 1 (pow.f64 y 2))))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> +-commutative_binary64 (+.f64 (-.f64 (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) x) (/.f64 1 (pow.f64 y 2))) (/.f64 x (pow.f64 y 2)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite=> associate--l+_binary64 (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) (-.f64 x (/.f64 1 (pow.f64 y 2))))) (/.f64 x (pow.f64 y 2))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-+l+_binary64 (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) (+.f64 (-.f64 x (/.f64 1 (pow.f64 y 2))) (/.f64 x (pow.f64 y 2))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) (Rewrite<= associate--r-_binary64 (-.f64 x (-.f64 (/.f64 1 (pow.f64 y 2)) (/.f64 x (pow.f64 y 2)))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) (-.f64 x (Rewrite<= div-sub_binary64 (/.f64 (-.f64 1 x) (pow.f64 y 2))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) (-.f64 x (/.f64 (Rewrite=> sub-neg_binary64 (+.f64 1 (neg.f64 x))) (pow.f64 y 2)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) (-.f64 x (/.f64 (+.f64 1 (Rewrite<= mul-1-neg_binary64 (*.f64 -1 x))) (pow.f64 y 2)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) (Rewrite<= unsub-neg_binary64 (+.f64 x (neg.f64 (/.f64 (+.f64 1 (*.f64 -1 x)) (pow.f64 y 2)))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) (+.f64 x (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (/.f64 (+.f64 1 (*.f64 -1 x)) (pow.f64 y 2)))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 -1 (/.f64 (-.f64 x 1) y)) (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 -1 (/.f64 (+.f64 1 (*.f64 -1 x)) (pow.f64 y 2))) x))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (+.f64 (*.f64 -1 (/.f64 (+.f64 1 (*.f64 -1 x)) (pow.f64 y 2))) x) (*.f64 -1 (/.f64 (-.f64 x 1) y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (*.f64 -1 (/.f64 (+.f64 1 (*.f64 -1 x)) (pow.f64 y 2))) x) (Rewrite=> mul-1-neg_binary64 (neg.f64 (/.f64 (-.f64 x 1) y)))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> unsub-neg_binary64 (-.f64 (+.f64 (*.f64 -1 (/.f64 (+.f64 1 (*.f64 -1 x)) (pow.f64 y 2))) x) (/.f64 (-.f64 x 1) y))): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (*.f64 -1 (/.f64 (+.f64 1 (*.f64 -1 x)) (pow.f64 y 2))) x) (Rewrite=> div-sub_binary64 (-.f64 (/.f64 x y) (/.f64 1 y)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 (+.f64 (*.f64 -1 (/.f64 (+.f64 1 (*.f64 -1 x)) (pow.f64 y 2))) x) (/.f64 x y)) (/.f64 1 y))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 1 y) (-.f64 (+.f64 (*.f64 -1 (/.f64 (+.f64 1 (*.f64 -1 x)) (pow.f64 y 2))) x) (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (/.f64 1 y) (+.f64 (*.f64 -1 (/.f64 (+.f64 1 (*.f64 -1 x)) (pow.f64 y 2))) x)) (/.f64 x y))): 0 points increase in error, 0 points decrease in error
  3. Recombined 2 regimes into one program.
  4. Final simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(1 - x\right) \cdot y}{1 + y} \leq 5 \cdot 10^{-11}:\\ \;\;\;\;\mathsf{fma}\left(1 - x, \frac{y}{-1 - y}, 1\right)\\ \mathbf{elif}\;\frac{\left(1 - x\right) \cdot y}{1 + y} \leq 1.01:\\ \;\;\;\;x + \frac{x + -1}{y} \cdot \left(-1 + \frac{1}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(1 - x, \frac{y}{-1 - y}, 1\right)\\ \end{array} \]

Alternatives

Alternative 1
Error1.1
Cost968
\[\begin{array}{l} t_0 := x + \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -2007105356.9362917:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.152959473072429 \cdot 10^{-15}:\\ \;\;\;\;1 - \frac{\left(1 - x\right) \cdot y}{1 + y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error1.1
Cost968
\[\begin{array}{l} \mathbf{if}\;y \leq -2007105356.9362917:\\ \;\;\;\;x + \frac{x + -1}{y} \cdot \left(-1 + \frac{1}{y}\right)\\ \mathbf{elif}\;y \leq 1.152959473072429 \cdot 10^{-15}:\\ \;\;\;\;1 - \frac{\left(1 - x\right) \cdot y}{1 + y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1 - x}{y}\\ \end{array} \]
Alternative 3
Error1.6
Cost712
\[\begin{array}{l} t_0 := x + \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -52.67181660164114:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.152959473072429 \cdot 10^{-15}:\\ \;\;\;\;1 + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error1.5
Cost712
\[\begin{array}{l} t_0 := x + \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -52.67181660164114:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.152959473072429 \cdot 10^{-15}:\\ \;\;\;\;1 - \left(y - x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error16.0
Cost584
\[\begin{array}{l} t_0 := x - \frac{x}{y}\\ \mathbf{if}\;y \leq -52.67181660164114:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.152959473072429 \cdot 10^{-15}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error9.0
Cost584
\[\begin{array}{l} t_0 := x + \frac{1}{y}\\ \mathbf{if}\;y \leq -52.67181660164114:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.152959473072429 \cdot 10^{-15}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error1.7
Cost584
\[\begin{array}{l} t_0 := x + \frac{1}{y}\\ \mathbf{if}\;y \leq -52.67181660164114:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.152959473072429 \cdot 10^{-15}:\\ \;\;\;\;1 + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error16.1
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -52.67181660164114:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.152959473072429 \cdot 10^{-15}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Error16.2
Cost328
\[\begin{array}{l} \mathbf{if}\;y \leq -52.67181660164114:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.152959473072429 \cdot 10^{-15}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Error39.0
Cost64
\[x \]

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))))