Average Error: 13.3 → 0.3
Time: 11.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 -2.7319830106242952 \cdot 10^{27}:\\ \;\;\;\;\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 504058493.67471987:\\ \;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, \frac{1}{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}, -\frac{x \cdot 1}{\sin B} \cdot \cos 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 -2.7319830106242952 \cdot 10^{27}:\\
\;\;\;\;\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 504058493.67471987:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, \frac{1}{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}, -\frac{x \cdot 1}{\sin B} \cdot \cos 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 r44905 = x;
        double r44906 = 1.0;
        double r44907 = B;
        double r44908 = tan(r44907);
        double r44909 = r44906 / r44908;
        double r44910 = r44905 * r44909;
        double r44911 = -r44910;
        double r44912 = F;
        double r44913 = sin(r44907);
        double r44914 = r44912 / r44913;
        double r44915 = r44912 * r44912;
        double r44916 = 2.0;
        double r44917 = r44915 + r44916;
        double r44918 = r44916 * r44905;
        double r44919 = r44917 + r44918;
        double r44920 = r44906 / r44916;
        double r44921 = -r44920;
        double r44922 = pow(r44919, r44921);
        double r44923 = r44914 * r44922;
        double r44924 = r44911 + r44923;
        return r44924;
}

double f(double F, double B, double x) {
        double r44925 = F;
        double r44926 = -2.731983010624295e+27;
        bool r44927 = r44925 <= r44926;
        double r44928 = 1.0;
        double r44929 = x;
        double r44930 = B;
        double r44931 = sin(r44930);
        double r44932 = 2.0;
        double r44933 = pow(r44925, r44932);
        double r44934 = r44931 * r44933;
        double r44935 = r44929 / r44934;
        double r44936 = cos(r44930);
        double r44937 = r44929 * r44936;
        double r44938 = r44937 / r44931;
        double r44939 = 1.0;
        double r44940 = r44939 / r44931;
        double r44941 = fma(r44928, r44938, r44940);
        double r44942 = -r44941;
        double r44943 = fma(r44928, r44935, r44942);
        double r44944 = 504058493.67471987;
        bool r44945 = r44925 <= r44944;
        double r44946 = r44925 / r44931;
        double r44947 = r44925 * r44925;
        double r44948 = 2.0;
        double r44949 = r44947 + r44948;
        double r44950 = r44948 * r44929;
        double r44951 = r44949 + r44950;
        double r44952 = r44928 / r44948;
        double r44953 = pow(r44951, r44952);
        double r44954 = r44939 / r44953;
        double r44955 = r44929 * r44928;
        double r44956 = r44955 / r44931;
        double r44957 = r44956 * r44936;
        double r44958 = -r44957;
        double r44959 = fma(r44946, r44954, r44958);
        double r44960 = -r44928;
        double r44961 = r44938 + r44935;
        double r44962 = fma(r44960, r44961, r44940);
        double r44963 = r44945 ? r44959 : r44962;
        double r44964 = r44927 ? r44943 : r44963;
        return r44964;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if F < -2.731983010624295e+27

    1. Initial program 25.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. Simplified25.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. 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 -2.731983010624295e+27 < F < 504058493.67471987

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

      \[\leadsto \mathsf{fma}\left(\frac{F}{\sin B}, \color{blue}{\frac{1}{{\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 tan-quot0.4

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

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

    if 504058493.67471987 < F

    1. Initial program 23.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. Simplified23.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. 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.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -2.7319830106242952 \cdot 10^{27}:\\ \;\;\;\;\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 504058493.67471987:\\ \;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, \frac{1}{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}, -\frac{x \cdot 1}{\sin B} \cdot \cos 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 2020064 +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))))))