Average Error: 14.2 → 0.2
Time: 10.9s
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 -25045099127.8391991:\\ \;\;\;\;\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 1584339.73845752398:\\ \;\;\;\;\frac{\frac{F}{\sin B}}{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}} + \left(-\frac{x \cdot 1}{\sin B} \cdot \cos B\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - 1 \cdot \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 -25045099127.8391991:\\
\;\;\;\;\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 1584339.73845752398:\\
\;\;\;\;\frac{\frac{F}{\sin B}}{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}} + \left(-\frac{x \cdot 1}{\sin B} \cdot \cos B\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sin B} - 1 \cdot \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 r39945 = x;
        double r39946 = 1.0;
        double r39947 = B;
        double r39948 = tan(r39947);
        double r39949 = r39946 / r39948;
        double r39950 = r39945 * r39949;
        double r39951 = -r39950;
        double r39952 = F;
        double r39953 = sin(r39947);
        double r39954 = r39952 / r39953;
        double r39955 = r39952 * r39952;
        double r39956 = 2.0;
        double r39957 = r39955 + r39956;
        double r39958 = r39956 * r39945;
        double r39959 = r39957 + r39958;
        double r39960 = r39946 / r39956;
        double r39961 = -r39960;
        double r39962 = pow(r39959, r39961);
        double r39963 = r39954 * r39962;
        double r39964 = r39951 + r39963;
        return r39964;
}

double f(double F, double B, double x) {
        double r39965 = F;
        double r39966 = -25045099127.8392;
        bool r39967 = r39965 <= r39966;
        double r39968 = 1.0;
        double r39969 = x;
        double r39970 = B;
        double r39971 = sin(r39970);
        double r39972 = 2.0;
        double r39973 = pow(r39965, r39972);
        double r39974 = r39971 * r39973;
        double r39975 = r39969 / r39974;
        double r39976 = cos(r39970);
        double r39977 = r39969 * r39976;
        double r39978 = r39977 / r39971;
        double r39979 = 1.0;
        double r39980 = r39979 / r39971;
        double r39981 = fma(r39968, r39978, r39980);
        double r39982 = -r39981;
        double r39983 = fma(r39968, r39975, r39982);
        double r39984 = 1584339.738457524;
        bool r39985 = r39965 <= r39984;
        double r39986 = r39965 / r39971;
        double r39987 = r39965 * r39965;
        double r39988 = 2.0;
        double r39989 = r39987 + r39988;
        double r39990 = r39988 * r39969;
        double r39991 = r39989 + r39990;
        double r39992 = r39968 / r39988;
        double r39993 = pow(r39991, r39992);
        double r39994 = r39986 / r39993;
        double r39995 = r39969 * r39968;
        double r39996 = r39995 / r39971;
        double r39997 = r39996 * r39976;
        double r39998 = -r39997;
        double r39999 = r39994 + r39998;
        double r40000 = r39979 / r39974;
        double r40001 = r39968 * r40000;
        double r40002 = r39980 - r40001;
        double r40003 = tan(r39970);
        double r40004 = r39995 / r40003;
        double r40005 = -r40004;
        double r40006 = r40002 + r40005;
        double r40007 = r39985 ? r39999 : r40006;
        double r40008 = r39967 ? r39983 : r40007;
        return r40008;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

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

    1. Initial program 26.2

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

      \[\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 -25045099127.8392 < F < 1584339.738457524

    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.3

      \[\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 fma-udef0.3

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

      \[\leadsto \color{blue}{\frac{\frac{F}{\sin B}}{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}} + \left(-\frac{x \cdot 1}{\tan B}\right)\]
    10. Using strategy rm
    11. Applied tan-quot0.3

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

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

    if 1584339.738457524 < F

    1. Initial program 26.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. Simplified26.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/26.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-neg26.3

      \[\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 fma-udef26.3

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

      \[\leadsto \color{blue}{\frac{\frac{F}{\sin B}}{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\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)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.2

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

Reproduce

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