Average Error: 22.6 → 0.2
Time: 3.4s
Precision: binary64
\[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
\[\begin{array}{l} t_0 := \left(\frac{1}{y} + \left(x + \frac{x}{{y}^{2}}\right)\right) - \left(\frac{x}{y} + \sqrt[3]{{y}^{-6}}\right)\\ \mathbf{if}\;y \leq -7.6 \cdot 10^{+14}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 260000:\\ \;\;\;\;\left(1 + \frac{y \cdot x}{y + 1}\right) - \frac{y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \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) (+ x (/ x (pow y 2.0))))
          (+ (/ x y) (cbrt (pow y -6.0))))))
   (if (<= y -7.6e+14)
     t_0
     (if (<= y 260000.0)
       (- (+ 1.0 (/ (* y x) (+ y 1.0))) (/ y (+ y 1.0)))
       t_0))))
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) + (x + (x / pow(y, 2.0)))) - ((x / y) + cbrt(pow(y, -6.0)));
	double tmp;
	if (y <= -7.6e+14) {
		tmp = t_0;
	} else if (y <= 260000.0) {
		tmp = (1.0 + ((y * x) / (y + 1.0))) - (y / (y + 1.0));
	} else {
		tmp = t_0;
	}
	return tmp;
}
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 t_0 = ((1.0 / y) + (x + (x / Math.pow(y, 2.0)))) - ((x / y) + Math.cbrt(Math.pow(y, -6.0)));
	double tmp;
	if (y <= -7.6e+14) {
		tmp = t_0;
	} else if (y <= 260000.0) {
		tmp = (1.0 + ((y * x) / (y + 1.0))) - (y / (y + 1.0));
	} else {
		tmp = t_0;
	}
	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 / y) + Float64(x + Float64(x / (y ^ 2.0)))) - Float64(Float64(x / y) + cbrt((y ^ -6.0))))
	tmp = 0.0
	if (y <= -7.6e+14)
		tmp = t_0;
	elseif (y <= 260000.0)
		tmp = Float64(Float64(1.0 + Float64(Float64(y * x) / Float64(y + 1.0))) - Float64(y / Float64(y + 1.0)));
	else
		tmp = t_0;
	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 / y), $MachinePrecision] + N[(x + N[(x / N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] + N[Power[N[Power[y, -6.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.6e+14], t$95$0, If[LessEqual[y, 260000.0], N[(N[(1.0 + N[(N[(y * x), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
t_0 := \left(\frac{1}{y} + \left(x + \frac{x}{{y}^{2}}\right)\right) - \left(\frac{x}{y} + \sqrt[3]{{y}^{-6}}\right)\\
\mathbf{if}\;y \leq -7.6 \cdot 10^{+14}:\\
\;\;\;\;t_0\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original22.6
Target0.2
Herbie0.2
\[\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 y < -7.6e14 or 2.6e5 < y

    1. Initial program 45.4

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(1 - x, \frac{y}{-1 - y}, 1\right)} \]
    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{x}{y} + \frac{1}{{y}^{2}}\right)} \]
    4. Applied egg-rr0.0

      \[\leadsto \left(\frac{1}{y} + \left(\frac{x}{{y}^{2}} + x\right)\right) - \left(\frac{x}{y} + \color{blue}{\sqrt[3]{{y}^{-6}}}\right) \]

    if -7.6e14 < y < 2.6e5

    1. Initial program 0.3

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(1 - x, \frac{y}{-1 - y}, 1\right)} \]
    3. Taylor expanded in x around 0 0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.6 \cdot 10^{+14}:\\ \;\;\;\;\left(\frac{1}{y} + \left(x + \frac{x}{{y}^{2}}\right)\right) - \left(\frac{x}{y} + \sqrt[3]{{y}^{-6}}\right)\\ \mathbf{elif}\;y \leq 260000:\\ \;\;\;\;\left(1 + \frac{y \cdot x}{y + 1}\right) - \frac{y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{y} + \left(x + \frac{x}{{y}^{2}}\right)\right) - \left(\frac{x}{y} + \sqrt[3]{{y}^{-6}}\right)\\ \end{array} \]

Reproduce

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