Average Error: 22.3 → 0.2
Time: 18.9s
Precision: 64
\[1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\]
\[\begin{array}{l} \mathbf{if}\;y \le -4201198044259844344621563904 \lor \neg \left(y \le 528433753610563.25\right):\\ \;\;\;\;\left(x + \frac{1}{y}\right) - 1 \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \frac{\left(1 - x\right) \cdot {y}^{3}}{{y}^{3} + {1}^{3}}\right) - \left(\left(1 - x\right) \cdot \frac{y}{{y}^{3} + {1}^{3}}\right) \cdot \left(1 \cdot 1 - y \cdot 1\right)\\ \end{array}\]
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
\mathbf{if}\;y \le -4201198044259844344621563904 \lor \neg \left(y \le 528433753610563.25\right):\\
\;\;\;\;\left(x + \frac{1}{y}\right) - 1 \cdot \frac{x}{y}\\

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

\end{array}
double f(double x, double y) {
        double r432642 = 1.0;
        double r432643 = x;
        double r432644 = r432642 - r432643;
        double r432645 = y;
        double r432646 = r432644 * r432645;
        double r432647 = r432645 + r432642;
        double r432648 = r432646 / r432647;
        double r432649 = r432642 - r432648;
        return r432649;
}

double f(double x, double y) {
        double r432650 = y;
        double r432651 = -4.2011980442598443e+27;
        bool r432652 = r432650 <= r432651;
        double r432653 = 528433753610563.25;
        bool r432654 = r432650 <= r432653;
        double r432655 = !r432654;
        bool r432656 = r432652 || r432655;
        double r432657 = x;
        double r432658 = 1.0;
        double r432659 = r432658 / r432650;
        double r432660 = r432657 + r432659;
        double r432661 = r432657 / r432650;
        double r432662 = r432658 * r432661;
        double r432663 = r432660 - r432662;
        double r432664 = r432658 - r432657;
        double r432665 = 3.0;
        double r432666 = pow(r432650, r432665);
        double r432667 = r432664 * r432666;
        double r432668 = pow(r432658, r432665);
        double r432669 = r432666 + r432668;
        double r432670 = r432667 / r432669;
        double r432671 = r432658 - r432670;
        double r432672 = r432650 / r432669;
        double r432673 = r432664 * r432672;
        double r432674 = r432658 * r432658;
        double r432675 = r432650 * r432658;
        double r432676 = r432674 - r432675;
        double r432677 = r432673 * r432676;
        double r432678 = r432671 - r432677;
        double r432679 = r432656 ? r432663 : r432678;
        return r432679;
}

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.3
Target0.2
Herbie0.2
\[\begin{array}{l} \mathbf{if}\;y \lt -3693.848278829724677052581682801246643066:\\ \;\;\;\;\frac{1}{y} - \left(\frac{x}{y} - x\right)\\ \mathbf{elif}\;y \lt 6799310503.41891002655029296875:\\ \;\;\;\;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 < -4.2011980442598443e+27 or 528433753610563.25 < y

    1. Initial program 46.8

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity46.8

      \[\leadsto 1 - \frac{\left(1 - x\right) \cdot y}{\color{blue}{1 \cdot \left(y + 1\right)}}\]
    4. Applied times-frac29.8

      \[\leadsto 1 - \color{blue}{\frac{1 - x}{1} \cdot \frac{y}{y + 1}}\]
    5. Simplified29.8

      \[\leadsto 1 - \color{blue}{\left(1 - x\right)} \cdot \frac{y}{y + 1}\]
    6. Using strategy rm
    7. Applied flip3-+53.6

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

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

      \[\leadsto 1 - \color{blue}{\left(\left(1 - x\right) \cdot \frac{y}{{y}^{3} + {1}^{3}}\right) \cdot \left(y \cdot y + \left(1 \cdot 1 - y \cdot 1\right)\right)}\]
    10. Taylor expanded around inf 0.0

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

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

    if -4.2011980442598443e+27 < y < 528433753610563.25

    1. Initial program 1.1

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity1.1

      \[\leadsto 1 - \frac{\left(1 - x\right) \cdot y}{\color{blue}{1 \cdot \left(y + 1\right)}}\]
    4. Applied times-frac1.0

      \[\leadsto 1 - \color{blue}{\frac{1 - x}{1} \cdot \frac{y}{y + 1}}\]
    5. Simplified1.0

      \[\leadsto 1 - \color{blue}{\left(1 - x\right)} \cdot \frac{y}{y + 1}\]
    6. Using strategy rm
    7. Applied flip3-+1.1

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

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

      \[\leadsto 1 - \color{blue}{\left(\left(1 - x\right) \cdot \frac{y}{{y}^{3} + {1}^{3}}\right) \cdot \left(y \cdot y + \left(1 \cdot 1 - y \cdot 1\right)\right)}\]
    10. Using strategy rm
    11. Applied distribute-lft-in1.1

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -4201198044259844344621563904 \lor \neg \left(y \le 528433753610563.25\right):\\ \;\;\;\;\left(x + \frac{1}{y}\right) - 1 \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \frac{\left(1 - x\right) \cdot {y}^{3}}{{y}^{3} + {1}^{3}}\right) - \left(\left(1 - x\right) \cdot \frac{y}{{y}^{3} + {1}^{3}}\right) \cdot \left(1 \cdot 1 - y \cdot 1\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019303 
(FPCore (x y)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, D"
  :precision binary64

  :herbie-target
  (if (< y -3693.84827882972468) (- (/ 1 y) (- (/ x y) x)) (if (< y 6799310503.41891003) (- 1 (/ (* (- 1 x) y) (+ y 1))) (- (/ 1 y) (- (/ x y) x))))

  (- 1 (/ (* (- 1 x) y) (+ y 1))))