Average Error: 22.4 → 7.7
Time: 3.6s
Precision: binary64
\[1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\]
\[\begin{array}{l} \mathbf{if}\;y \leq -2.1600352617963054 \cdot 10^{+33} \lor \neg \left(y \leq 2.50009889712383 \cdot 10^{+44}\right):\\ \;\;\;\;x + \frac{x}{y} \cdot \left(\frac{1}{y} - 1\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(y \cdot \frac{x - 1}{{1}^{3} + {y}^{3}}\right) \cdot \left(1 \cdot 1 + \left(y \cdot y - y \cdot 1\right)\right)\\ \end{array}\]
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
\mathbf{if}\;y \leq -2.1600352617963054 \cdot 10^{+33} \lor \neg \left(y \leq 2.50009889712383 \cdot 10^{+44}\right):\\
\;\;\;\;x + \frac{x}{y} \cdot \left(\frac{1}{y} - 1\right)\\

\mathbf{else}:\\
\;\;\;\;1 + \left(y \cdot \frac{x - 1}{{1}^{3} + {y}^{3}}\right) \cdot \left(1 \cdot 1 + \left(y \cdot y - y \cdot 1\right)\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 -2.1600352617963054e+33) (not (<= y 2.50009889712383e+44)))
   (+ x (* (/ x y) (- (/ 1.0 y) 1.0)))
   (+
    1.0
    (*
     (* y (/ (- x 1.0) (+ (pow 1.0 3.0) (pow y 3.0))))
     (+ (* 1.0 1.0) (- (* y y) (* y 1.0)))))))
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 VAR;
	if (((y <= -2.1600352617963054e+33) || !(y <= 2.50009889712383e+44))) {
		VAR = ((double) (x + ((double) ((x / y) * ((double) ((1.0 / y) - 1.0))))));
	} else {
		VAR = ((double) (1.0 + ((double) (((double) (y * (((double) (x - 1.0)) / ((double) (((double) pow(1.0, 3.0)) + ((double) pow(y, 3.0))))))) * ((double) (((double) (1.0 * 1.0)) + ((double) (((double) (y * y)) - ((double) (y * 1.0))))))))));
	}
	return VAR;
}

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.4
Target0.3
Herbie7.7
\[\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 < -2.16003526179630545e33 or 2.50009889712383001e44 < y

    1. Initial program 47.5

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

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

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

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

    if -2.16003526179630545e33 < y < 2.50009889712383001e44

    1. Initial program 2.9

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

      \[\leadsto \color{blue}{1 + y \cdot \frac{x - 1}{1 + y}}\]
    3. Using strategy rm
    4. Applied flip3-+2.7

      \[\leadsto 1 + y \cdot \frac{x - 1}{\color{blue}{\frac{{1}^{3} + {y}^{3}}{1 \cdot 1 + \left(y \cdot y - 1 \cdot y\right)}}}\]
    5. Applied associate-/r/2.7

      \[\leadsto 1 + y \cdot \color{blue}{\left(\frac{x - 1}{{1}^{3} + {y}^{3}} \cdot \left(1 \cdot 1 + \left(y \cdot y - 1 \cdot y\right)\right)\right)}\]
    6. Applied associate-*r*2.7

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

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

Reproduce

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