Average Error: 13.4 → 0.3
Time: 11.8s
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 -183851881.329612910747528076171875:\\ \;\;\;\;\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 586041975272499142798909329031299072:\\ \;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, {\left({\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1}\right)}\right)}^{\left(\frac{\sqrt[3]{1}}{2}\right)}, -\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 -183851881.329612910747528076171875:\\
\;\;\;\;\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 586041975272499142798909329031299072:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, {\left({\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1}\right)}\right)}^{\left(\frac{\sqrt[3]{1}}{2}\right)}, -\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 r37858 = x;
        double r37859 = 1.0;
        double r37860 = B;
        double r37861 = tan(r37860);
        double r37862 = r37859 / r37861;
        double r37863 = r37858 * r37862;
        double r37864 = -r37863;
        double r37865 = F;
        double r37866 = sin(r37860);
        double r37867 = r37865 / r37866;
        double r37868 = r37865 * r37865;
        double r37869 = 2.0;
        double r37870 = r37868 + r37869;
        double r37871 = r37869 * r37858;
        double r37872 = r37870 + r37871;
        double r37873 = r37859 / r37869;
        double r37874 = -r37873;
        double r37875 = pow(r37872, r37874);
        double r37876 = r37867 * r37875;
        double r37877 = r37864 + r37876;
        return r37877;
}

double f(double F, double B, double x) {
        double r37878 = F;
        double r37879 = -183851881.3296129;
        bool r37880 = r37878 <= r37879;
        double r37881 = 1.0;
        double r37882 = x;
        double r37883 = B;
        double r37884 = sin(r37883);
        double r37885 = 2.0;
        double r37886 = pow(r37878, r37885);
        double r37887 = r37884 * r37886;
        double r37888 = r37882 / r37887;
        double r37889 = cos(r37883);
        double r37890 = r37882 * r37889;
        double r37891 = r37890 / r37884;
        double r37892 = 1.0;
        double r37893 = r37892 / r37884;
        double r37894 = fma(r37881, r37891, r37893);
        double r37895 = -r37894;
        double r37896 = fma(r37881, r37888, r37895);
        double r37897 = 5.8604197527249914e+35;
        bool r37898 = r37878 <= r37897;
        double r37899 = r37878 / r37884;
        double r37900 = r37878 * r37878;
        double r37901 = 2.0;
        double r37902 = r37900 + r37901;
        double r37903 = r37901 * r37882;
        double r37904 = r37902 + r37903;
        double r37905 = cbrt(r37881);
        double r37906 = r37905 * r37905;
        double r37907 = r37906 / r37892;
        double r37908 = -r37907;
        double r37909 = pow(r37904, r37908);
        double r37910 = r37905 / r37901;
        double r37911 = pow(r37909, r37910);
        double r37912 = r37882 * r37881;
        double r37913 = tan(r37883);
        double r37914 = r37912 / r37913;
        double r37915 = -r37914;
        double r37916 = fma(r37899, r37911, r37915);
        double r37917 = -r37881;
        double r37918 = r37891 + r37888;
        double r37919 = fma(r37917, r37918, r37893);
        double r37920 = r37898 ? r37916 : r37919;
        double r37921 = r37880 ? r37896 : r37920;
        return r37921;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

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

    1. Initial program 25.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. Simplified25.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. 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 -183851881.3296129 < F < 5.8604197527249914e+35

    1. Initial program 0.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. Simplified0.5

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

      \[\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 *-un-lft-identity0.4

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

      \[\leadsto \mathsf{fma}\left(\frac{F}{\sin B}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{1 \cdot 2}\right)}, -\frac{x \cdot 1}{\tan B}\right)\]
    8. Applied times-frac0.4

      \[\leadsto \mathsf{fma}\left(\frac{F}{\sin B}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{2}}\right)}, -\frac{x \cdot 1}{\tan B}\right)\]
    9. Applied distribute-lft-neg-in0.4

      \[\leadsto \mathsf{fma}\left(\frac{F}{\sin B}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\color{blue}{\left(\left(-\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1}\right) \cdot \frac{\sqrt[3]{1}}{2}\right)}}, -\frac{x \cdot 1}{\tan B}\right)\]
    10. Applied pow-unpow0.4

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

    if 5.8604197527249914e+35 < F

    1. Initial program 26.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. Simplified26.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. 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 -183851881.329612910747528076171875:\\ \;\;\;\;\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 586041975272499142798909329031299072:\\ \;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, {\left({\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1}\right)}\right)}^{\left(\frac{\sqrt[3]{1}}{2}\right)}, -\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 2019352 +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))))))