Average Error: 13.9 → 0.2
Time: 10.9s
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 r38611 = x;
        double r38612 = 1.0;
        double r38613 = B;
        double r38614 = tan(r38613);
        double r38615 = r38612 / r38614;
        double r38616 = r38611 * r38615;
        double r38617 = -r38616;
        double r38618 = F;
        double r38619 = sin(r38613);
        double r38620 = r38618 / r38619;
        double r38621 = r38618 * r38618;
        double r38622 = 2.0;
        double r38623 = r38621 + r38622;
        double r38624 = r38622 * r38611;
        double r38625 = r38623 + r38624;
        double r38626 = r38612 / r38622;
        double r38627 = -r38626;
        double r38628 = pow(r38625, r38627);
        double r38629 = r38620 * r38628;
        double r38630 = r38617 + r38629;
        return r38630;
}

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

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))))))