Average Error: 13.9 → 0.2
Time: 12.1s
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 -282918228819822380000:\\ \;\;\;\;\left(1 \cdot \frac{1}{\sin B \cdot {F}^{2}} - \frac{1}{\sin B}\right) + \left(-\frac{x \cdot 1}{\tan B}\right)\\ \mathbf{elif}\;F \le 120765522752324900:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{\sin B}{F}}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}, -\frac{x \cdot 1}{\tan B}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - 1 \cdot \frac{1}{\sin B \cdot {F}^{2}}\right) + \left(-\frac{x \cdot 1}{\tan B}\right)\\ \end{array}\]
\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 -282918228819822380000:\\
\;\;\;\;\left(1 \cdot \frac{1}{\sin B \cdot {F}^{2}} - \frac{1}{\sin B}\right) + \left(-\frac{x \cdot 1}{\tan B}\right)\\

\mathbf{elif}\;F \le 120765522752324900:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{\sin B}{F}}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}, -\frac{x \cdot 1}{\tan B}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sin B} - 1 \cdot \frac{1}{\sin B \cdot {F}^{2}}\right) + \left(-\frac{x \cdot 1}{\tan B}\right)\\

\end{array}
double f(double F, double B, double x) {
        double r38615 = x;
        double r38616 = 1.0;
        double r38617 = B;
        double r38618 = tan(r38617);
        double r38619 = r38616 / r38618;
        double r38620 = r38615 * r38619;
        double r38621 = -r38620;
        double r38622 = F;
        double r38623 = sin(r38617);
        double r38624 = r38622 / r38623;
        double r38625 = r38622 * r38622;
        double r38626 = 2.0;
        double r38627 = r38625 + r38626;
        double r38628 = r38626 * r38615;
        double r38629 = r38627 + r38628;
        double r38630 = r38616 / r38626;
        double r38631 = -r38630;
        double r38632 = pow(r38629, r38631);
        double r38633 = r38624 * r38632;
        double r38634 = r38621 + r38633;
        return r38634;
}

double f(double F, double B, double x) {
        double r38635 = F;
        double r38636 = -2.8291822881982238e+20;
        bool r38637 = r38635 <= r38636;
        double r38638 = 1.0;
        double r38639 = 1.0;
        double r38640 = B;
        double r38641 = sin(r38640);
        double r38642 = 2.0;
        double r38643 = pow(r38635, r38642);
        double r38644 = r38641 * r38643;
        double r38645 = r38639 / r38644;
        double r38646 = r38638 * r38645;
        double r38647 = r38639 / r38641;
        double r38648 = r38646 - r38647;
        double r38649 = x;
        double r38650 = r38649 * r38638;
        double r38651 = tan(r38640);
        double r38652 = r38650 / r38651;
        double r38653 = -r38652;
        double r38654 = r38648 + r38653;
        double r38655 = 1.207655227523249e+17;
        bool r38656 = r38635 <= r38655;
        double r38657 = r38641 / r38635;
        double r38658 = r38639 / r38657;
        double r38659 = r38635 * r38635;
        double r38660 = 2.0;
        double r38661 = r38659 + r38660;
        double r38662 = r38660 * r38649;
        double r38663 = r38661 + r38662;
        double r38664 = r38638 / r38660;
        double r38665 = -r38664;
        double r38666 = pow(r38663, r38665);
        double r38667 = fma(r38658, r38666, r38653);
        double r38668 = r38647 - r38646;
        double r38669 = r38668 + r38653;
        double r38670 = r38656 ? r38667 : r38669;
        double r38671 = r38637 ? r38654 : r38670;
        return r38671;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if F < -2.8291822881982238e+20

    1. Initial program 25.3

      \[\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. Simplified25.3

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{F}{\sin B}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}, -x \cdot \frac{1}{\tan B}\right)}\]
    3. Using strategy rm
    4. Applied associate-*r/25.2

      \[\leadsto \mathsf{fma}\left(\frac{F}{\sin B}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}, -\color{blue}{\frac{x \cdot 1}{\tan B}}\right)\]
    5. Using strategy rm
    6. Applied clear-num25.2

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{\frac{\sin B}{F}}}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}, -\frac{x \cdot 1}{\tan B}\right)\]
    7. Using strategy rm
    8. Applied fma-udef25.2

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

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

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

    if -2.8291822881982238e+20 < F < 1.207655227523249e+17

    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.4

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{F}{\sin B}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}, -x \cdot \frac{1}{\tan B}\right)}\]
    3. Using strategy rm
    4. Applied associate-*r/0.3

      \[\leadsto \mathsf{fma}\left(\frac{F}{\sin B}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}, -\color{blue}{\frac{x \cdot 1}{\tan B}}\right)\]
    5. Using strategy rm
    6. Applied clear-num0.4

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

    if 1.207655227523249e+17 < F

    1. Initial program 26.9

      \[\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. Simplified26.9

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{F}{\sin B}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}, -x \cdot \frac{1}{\tan B}\right)}\]
    3. Using strategy rm
    4. Applied associate-*r/26.8

      \[\leadsto \mathsf{fma}\left(\frac{F}{\sin B}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}, -\color{blue}{\frac{x \cdot 1}{\tan B}}\right)\]
    5. Using strategy rm
    6. Applied clear-num26.8

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{\frac{\sin B}{F}}}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}, -\frac{x \cdot 1}{\tan B}\right)\]
    7. Using strategy rm
    8. Applied fma-udef26.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -282918228819822380000:\\ \;\;\;\;\left(1 \cdot \frac{1}{\sin B \cdot {F}^{2}} - \frac{1}{\sin B}\right) + \left(-\frac{x \cdot 1}{\tan B}\right)\\ \mathbf{elif}\;F \le 120765522752324900:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{\sin B}{F}}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}, -\frac{x \cdot 1}{\tan B}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - 1 \cdot \frac{1}{\sin B \cdot {F}^{2}}\right) + \left(-\frac{x \cdot 1}{\tan B}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020060 +o rules:numerics
(FPCore (F B x)
  :name "VandenBroeck and Keller, Equation (23)"
  :precision binary64
  (+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2))))))