Average Error: 22.4 → 0.1
Time: 13.6s
Precision: binary64
Cost: 7940
\[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
\[\begin{array}{l} t_0 := \frac{\frac{-1}{y}}{y}\\ \mathbf{if}\;y \leq -18500:\\ \;\;\;\;\left(x + \left(1 - x\right) \cdot \left(\frac{1}{{y}^{3}} + t_0\right)\right) + \frac{1 - x}{y}\\ \mathbf{elif}\;y \leq 360000:\\ \;\;\;\;\mathsf{fma}\left(\frac{x + -1}{y + 1}, y, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y} + \left(\left(1 - x\right) \cdot t_0 + \left(x - \frac{x}{y}\right)\right)\\ \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 y) y)))
   (if (<= y -18500.0)
     (+ (+ x (* (- 1.0 x) (+ (/ 1.0 (pow y 3.0)) t_0))) (/ (- 1.0 x) y))
     (if (<= y 360000.0)
       (fma (/ (+ x -1.0) (+ y 1.0)) y 1.0)
       (+ (/ 1.0 y) (+ (* (- 1.0 x) t_0) (- x (/ 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 t_0 = (-1.0 / y) / y;
	double tmp;
	if (y <= -18500.0) {
		tmp = (x + ((1.0 - x) * ((1.0 / pow(y, 3.0)) + t_0))) + ((1.0 - x) / y);
	} else if (y <= 360000.0) {
		tmp = fma(((x + -1.0) / (y + 1.0)), y, 1.0);
	} else {
		tmp = (1.0 / y) + (((1.0 - x) * t_0) + (x - (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)
	t_0 = Float64(Float64(-1.0 / y) / y)
	tmp = 0.0
	if (y <= -18500.0)
		tmp = Float64(Float64(x + Float64(Float64(1.0 - x) * Float64(Float64(1.0 / (y ^ 3.0)) + t_0))) + Float64(Float64(1.0 - x) / y));
	elseif (y <= 360000.0)
		tmp = fma(Float64(Float64(x + -1.0) / Float64(y + 1.0)), y, 1.0);
	else
		tmp = Float64(Float64(1.0 / y) + Float64(Float64(Float64(1.0 - x) * t_0) + Float64(x - Float64(x / y))));
	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[(-1.0 / y), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -18500.0], N[(N[(x + N[(N[(1.0 - x), $MachinePrecision] * N[(N[(1.0 / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 360000.0], N[(N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] + N[(N[(N[(1.0 - x), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
t_0 := \frac{\frac{-1}{y}}{y}\\
\mathbf{if}\;y \leq -18500:\\
\;\;\;\;\left(x + \left(1 - x\right) \cdot \left(\frac{1}{{y}^{3}} + t_0\right)\right) + \frac{1 - x}{y}\\

\mathbf{elif}\;y \leq 360000:\\
\;\;\;\;\mathsf{fma}\left(\frac{x + -1}{y + 1}, y, 1\right)\\

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


\end{array}

Error

Target

Original22.4
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 < -18500

    1. Initial program 45.6

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

      \[\leadsto \color{blue}{1 - y \cdot \frac{1 - x}{1 + y}} \]
      Proof
      (-.f64 1 (*.f64 y (/.f64 (-.f64 1 x) (+.f64 1 y)))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (*.f64 y (/.f64 (-.f64 1 x) (Rewrite<= +-commutative_binary64 (+.f64 y 1))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (*.f64 y (/.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 (-.f64 1 x))) (+.f64 y 1)))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (*.f64 y (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 1 (+.f64 y 1)) (-.f64 1 x))))): 14 points increase in error, 0 points decrease in error
      (-.f64 1 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 y (/.f64 1 (+.f64 y 1))) (-.f64 1 x)))): 9 points increase in error, 17 points decrease in error
      (-.f64 1 (*.f64 (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 1 (+.f64 y 1)) y)) (-.f64 1 x))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (*.f64 (Rewrite<= associate-/r/_binary64 (/.f64 1 (/.f64 (+.f64 y 1) y))) (-.f64 1 x))): 9 points increase in error, 20 points decrease in error
      (-.f64 1 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 1 (-.f64 1 x)) (/.f64 (+.f64 y 1) y)))): 5 points increase in error, 5 points decrease in error
      (-.f64 1 (/.f64 (Rewrite=> *-lft-identity_binary64 (-.f64 1 x)) (/.f64 (+.f64 y 1) y))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)))): 44 points increase in error, 9 points decrease in error
    3. Taylor expanded in y around inf 0.0

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

      \[\leadsto \color{blue}{\left(x + \left(1 - x\right) \cdot \left(\frac{1}{{y}^{3}} + \frac{\frac{-1}{y}}{y}\right)\right) + \frac{1 - x}{y}} \]
      Proof
      (+.f64 (+.f64 x (*.f64 (-.f64 1 x) (+.f64 (/.f64 1 (pow.f64 y 3)) (/.f64 (/.f64 -1 y) y)))) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 x (*.f64 (-.f64 1 x) (+.f64 (/.f64 (Rewrite<= metadata-eval (pow.f64 1 3)) (pow.f64 y 3)) (/.f64 (/.f64 -1 y) y)))) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 x (*.f64 (-.f64 1 x) (+.f64 (Rewrite<= cube-div_binary64 (pow.f64 (/.f64 1 y) 3)) (/.f64 (/.f64 -1 y) y)))) (/.f64 (-.f64 1 x) y)): 11 points increase in error, 8 points decrease in error
      (+.f64 (+.f64 x (*.f64 (-.f64 1 x) (+.f64 (pow.f64 (/.f64 1 y) 3) (/.f64 (/.f64 (Rewrite<= metadata-eval (neg.f64 1)) y) y)))) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 x (*.f64 (-.f64 1 x) (+.f64 (pow.f64 (/.f64 1 y) 3) (/.f64 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 1 y))) y)))) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 x (*.f64 (-.f64 1 x) (+.f64 (pow.f64 (/.f64 1 y) 3) (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 (/.f64 1 y) y)))))) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 x (*.f64 (-.f64 1 x) (+.f64 (pow.f64 (/.f64 1 y) 3) (neg.f64 (/.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 (/.f64 1 y))) y))))) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 x (*.f64 (-.f64 1 x) (+.f64 (pow.f64 (/.f64 1 y) 3) (neg.f64 (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 1 y) (/.f64 1 y))))))) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 x (*.f64 (-.f64 1 x) (+.f64 (pow.f64 (/.f64 1 y) 3) (neg.f64 (Rewrite<= unpow2_binary64 (pow.f64 (/.f64 1 y) 2)))))) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 x (*.f64 (-.f64 1 x) (+.f64 (pow.f64 (/.f64 1 y) 3) (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (pow.f64 (/.f64 1 y) 2)))))) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 x (Rewrite<= distribute-rgt-out_binary64 (+.f64 (*.f64 (pow.f64 (/.f64 1 y) 3) (-.f64 1 x)) (*.f64 (*.f64 -1 (pow.f64 (/.f64 1 y) 2)) (-.f64 1 x))))) (/.f64 (-.f64 1 x) y)): 1 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 x (+.f64 (*.f64 (pow.f64 (/.f64 1 y) 3) (-.f64 1 x)) (*.f64 (*.f64 -1 (pow.f64 (/.f64 1 y) 2)) (Rewrite=> sub-neg_binary64 (+.f64 1 (neg.f64 x)))))) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 x (+.f64 (*.f64 (pow.f64 (/.f64 1 y) 3) (-.f64 1 x)) (*.f64 (*.f64 -1 (pow.f64 (/.f64 1 y) 2)) (+.f64 1 (Rewrite=> neg-mul-1_binary64 (*.f64 -1 x)))))) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 x (+.f64 (*.f64 (pow.f64 (/.f64 1 y) 3) (-.f64 1 x)) (Rewrite<= associate-*r*_binary64 (*.f64 -1 (*.f64 (pow.f64 (/.f64 1 y) 2) (+.f64 1 (*.f64 -1 x))))))) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= +-commutative_binary64 (+.f64 (+.f64 (*.f64 (pow.f64 (/.f64 1 y) 3) (-.f64 1 x)) (*.f64 -1 (*.f64 (pow.f64 (/.f64 1 y) 2) (+.f64 1 (*.f64 -1 x))))) x)) (/.f64 (-.f64 1 x) y)): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= associate-+r+_binary64 (+.f64 (*.f64 (pow.f64 (/.f64 1 y) 3) (-.f64 1 x)) (+.f64 (*.f64 -1 (*.f64 (pow.f64 (/.f64 1 y) 2) (+.f64 1 (*.f64 -1 x)))) x))) (/.f64 (-.f64 1 x) y)): 1 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (*.f64 (pow.f64 (/.f64 1 y) 3) (-.f64 1 x)) (+.f64 (*.f64 -1 (*.f64 (pow.f64 (/.f64 1 y) 2) (+.f64 1 (*.f64 -1 x)))) 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 (pow.f64 (/.f64 1 y) 3) (-.f64 1 x)) (+.f64 (*.f64 -1 (*.f64 (pow.f64 (/.f64 1 y) 2) (+.f64 1 (*.f64 -1 x)))) 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 (pow.f64 (/.f64 1 y) 3) (-.f64 1 x)) (+.f64 (*.f64 -1 (*.f64 (pow.f64 (/.f64 1 y) 2) (+.f64 1 (*.f64 -1 x)))) x)))) (/.f64 x y)): 0 points increase in error, 0 points decrease in error

    if -18500 < y < 3.6e5

    1. Initial program 0.1

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Simplified0.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, 1 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): 1 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)): 23 points increase in error, 34 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): 44 points increase in error, 9 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 3.6e5 < y

    1. Initial program 45.4

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

      \[\leadsto \color{blue}{1 - \frac{y}{\frac{1 + y}{1 - x}}} \]
      Proof
      (-.f64 1 (/.f64 y (/.f64 (+.f64 1 y) (-.f64 1 x)))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 y (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 y 1)) (-.f64 1 x)))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 y (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (/.f64 (+.f64 y 1) (-.f64 1 x))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 y (neg.f64 (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (/.f64 (+.f64 y 1) (-.f64 1 x))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 y (neg.f64 (*.f64 (Rewrite<= metadata-eval (/.f64 1 -1)) (/.f64 (+.f64 y 1) (-.f64 1 x)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 y (neg.f64 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 1 (+.f64 y 1)) (*.f64 -1 (-.f64 1 x))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 y (neg.f64 (/.f64 (*.f64 1 (+.f64 y 1)) (Rewrite<= neg-mul-1_binary64 (neg.f64 (-.f64 1 x))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 y (neg.f64 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 (+.f64 y 1) 1)) (neg.f64 (-.f64 1 x)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 y (neg.f64 (Rewrite=> associate-/l*_binary64 (/.f64 (+.f64 y 1) (/.f64 (neg.f64 (-.f64 1 x)) 1)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 y (neg.f64 (/.f64 (+.f64 y 1) (Rewrite=> /-rgt-identity_binary64 (neg.f64 (-.f64 1 x))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 y (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (/.f64 (+.f64 y 1) (neg.f64 (-.f64 1 x))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (Rewrite=> associate-/r*_binary64 (/.f64 (/.f64 y -1) (/.f64 (+.f64 y 1) (neg.f64 (-.f64 1 x)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 (/.f64 y (Rewrite<= metadata-eval (/.f64 1 -1))) (/.f64 (+.f64 y 1) (neg.f64 (-.f64 1 x))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 y -1) 1)) (/.f64 (+.f64 y 1) (neg.f64 (-.f64 1 x))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 (/.f64 (Rewrite=> *-commutative_binary64 (*.f64 -1 y)) 1) (/.f64 (+.f64 y 1) (neg.f64 (-.f64 1 x))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 (/.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 y)) 1) (/.f64 (+.f64 y 1) (neg.f64 (-.f64 1 x))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (/.f64 (Rewrite=> /-rgt-identity_binary64 (neg.f64 y)) (/.f64 (+.f64 y 1) (neg.f64 (-.f64 1 x))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 y (/.f64 (+.f64 y 1) (neg.f64 (-.f64 1 x))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (neg.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 y (neg.f64 (-.f64 1 x))) (+.f64 y 1))))): 44 points increase in error, 13 points decrease in error
      (-.f64 1 (neg.f64 (/.f64 (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 y (-.f64 1 x)))) (+.f64 y 1)))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (neg.f64 (/.f64 (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 (-.f64 1 x) y))) (+.f64 y 1)))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (neg.f64 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (Rewrite=> remove-double-neg_binary64 (/.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} + \left(-1 \cdot \left({\left(\frac{1}{y}\right)}^{2} \cdot \left(1 + -1 \cdot x\right)\right) + x\right)\right) - \frac{x}{y}} \]
    4. Simplified0.1

      \[\leadsto \color{blue}{\frac{1}{y} + \left(\left(x + -1\right) \cdot \frac{\frac{1}{y}}{y} + \left(x - \frac{x}{y}\right)\right)} \]
      Proof
      (+.f64 (/.f64 1 y) (+.f64 (*.f64 (+.f64 x -1) (/.f64 (/.f64 1 y) y)) (-.f64 x (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 1 y) (+.f64 (*.f64 (Rewrite=> +-commutative_binary64 (+.f64 -1 x)) (/.f64 (/.f64 1 y) y)) (-.f64 x (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 1 y) (+.f64 (*.f64 (+.f64 (Rewrite<= metadata-eval (-.f64 0 1)) x) (/.f64 (/.f64 1 y) y)) (-.f64 x (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 1 y) (+.f64 (*.f64 (Rewrite<= associate--r-_binary64 (-.f64 0 (-.f64 1 x))) (/.f64 (/.f64 1 y) y)) (-.f64 x (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 1 y) (+.f64 (*.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 (-.f64 1 x))) (/.f64 (/.f64 1 y) y)) (-.f64 x (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 1 y) (+.f64 (*.f64 (neg.f64 (-.f64 1 x)) (/.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 (/.f64 1 y))) y)) (-.f64 x (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 1 y) (+.f64 (*.f64 (neg.f64 (-.f64 1 x)) (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 1 y) (/.f64 1 y)))) (-.f64 x (/.f64 x y)))): 6 points increase in error, 8 points decrease in error
      (+.f64 (/.f64 1 y) (+.f64 (*.f64 (neg.f64 (-.f64 1 x)) (Rewrite<= unpow2_binary64 (pow.f64 (/.f64 1 y) 2))) (-.f64 x (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 1 y) (+.f64 (Rewrite<= distribute-lft-neg-in_binary64 (neg.f64 (*.f64 (-.f64 1 x) (pow.f64 (/.f64 1 y) 2)))) (-.f64 x (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 1 y) (+.f64 (neg.f64 (*.f64 (Rewrite=> sub-neg_binary64 (+.f64 1 (neg.f64 x))) (pow.f64 (/.f64 1 y) 2))) (-.f64 x (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 1 y) (+.f64 (neg.f64 (*.f64 (+.f64 1 (Rewrite=> neg-mul-1_binary64 (*.f64 -1 x))) (pow.f64 (/.f64 1 y) 2))) (-.f64 x (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 1 y) (+.f64 (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 (pow.f64 (/.f64 1 y) 2) (+.f64 1 (*.f64 -1 x))))) (-.f64 x (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 1 y) (+.f64 (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (*.f64 (pow.f64 (/.f64 1 y) 2) (+.f64 1 (*.f64 -1 x))))) (-.f64 x (/.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 1 y) (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (*.f64 -1 (*.f64 (pow.f64 (/.f64 1 y) 2) (+.f64 1 (*.f64 -1 x)))) x) (/.f64 x y)))): 1 points increase in error, 0 points decrease in error
      (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (/.f64 1 y) (+.f64 (*.f64 -1 (*.f64 (pow.f64 (/.f64 1 y) 2) (+.f64 1 (*.f64 -1 x)))) 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 -18500:\\ \;\;\;\;\left(x + \left(1 - x\right) \cdot \left(\frac{1}{{y}^{3}} + \frac{\frac{-1}{y}}{y}\right)\right) + \frac{1 - x}{y}\\ \mathbf{elif}\;y \leq 360000:\\ \;\;\;\;\mathsf{fma}\left(\frac{x + -1}{y + 1}, y, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y} + \left(\left(1 - x\right) \cdot \frac{\frac{-1}{y}}{y} + \left(x - \frac{x}{y}\right)\right)\\ \end{array} \]

Alternatives

Alternative 1
Error0.1
Cost7240
\[\begin{array}{l} t_0 := \frac{1}{y} + \left(\left(1 - x\right) \cdot \frac{\frac{-1}{y}}{y} + \left(x - \frac{x}{y}\right)\right)\\ \mathbf{if}\;y \leq -460000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 360000:\\ \;\;\;\;\mathsf{fma}\left(\frac{x + -1}{y + 1}, y, 1\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error0.1
Cost1480
\[\begin{array}{l} t_0 := \frac{1}{y} + \left(\left(1 - x\right) \cdot \frac{\frac{-1}{y}}{y} + \left(x - \frac{x}{y}\right)\right)\\ \mathbf{if}\;y \leq -255000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 230000:\\ \;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error0.2
Cost968
\[\begin{array}{l} \mathbf{if}\;y \leq -130000000:\\ \;\;\;\;x + \frac{1 - x}{y}\\ \mathbf{elif}\;y \leq 360000000000:\\ \;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{y}\\ \end{array} \]
Alternative 4
Error0.9
Cost840
\[\begin{array}{l} \mathbf{if}\;y \leq -4000:\\ \;\;\;\;x + \frac{1 - x}{y}\\ \mathbf{elif}\;y \leq 5000000000:\\ \;\;\;\;1 - \frac{y}{\frac{-1 - y}{x}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{y}\\ \end{array} \]
Alternative 5
Error18.8
Cost724
\[\begin{array}{l} \mathbf{if}\;y \leq -1.32 \cdot 10^{+71}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -75:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -9.8 \cdot 10^{-17}:\\ \;\;\;\;1 - y\\ \mathbf{elif}\;y \leq -1.15 \cdot 10^{-140}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-17}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error10.7
Cost716
\[\begin{array}{l} t_0 := x + \frac{1}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{-138}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-17}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error1.1
Cost712
\[\begin{array}{l} t_0 := x + \frac{1}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.8:\\ \;\;\;\;1 + \left(y \cdot x - y\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error1.1
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x + \frac{1 - x}{y}\\ \mathbf{elif}\;y \leq 0.8:\\ \;\;\;\;1 + \left(y \cdot x - y\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{y}\\ \end{array} \]
Alternative 9
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 10
Error18.6
Cost460
\[\begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{-13}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{-139}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-17}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 11
Error17.1
Cost328
\[\begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-17}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 12
Error39.4
Cost64
\[1 \]

Error

Reproduce

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