Average Error: 13.6 → 0.2
Time: 12.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 -3087839481724426660981998878720:\\ \;\;\;\;\mathsf{fma}\left(1, \frac{x}{\sin B \cdot {F}^{2}}, -\mathsf{fma}\left(1, \frac{x \cdot \cos B}{\sin B}, \frac{1}{\sin B}\right)\right)\\ \mathbf{elif}\;F \le 2.261353027761691304873686315517525889847 \cdot 10^{115}:\\ \;\;\;\;\frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-\frac{1}{2}\right)} \cdot F}{\sin B} + \left(-\frac{x \cdot 1}{\tan B}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-1, \frac{x \cdot \cos B}{\sin B} + \frac{x}{\sin B \cdot {F}^{2}}, \frac{1}{\sin 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 -3087839481724426660981998878720:\\
\;\;\;\;\mathsf{fma}\left(1, \frac{x}{\sin B \cdot {F}^{2}}, -\mathsf{fma}\left(1, \frac{x \cdot \cos B}{\sin B}, \frac{1}{\sin B}\right)\right)\\

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

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

\end{array}
double f(double F, double B, double x) {
        double r46847 = x;
        double r46848 = 1.0;
        double r46849 = B;
        double r46850 = tan(r46849);
        double r46851 = r46848 / r46850;
        double r46852 = r46847 * r46851;
        double r46853 = -r46852;
        double r46854 = F;
        double r46855 = sin(r46849);
        double r46856 = r46854 / r46855;
        double r46857 = r46854 * r46854;
        double r46858 = 2.0;
        double r46859 = r46857 + r46858;
        double r46860 = r46858 * r46847;
        double r46861 = r46859 + r46860;
        double r46862 = r46848 / r46858;
        double r46863 = -r46862;
        double r46864 = pow(r46861, r46863);
        double r46865 = r46856 * r46864;
        double r46866 = r46853 + r46865;
        return r46866;
}

double f(double F, double B, double x) {
        double r46867 = F;
        double r46868 = -3.0878394817244267e+30;
        bool r46869 = r46867 <= r46868;
        double r46870 = 1.0;
        double r46871 = x;
        double r46872 = B;
        double r46873 = sin(r46872);
        double r46874 = 2.0;
        double r46875 = pow(r46867, r46874);
        double r46876 = r46873 * r46875;
        double r46877 = r46871 / r46876;
        double r46878 = cos(r46872);
        double r46879 = r46871 * r46878;
        double r46880 = r46879 / r46873;
        double r46881 = 1.0;
        double r46882 = r46881 / r46873;
        double r46883 = fma(r46870, r46880, r46882);
        double r46884 = -r46883;
        double r46885 = fma(r46870, r46877, r46884);
        double r46886 = 2.2613530277616913e+115;
        bool r46887 = r46867 <= r46886;
        double r46888 = 2.0;
        double r46889 = fma(r46867, r46867, r46888);
        double r46890 = fma(r46871, r46888, r46889);
        double r46891 = r46870 / r46888;
        double r46892 = -r46891;
        double r46893 = pow(r46890, r46892);
        double r46894 = r46893 * r46867;
        double r46895 = r46894 / r46873;
        double r46896 = r46871 * r46870;
        double r46897 = tan(r46872);
        double r46898 = r46896 / r46897;
        double r46899 = -r46898;
        double r46900 = r46895 + r46899;
        double r46901 = -r46870;
        double r46902 = r46880 + r46877;
        double r46903 = fma(r46901, r46902, r46882);
        double r46904 = r46887 ? r46900 : r46903;
        double r46905 = r46869 ? r46885 : r46904;
        return r46905;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if F < -3.0878394817244267e+30

    1. Initial program 26.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. Simplified26.6

      \[\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. Taylor expanded around -inf 0.2

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

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

    if -3.0878394817244267e+30 < F < 2.2613530277616913e+115

    1. Initial program 1.1

      \[\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. Simplified1.1

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

      \[\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 sqr-pow1.0

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

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

      \[\leadsto \mathsf{fma}\left(\frac{F}{\sin B}, {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(\frac{-\frac{1}{2}}{2}\right)} \cdot \color{blue}{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(\frac{-\frac{1}{2}}{2}\right)}}, -\frac{x \cdot 1}{\tan B}\right)\]
    9. Using strategy rm
    10. Applied fma-udef1.0

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

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

    if 2.2613530277616913e+115 < F

    1. Initial program 35.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. Simplified35.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. Taylor expanded around inf 0.2

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

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

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

Reproduce

herbie shell --seed 2020001 +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))))))