Average Error: 13.9 → 1.2
Time: 12.6s
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 -3.36207794312012065 \cdot 10^{69}:\\ \;\;\;\;\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 3.70793572378502737 \cdot 10^{-27}:\\ \;\;\;\;\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{0}}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}} \cdot F + \left(-x \cdot \frac{1}{\tan B}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - 1 \cdot \frac{1}{\sin B \cdot {F}^{2}}\right) + \left(-x \cdot \frac{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 -3.36207794312012065 \cdot 10^{69}:\\
\;\;\;\;\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 3.70793572378502737 \cdot 10^{-27}:\\
\;\;\;\;\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{0}}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}} \cdot F + \left(-x \cdot \frac{1}{\tan B}\right)\\

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

\end{array}
double f(double F, double B, double x) {
        double r37982 = x;
        double r37983 = 1.0;
        double r37984 = B;
        double r37985 = tan(r37984);
        double r37986 = r37983 / r37985;
        double r37987 = r37982 * r37986;
        double r37988 = -r37987;
        double r37989 = F;
        double r37990 = sin(r37984);
        double r37991 = r37989 / r37990;
        double r37992 = r37989 * r37989;
        double r37993 = 2.0;
        double r37994 = r37992 + r37993;
        double r37995 = r37993 * r37982;
        double r37996 = r37994 + r37995;
        double r37997 = r37983 / r37993;
        double r37998 = -r37997;
        double r37999 = pow(r37996, r37998);
        double r38000 = r37991 * r37999;
        double r38001 = r37988 + r38000;
        return r38001;
}

double f(double F, double B, double x) {
        double r38002 = F;
        double r38003 = -3.3620779431201207e+69;
        bool r38004 = r38002 <= r38003;
        double r38005 = 1.0;
        double r38006 = x;
        double r38007 = B;
        double r38008 = sin(r38007);
        double r38009 = 2.0;
        double r38010 = pow(r38002, r38009);
        double r38011 = r38008 * r38010;
        double r38012 = r38006 / r38011;
        double r38013 = cos(r38007);
        double r38014 = r38006 * r38013;
        double r38015 = r38014 / r38008;
        double r38016 = 1.0;
        double r38017 = r38016 / r38008;
        double r38018 = fma(r38005, r38015, r38017);
        double r38019 = -r38018;
        double r38020 = fma(r38005, r38012, r38019);
        double r38021 = 3.7079357237850274e-27;
        bool r38022 = r38002 <= r38021;
        double r38023 = r38002 * r38002;
        double r38024 = 2.0;
        double r38025 = r38023 + r38024;
        double r38026 = r38024 * r38006;
        double r38027 = r38025 + r38026;
        double r38028 = 0.0;
        double r38029 = pow(r38027, r38028);
        double r38030 = r38005 / r38024;
        double r38031 = pow(r38027, r38030);
        double r38032 = r38008 * r38031;
        double r38033 = r38029 / r38032;
        double r38034 = r38033 * r38002;
        double r38035 = tan(r38007);
        double r38036 = r38005 / r38035;
        double r38037 = r38006 * r38036;
        double r38038 = -r38037;
        double r38039 = r38034 + r38038;
        double r38040 = r38016 / r38011;
        double r38041 = r38005 * r38040;
        double r38042 = r38017 - r38041;
        double r38043 = r38042 + r38038;
        double r38044 = r38022 ? r38039 : r38043;
        double r38045 = r38004 ? r38020 : r38044;
        return r38045;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if F < -3.3620779431201207e+69

    1. Initial program 30.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. Simplified30.7

      \[\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.3620779431201207e+69 < F < 3.7079357237850274e-27

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

      \[\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 clear-num0.7

      \[\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)}, -x \cdot \frac{1}{\tan B}\right)\]
    5. Using strategy rm
    6. Applied fma-udef0.7

      \[\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(-x \cdot \frac{1}{\tan B}\right)}\]
    7. Simplified0.4

      \[\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(-x \cdot \frac{1}{\tan B}\right)\]
    8. Using strategy rm
    9. Applied neg-sub00.4

      \[\leadsto \frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\color{blue}{\left(0 - \frac{1}{2}\right)}}}{\sin B} \cdot F + \left(-x \cdot \frac{1}{\tan B}\right)\]
    10. Applied pow-sub0.4

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

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

    if 3.7079357237850274e-27 < F

    1. Initial program 23.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. Simplified23.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 clear-num23.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)}, -x \cdot \frac{1}{\tan B}\right)\]
    5. Using strategy rm
    6. Applied fma-udef23.4

      \[\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(-x \cdot \frac{1}{\tan B}\right)}\]
    7. Simplified18.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(-x \cdot \frac{1}{\tan B}\right)\]
    8. Taylor expanded around inf 3.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -3.36207794312012065 \cdot 10^{69}:\\ \;\;\;\;\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 3.70793572378502737 \cdot 10^{-27}:\\ \;\;\;\;\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{0}}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}} \cdot F + \left(-x \cdot \frac{1}{\tan B}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - 1 \cdot \frac{1}{\sin B \cdot {F}^{2}}\right) + \left(-x \cdot \frac{1}{\tan B}\right)\\ \end{array}\]

Reproduce

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