Average Error: 22.8 → 8.0
Time: 4.7s
Precision: binary64
\[1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\]
\[\begin{array}{l} \mathbf{if}\;y \leq -12172248.367177077 \lor \neg \left(y \leq 4.920744420668106 \cdot 10^{+33}\right):\\ \;\;\;\;x + \frac{x}{y} \cdot \left(\frac{1}{y} - 1\right)\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot \left(\frac{1}{\sqrt[3]{y + 1} \cdot \sqrt[3]{y + 1}} \cdot \frac{x - 1}{\frac{\sqrt[3]{1 \cdot 1 - y \cdot y}}{\sqrt[3]{1 - y}}}\right)\\ \end{array}\]
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
\mathbf{if}\;y \leq -12172248.367177077 \lor \neg \left(y \leq 4.920744420668106 \cdot 10^{+33}\right):\\
\;\;\;\;x + \frac{x}{y} \cdot \left(\frac{1}{y} - 1\right)\\

\mathbf{else}:\\
\;\;\;\;1 + y \cdot \left(\frac{1}{\sqrt[3]{y + 1} \cdot \sqrt[3]{y + 1}} \cdot \frac{x - 1}{\frac{\sqrt[3]{1 \cdot 1 - y \cdot y}}{\sqrt[3]{1 - y}}}\right)\\

\end{array}
(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
(FPCore (x y)
 :precision binary64
 (if (or (<= y -12172248.367177077) (not (<= y 4.920744420668106e+33)))
   (+ x (* (/ x y) (- (/ 1.0 y) 1.0)))
   (+
    1.0
    (*
     y
     (*
      (/ 1.0 (* (cbrt (+ y 1.0)) (cbrt (+ y 1.0))))
      (/ (- x 1.0) (/ (cbrt (- (* 1.0 1.0) (* y y))) (cbrt (- 1.0 y)))))))))
double code(double x, double y) {
	return ((double) (1.0 - (((double) (((double) (1.0 - x)) * y)) / ((double) (y + 1.0)))));
}
double code(double x, double y) {
	double tmp;
	if (((y <= -12172248.367177077) || !(y <= 4.920744420668106e+33))) {
		tmp = ((double) (x + ((double) ((x / y) * ((double) ((1.0 / y) - 1.0))))));
	} else {
		tmp = ((double) (1.0 + ((double) (y * ((double) ((1.0 / ((double) (((double) cbrt(((double) (y + 1.0)))) * ((double) cbrt(((double) (y + 1.0))))))) * (((double) (x - 1.0)) / (((double) cbrt(((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))) / ((double) cbrt(((double) (1.0 - y))))))))))));
	}
	return tmp;
}

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.8
Target0.3
Herbie8.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 2 regimes
  2. if y < -12172248.367177077 or 4.92074442066810616e33 < y

    1. Initial program Error: 46.2 bits

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\]
    2. SimplifiedError: 29.7 bits

      \[\leadsto \color{blue}{1 + y \cdot \frac{x - 1}{1 + y}}\]
    3. Taylor expanded around inf Error: 15.3 bits

      \[\leadsto \color{blue}{\left(x + 1 \cdot \frac{x}{{y}^{2}}\right) - 1 \cdot \frac{x}{y}}\]
    4. SimplifiedError: 15.3 bits

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

    if -12172248.367177077 < y < 4.92074442066810616e33

    1. Initial program Error: 1.3 bits

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\]
    2. SimplifiedError: 1.2 bits

      \[\leadsto \color{blue}{1 + y \cdot \frac{x - 1}{1 + y}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrtError: 1.3 bits

      \[\leadsto 1 + y \cdot \frac{x - 1}{\color{blue}{\left(\sqrt[3]{1 + y} \cdot \sqrt[3]{1 + y}\right) \cdot \sqrt[3]{1 + y}}}\]
    5. Applied *-un-lft-identityError: 1.3 bits

      \[\leadsto 1 + y \cdot \frac{\color{blue}{1 \cdot \left(x - 1\right)}}{\left(\sqrt[3]{1 + y} \cdot \sqrt[3]{1 + y}\right) \cdot \sqrt[3]{1 + y}}\]
    6. Applied times-fracError: 1.3 bits

      \[\leadsto 1 + y \cdot \color{blue}{\left(\frac{1}{\sqrt[3]{1 + y} \cdot \sqrt[3]{1 + y}} \cdot \frac{x - 1}{\sqrt[3]{1 + y}}\right)}\]
    7. Using strategy rm
    8. Applied flip-+Error: 1.3 bits

      \[\leadsto 1 + y \cdot \left(\frac{1}{\sqrt[3]{1 + y} \cdot \sqrt[3]{1 + y}} \cdot \frac{x - 1}{\sqrt[3]{\color{blue}{\frac{1 \cdot 1 - y \cdot y}{1 - y}}}}\right)\]
    9. Applied cbrt-divError: 1.3 bits

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -12172248.367177077 \lor \neg \left(y \leq 4.920744420668106 \cdot 10^{+33}\right):\\ \;\;\;\;x + \frac{x}{y} \cdot \left(\frac{1}{y} - 1\right)\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot \left(\frac{1}{\sqrt[3]{y + 1} \cdot \sqrt[3]{y + 1}} \cdot \frac{x - 1}{\frac{\sqrt[3]{1 \cdot 1 - y \cdot y}}{\sqrt[3]{1 - y}}}\right)\\ \end{array}\]

Reproduce

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