Average Error: 13.4 → 0.2
Time: 1.2m
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
\[\begin{array}{l} \mathbf{if}\;F \le -2114.7063979104823:\\ \;\;\;\;\frac{\frac{1}{F \cdot F} - 1}{\sin B} - \frac{x}{\sin B} \cdot \cos B\\ \mathbf{elif}\;F \le 2472.4041304961033:\\ \;\;\;\;\frac{F \cdot \log \left(e^{{\left(x \cdot 2 + \left(2 + F \cdot F\right)\right)}^{\frac{-1}{2}}}\right)}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \frac{1}{F \cdot F}}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]
double f(double F, double B, double x) {
        double r3588671 = x;
        double r3588672 = 1.0;
        double r3588673 = B;
        double r3588674 = tan(r3588673);
        double r3588675 = r3588672 / r3588674;
        double r3588676 = r3588671 * r3588675;
        double r3588677 = -r3588676;
        double r3588678 = F;
        double r3588679 = sin(r3588673);
        double r3588680 = r3588678 / r3588679;
        double r3588681 = r3588678 * r3588678;
        double r3588682 = 2.0;
        double r3588683 = r3588681 + r3588682;
        double r3588684 = r3588682 * r3588671;
        double r3588685 = r3588683 + r3588684;
        double r3588686 = r3588672 / r3588682;
        double r3588687 = -r3588686;
        double r3588688 = pow(r3588685, r3588687);
        double r3588689 = r3588680 * r3588688;
        double r3588690 = r3588677 + r3588689;
        return r3588690;
}

double f(double F, double B, double x) {
        double r3588691 = F;
        double r3588692 = -2114.7063979104823;
        bool r3588693 = r3588691 <= r3588692;
        double r3588694 = 1.0;
        double r3588695 = r3588691 * r3588691;
        double r3588696 = r3588694 / r3588695;
        double r3588697 = r3588696 - r3588694;
        double r3588698 = B;
        double r3588699 = sin(r3588698);
        double r3588700 = r3588697 / r3588699;
        double r3588701 = x;
        double r3588702 = r3588701 / r3588699;
        double r3588703 = cos(r3588698);
        double r3588704 = r3588702 * r3588703;
        double r3588705 = r3588700 - r3588704;
        double r3588706 = 2472.4041304961033;
        bool r3588707 = r3588691 <= r3588706;
        double r3588708 = 2.0;
        double r3588709 = r3588701 * r3588708;
        double r3588710 = r3588708 + r3588695;
        double r3588711 = r3588709 + r3588710;
        double r3588712 = -0.5;
        double r3588713 = pow(r3588711, r3588712);
        double r3588714 = exp(r3588713);
        double r3588715 = log(r3588714);
        double r3588716 = r3588691 * r3588715;
        double r3588717 = r3588716 / r3588699;
        double r3588718 = tan(r3588698);
        double r3588719 = r3588701 / r3588718;
        double r3588720 = r3588717 - r3588719;
        double r3588721 = r3588694 - r3588696;
        double r3588722 = r3588721 / r3588699;
        double r3588723 = r3588722 - r3588719;
        double r3588724 = r3588707 ? r3588720 : r3588723;
        double r3588725 = r3588693 ? r3588705 : r3588724;
        return r3588725;
}

\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\begin{array}{l}
\mathbf{if}\;F \le -2114.7063979104823:\\
\;\;\;\;\frac{\frac{1}{F \cdot F} - 1}{\sin B} - \frac{x}{\sin B} \cdot \cos B\\

\mathbf{elif}\;F \le 2472.4041304961033:\\
\;\;\;\;\frac{F \cdot \log \left(e^{{\left(x \cdot 2 + \left(2 + F \cdot F\right)\right)}^{\frac{-1}{2}}}\right)}{\sin B} - \frac{x}{\tan B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1 - \frac{1}{F \cdot F}}{\sin B} - \frac{x}{\tan B}\\

\end{array}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if F < -2114.7063979104823

    1. Initial program 24.6

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
    2. Simplified18.5

      \[\leadsto \color{blue}{\frac{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot F}{\sin B} - \frac{x}{\tan B}}\]
    3. Using strategy rm
    4. Applied tan-quot18.5

      \[\leadsto \frac{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot F}{\sin B} - \frac{x}{\color{blue}{\frac{\sin B}{\cos B}}}\]
    5. Applied associate-/r/18.5

      \[\leadsto \frac{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot F}{\sin B} - \color{blue}{\frac{x}{\sin B} \cdot \cos B}\]
    6. Taylor expanded around -inf 0.2

      \[\leadsto \frac{\color{blue}{\frac{1}{{F}^{2}} - 1}}{\sin B} - \frac{x}{\sin B} \cdot \cos B\]
    7. Simplified0.2

      \[\leadsto \frac{\color{blue}{\frac{1}{F \cdot F} - 1}}{\sin B} - \frac{x}{\sin B} \cdot \cos B\]

    if -2114.7063979104823 < F < 2472.4041304961033

    1. Initial program 0.4

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
    2. Simplified0.3

      \[\leadsto \color{blue}{\frac{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot F}{\sin B} - \frac{x}{\tan B}}\]
    3. Using strategy rm
    4. Applied add-log-exp0.3

      \[\leadsto \frac{\color{blue}{\log \left(e^{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}}}\right)} \cdot F}{\sin B} - \frac{x}{\tan B}\]

    if 2472.4041304961033 < F

    1. Initial program 25.5

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
    2. Simplified20.2

      \[\leadsto \color{blue}{\frac{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot F}{\sin B} - \frac{x}{\tan B}}\]
    3. Taylor expanded around inf 0.2

      \[\leadsto \frac{\color{blue}{1 - \frac{1}{{F}^{2}}}}{\sin B} - \frac{x}{\tan B}\]
    4. Simplified0.2

      \[\leadsto \frac{\color{blue}{1 - \frac{1}{F \cdot F}}}{\sin B} - \frac{x}{\tan B}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -2114.7063979104823:\\ \;\;\;\;\frac{\frac{1}{F \cdot F} - 1}{\sin B} - \frac{x}{\sin B} \cdot \cos B\\ \mathbf{elif}\;F \le 2472.4041304961033:\\ \;\;\;\;\frac{F \cdot \log \left(e^{{\left(x \cdot 2 + \left(2 + F \cdot F\right)\right)}^{\frac{-1}{2}}}\right)}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \frac{1}{F \cdot F}}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]

Reproduce

herbie shell --seed 2019102 
(FPCore (F B x)
  :name "VandenBroeck and Keller, Equation (23)"
  (+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2))))))