Average Error: 7.7 → 0.3
Time: 5.9s
Precision: 64
\[\frac{a + b}{1 - a \cdot b}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a + b}{1 - a \cdot b} \le -1.091058094353956008944687425051336272544 \cdot 10^{-268} \lor \neg \left(\frac{a + b}{1 - a \cdot b} \le 0.0\right):\\ \;\;\;\;\frac{a + b}{1 - a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{b} - \left(\frac{1}{\left(a \cdot b\right) \cdot a} + \frac{1}{a}\right)\\ \end{array}\]
\frac{a + b}{1 - a \cdot b}
\begin{array}{l}
\mathbf{if}\;\frac{a + b}{1 - a \cdot b} \le -1.091058094353956008944687425051336272544 \cdot 10^{-268} \lor \neg \left(\frac{a + b}{1 - a \cdot b} \le 0.0\right):\\
\;\;\;\;\frac{a + b}{1 - a \cdot b}\\

\mathbf{else}:\\
\;\;\;\;\frac{-1}{b} - \left(\frac{1}{\left(a \cdot b\right) \cdot a} + \frac{1}{a}\right)\\

\end{array}
double f(double a, double b) {
        double r2289405 = a;
        double r2289406 = b;
        double r2289407 = r2289405 + r2289406;
        double r2289408 = 1.0;
        double r2289409 = r2289405 * r2289406;
        double r2289410 = r2289408 - r2289409;
        double r2289411 = r2289407 / r2289410;
        return r2289411;
}

double f(double a, double b) {
        double r2289412 = a;
        double r2289413 = b;
        double r2289414 = r2289412 + r2289413;
        double r2289415 = 1.0;
        double r2289416 = r2289412 * r2289413;
        double r2289417 = r2289415 - r2289416;
        double r2289418 = r2289414 / r2289417;
        double r2289419 = -1.091058094353956e-268;
        bool r2289420 = r2289418 <= r2289419;
        double r2289421 = 0.0;
        bool r2289422 = r2289418 <= r2289421;
        double r2289423 = !r2289422;
        bool r2289424 = r2289420 || r2289423;
        double r2289425 = -1.0;
        double r2289426 = r2289425 / r2289413;
        double r2289427 = r2289416 * r2289412;
        double r2289428 = r2289415 / r2289427;
        double r2289429 = 1.0;
        double r2289430 = r2289429 / r2289412;
        double r2289431 = r2289428 + r2289430;
        double r2289432 = r2289426 - r2289431;
        double r2289433 = r2289424 ? r2289418 : r2289432;
        return r2289433;
}

Error

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (/ (+ a b) (- 1.0 (* a b))) < -1.091058094353956e-268 or 0.0 < (/ (+ a b) (- 1.0 (* a b)))

    1. Initial program 4.4

      \[\frac{a + b}{1 - a \cdot b}\]

    if -1.091058094353956e-268 < (/ (+ a b) (- 1.0 (* a b))) < 0.0

    1. Initial program 57.7

      \[\frac{a + b}{1 - a \cdot b}\]
    2. Using strategy rm
    3. Applied clear-num57.7

      \[\leadsto \color{blue}{\frac{1}{\frac{1 - a \cdot b}{a + b}}}\]
    4. Taylor expanded around inf 3.3

      \[\leadsto \color{blue}{-\left(\frac{1}{b} + \left(1 \cdot \frac{1}{{a}^{2} \cdot b} + \frac{1}{a}\right)\right)}\]
    5. Simplified3.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a + b}{1 - a \cdot b} \le -1.091058094353956008944687425051336272544 \cdot 10^{-268} \lor \neg \left(\frac{a + b}{1 - a \cdot b} \le 0.0\right):\\ \;\;\;\;\frac{a + b}{1 - a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{b} - \left(\frac{1}{\left(a \cdot b\right) \cdot a} + \frac{1}{a}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (a b)
  :name "(a+b)/(1-a*b)"
  :precision binary64
  (/ (+ a b) (- 1 (* a b))))