Average Error: 13.8 → 0.8
Time: 36.3s
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 -30757712.2980388291180133819580078125:\\ \;\;\;\;\left(-\frac{1 \cdot x}{\tan B}\right) + \left(\frac{-1}{\sin B} + \frac{\frac{1}{\sin B}}{F \cdot F}\right)\\ \mathbf{elif}\;F \le 1.212379978946803148295268021742814848127 \cdot 10^{-12}:\\ \;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)\right)}^{\left(\frac{-1}{2}\right)}}{\sin B} \cdot F + \cos B \cdot \frac{-1 \cdot x}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - \frac{\frac{1}{\sin B}}{F \cdot F}\right) + \left(-\frac{1 \cdot x}{\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 -30757712.2980388291180133819580078125:\\
\;\;\;\;\left(-\frac{1 \cdot x}{\tan B}\right) + \left(\frac{-1}{\sin B} + \frac{\frac{1}{\sin B}}{F \cdot F}\right)\\

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

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

\end{array}
double f(double F, double B, double x) {
        double r60868 = x;
        double r60869 = 1.0;
        double r60870 = B;
        double r60871 = tan(r60870);
        double r60872 = r60869 / r60871;
        double r60873 = r60868 * r60872;
        double r60874 = -r60873;
        double r60875 = F;
        double r60876 = sin(r60870);
        double r60877 = r60875 / r60876;
        double r60878 = r60875 * r60875;
        double r60879 = 2.0;
        double r60880 = r60878 + r60879;
        double r60881 = r60879 * r60868;
        double r60882 = r60880 + r60881;
        double r60883 = r60869 / r60879;
        double r60884 = -r60883;
        double r60885 = pow(r60882, r60884);
        double r60886 = r60877 * r60885;
        double r60887 = r60874 + r60886;
        return r60887;
}

double f(double F, double B, double x) {
        double r60888 = F;
        double r60889 = -30757712.29803883;
        bool r60890 = r60888 <= r60889;
        double r60891 = 1.0;
        double r60892 = x;
        double r60893 = r60891 * r60892;
        double r60894 = B;
        double r60895 = tan(r60894);
        double r60896 = r60893 / r60895;
        double r60897 = -r60896;
        double r60898 = -1.0;
        double r60899 = sin(r60894);
        double r60900 = r60898 / r60899;
        double r60901 = r60891 / r60899;
        double r60902 = r60888 * r60888;
        double r60903 = r60901 / r60902;
        double r60904 = r60900 + r60903;
        double r60905 = r60897 + r60904;
        double r60906 = 1.2123799789468031e-12;
        bool r60907 = r60888 <= r60906;
        double r60908 = 2.0;
        double r60909 = fma(r60908, r60892, r60908);
        double r60910 = fma(r60888, r60888, r60909);
        double r60911 = -r60891;
        double r60912 = r60911 / r60908;
        double r60913 = pow(r60910, r60912);
        double r60914 = r60913 / r60899;
        double r60915 = r60914 * r60888;
        double r60916 = cos(r60894);
        double r60917 = -r60893;
        double r60918 = r60917 / r60899;
        double r60919 = r60916 * r60918;
        double r60920 = r60915 + r60919;
        double r60921 = 1.0;
        double r60922 = r60921 / r60899;
        double r60923 = r60922 - r60903;
        double r60924 = r60923 + r60897;
        double r60925 = r60907 ? r60920 : r60924;
        double r60926 = r60890 ? r60905 : r60925;
        return r60926;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

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

    1. Initial program 25.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. Using strategy rm
    3. Applied div-inv25.5

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(F \cdot \frac{1}{\sin B}\right)} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
    4. Applied associate-*l*19.4

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

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

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

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

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

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

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

    if -30757712.29803883 < F < 1.2123799789468031e-12

    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. Using strategy rm
    3. Applied div-inv0.4

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(F \cdot \frac{1}{\sin B}\right)} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
    4. Applied associate-*l*0.4

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

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

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

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

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

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

    if 1.2123799789468031e-12 < F

    1. Initial program 23.7

      \[\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. Using strategy rm
    3. Applied div-inv23.7

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(F \cdot \frac{1}{\sin B}\right)} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
    4. Applied associate-*l*19.0

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

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019194 +o rules:numerics
(FPCore (F B x)
  :name "VandenBroeck and Keller, Equation (23)"
  (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))