Average Error: 13.3 → 0.3
Time: 33.7s
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 -4375372716885399658865637297550002460033000:\\ \;\;\;\;\left(\frac{1}{\sin B \cdot {F}^{2}} + \frac{-1}{\sin B}\right) + \left(-\frac{x \cdot 1}{\tan B}\right)\\ \mathbf{elif}\;F \le 312418.127475462271831929683685302734375:\\ \;\;\;\;\frac{\frac{F}{\sin B}}{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(\frac{1}{2}\right)}} + \left(-1 \cdot \frac{x \cdot \cos B}{\sin B}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - \frac{1}{\sin B \cdot {F}^{2}}\right) + \left(-\frac{x \cdot 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 -4375372716885399658865637297550002460033000:\\
\;\;\;\;\left(\frac{1}{\sin B \cdot {F}^{2}} + \frac{-1}{\sin B}\right) + \left(-\frac{x \cdot 1}{\tan B}\right)\\

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

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

\end{array}
double f(double F, double B, double x) {
        double r62948 = x;
        double r62949 = 1.0;
        double r62950 = B;
        double r62951 = tan(r62950);
        double r62952 = r62949 / r62951;
        double r62953 = r62948 * r62952;
        double r62954 = -r62953;
        double r62955 = F;
        double r62956 = sin(r62950);
        double r62957 = r62955 / r62956;
        double r62958 = r62955 * r62955;
        double r62959 = 2.0;
        double r62960 = r62958 + r62959;
        double r62961 = r62959 * r62948;
        double r62962 = r62960 + r62961;
        double r62963 = r62949 / r62959;
        double r62964 = -r62963;
        double r62965 = pow(r62962, r62964);
        double r62966 = r62957 * r62965;
        double r62967 = r62954 + r62966;
        return r62967;
}

double f(double F, double B, double x) {
        double r62968 = F;
        double r62969 = -4.3753727168853997e+42;
        bool r62970 = r62968 <= r62969;
        double r62971 = 1.0;
        double r62972 = B;
        double r62973 = sin(r62972);
        double r62974 = 2.0;
        double r62975 = pow(r62968, r62974);
        double r62976 = r62973 * r62975;
        double r62977 = r62971 / r62976;
        double r62978 = -1.0;
        double r62979 = r62978 / r62973;
        double r62980 = r62977 + r62979;
        double r62981 = x;
        double r62982 = r62981 * r62971;
        double r62983 = tan(r62972);
        double r62984 = r62982 / r62983;
        double r62985 = -r62984;
        double r62986 = r62980 + r62985;
        double r62987 = 312418.1274754623;
        bool r62988 = r62968 <= r62987;
        double r62989 = r62968 / r62973;
        double r62990 = 2.0;
        double r62991 = fma(r62968, r62968, r62990);
        double r62992 = fma(r62990, r62981, r62991);
        double r62993 = r62971 / r62990;
        double r62994 = pow(r62992, r62993);
        double r62995 = r62989 / r62994;
        double r62996 = cos(r62972);
        double r62997 = r62981 * r62996;
        double r62998 = r62997 / r62973;
        double r62999 = r62971 * r62998;
        double r63000 = -r62999;
        double r63001 = r62995 + r63000;
        double r63002 = 1.0;
        double r63003 = r63002 / r62973;
        double r63004 = r63003 - r62977;
        double r63005 = r63004 + r62985;
        double r63006 = r62988 ? r63001 : r63005;
        double r63007 = r62970 ? r62986 : r63006;
        return r63007;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if F < -4.3753727168853997e+42

    1. Initial program 27.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. Simplified27.6

      \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-\frac{1}{2}\right)}, \frac{F}{\sin B}, -x \cdot \frac{1}{\tan B}\right)}\]
    3. Using strategy rm
    4. Applied associate-*r/27.6

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

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

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

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

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

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

    if -4.3753727168853997e+42 < F < 312418.1274754623

    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({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-\frac{1}{2}\right)}, \frac{F}{\sin B}, -x \cdot \frac{1}{\tan B}\right)}\]
    3. Using strategy rm
    4. Applied associate-*r/0.4

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

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

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

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

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

    if 312418.1274754623 < 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({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-\frac{1}{2}\right)}, \frac{F}{\sin B}, -x \cdot \frac{1}{\tan B}\right)}\]
    3. Using strategy rm
    4. Applied associate-*r/23.8

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

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

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

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

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

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

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

Reproduce

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