Average Error: 7.4 → 0.1
Time: 7.1s
Precision: 64
$\left(b \lt a \land b \ge 0.0\right) \land a \ge 0.0$
$\frac{a + b}{1 - a \cdot b}$
$\begin{array}{l} \mathbf{if}\;b \le 0.01282223269444739827127577314058726187795:\\ \;\;\;\;\frac{a + b}{1 - a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{b} - \left(\frac{1}{a} + \frac{1}{{a}^{2} \cdot b}\right)\\ \end{array}$
\frac{a + b}{1 - a \cdot b}
\begin{array}{l}
\mathbf{if}\;b \le 0.01282223269444739827127577314058726187795:\\
\;\;\;\;\frac{a + b}{1 - a \cdot b}\\

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

\end{array}
double f(double a, double b) {
double r2333555 = a;
double r2333556 = b;
double r2333557 = r2333555 + r2333556;
double r2333558 = 1.0;
double r2333559 = r2333555 * r2333556;
double r2333560 = r2333558 - r2333559;
double r2333561 = r2333557 / r2333560;
return r2333561;
}


double f(double a, double b) {
double r2333562 = b;
double r2333563 = 0.012822232694447398;
bool r2333564 = r2333562 <= r2333563;
double r2333565 = a;
double r2333566 = r2333565 + r2333562;
double r2333567 = 1.0;
double r2333568 = r2333565 * r2333562;
double r2333569 = r2333567 - r2333568;
double r2333570 = r2333566 / r2333569;
double r2333571 = -1.0;
double r2333572 = r2333571 / r2333562;
double r2333573 = 1.0;
double r2333574 = r2333573 / r2333565;
double r2333575 = 2.0;
double r2333576 = pow(r2333565, r2333575);
double r2333577 = r2333576 * r2333562;
double r2333578 = r2333567 / r2333577;
double r2333579 = r2333574 + r2333578;
double r2333580 = r2333572 - r2333579;
double r2333581 = r2333564 ? r2333570 : r2333580;
return r2333581;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if b < 0.012822232694447398

1. Initial program 0.1

$\frac{a + b}{1 - a \cdot b}$

## if 0.012822232694447398 < b

1. Initial program 29.1

$\frac{a + b}{1 - a \cdot b}$
2. Taylor expanded around inf 0.0

$\leadsto \color{blue}{-\left(\frac{1}{b} + \left(1 \cdot \frac{1}{{a}^{2} \cdot b} + \frac{1}{a}\right)\right)}$
3. Simplified0.0

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

$\leadsto \begin{array}{l} \mathbf{if}\;b \le 0.01282223269444739827127577314058726187795:\\ \;\;\;\;\frac{a + b}{1 - a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{b} - \left(\frac{1}{a} + \frac{1}{{a}^{2} \cdot b}\right)\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (a b)
:name "(a+b)/(1-a*b)"
:precision binary64
:pre (and (and (< b a) (>= b 0.0)) (>= a 0.0))
(/ (+ a b) (- 1 (* a b))))