Average Error: 14.0 → 7.2
Time: 35.1s
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 -4.7112453216261304 \cdot 10^{+129}:\\ \;\;\;\;\frac{\mathsf{expm1}\left(\left(\sqrt{\frac{1}{2}} - \sqrt{\frac{1}{8}} \cdot x\right) \cdot F - \left(F \cdot F\right) \cdot \frac{1}{4}\right)}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\frac{-1}{2}}\right)\right) \cdot \frac{1}{\sin B} - \frac{x}{\tan B}\\ \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 -4.7112453216261304 \cdot 10^{+129}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(\left(\sqrt{\frac{1}{2}} - \sqrt{\frac{1}{8}} \cdot x\right) \cdot F - \left(F \cdot F\right) \cdot \frac{1}{4}\right)}{\sin B} - \frac{x}{\tan B}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\frac{-1}{2}}\right)\right) \cdot \frac{1}{\sin B} - \frac{x}{\tan B}\\

\end{array}
double f(double F, double B, double x) {
        double r1786061 = x;
        double r1786062 = 1.0;
        double r1786063 = B;
        double r1786064 = tan(r1786063);
        double r1786065 = r1786062 / r1786064;
        double r1786066 = r1786061 * r1786065;
        double r1786067 = -r1786066;
        double r1786068 = F;
        double r1786069 = sin(r1786063);
        double r1786070 = r1786068 / r1786069;
        double r1786071 = r1786068 * r1786068;
        double r1786072 = 2.0;
        double r1786073 = r1786071 + r1786072;
        double r1786074 = r1786072 * r1786061;
        double r1786075 = r1786073 + r1786074;
        double r1786076 = r1786062 / r1786072;
        double r1786077 = -r1786076;
        double r1786078 = pow(r1786075, r1786077);
        double r1786079 = r1786070 * r1786078;
        double r1786080 = r1786067 + r1786079;
        return r1786080;
}

double f(double F, double B, double x) {
        double r1786081 = F;
        double r1786082 = -4.7112453216261304e+129;
        bool r1786083 = r1786081 <= r1786082;
        double r1786084 = 0.5;
        double r1786085 = sqrt(r1786084);
        double r1786086 = 0.125;
        double r1786087 = sqrt(r1786086);
        double r1786088 = x;
        double r1786089 = r1786087 * r1786088;
        double r1786090 = r1786085 - r1786089;
        double r1786091 = r1786090 * r1786081;
        double r1786092 = r1786081 * r1786081;
        double r1786093 = 0.25;
        double r1786094 = r1786092 * r1786093;
        double r1786095 = r1786091 - r1786094;
        double r1786096 = expm1(r1786095);
        double r1786097 = B;
        double r1786098 = sin(r1786097);
        double r1786099 = r1786096 / r1786098;
        double r1786100 = tan(r1786097);
        double r1786101 = r1786088 / r1786100;
        double r1786102 = r1786099 - r1786101;
        double r1786103 = 2.0;
        double r1786104 = fma(r1786081, r1786081, r1786103);
        double r1786105 = fma(r1786103, r1786088, r1786104);
        double r1786106 = -0.5;
        double r1786107 = pow(r1786105, r1786106);
        double r1786108 = r1786081 * r1786107;
        double r1786109 = log1p(r1786108);
        double r1786110 = expm1(r1786109);
        double r1786111 = 1.0;
        double r1786112 = r1786111 / r1786098;
        double r1786113 = r1786110 * r1786112;
        double r1786114 = r1786113 - r1786101;
        double r1786115 = r1786083 ? r1786102 : r1786114;
        return r1786115;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if F < -4.7112453216261304e+129

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

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

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

      \[\leadsto \frac{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\frac{-1}{2}} \cdot F\right)\right)}}{\sin B} - \frac{x}{\tan B}\]
    7. Taylor expanded around 0 8.6

      \[\leadsto \frac{\mathsf{expm1}\left(\color{blue}{F \cdot \sqrt{\frac{1}{2}} - \left(x \cdot \left(F \cdot \sqrt{\frac{1}{8}}\right) + \frac{1}{2} \cdot \left({F}^{2} \cdot {\left(\sqrt{\frac{1}{2}}\right)}^{2}\right)\right)}\right)}{\sin B} - \frac{x}{\tan B}\]
    8. Simplified8.6

      \[\leadsto \frac{\mathsf{expm1}\left(\color{blue}{F \cdot \left(\sqrt{\frac{1}{2}} - x \cdot \sqrt{\frac{1}{8}}\right) - \left(F \cdot F\right) \cdot \frac{1}{4}}\right)}{\sin B} - \frac{x}{\tan B}\]

    if -4.7112453216261304e+129 < F

    1. Initial program 9.3

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -4.7112453216261304 \cdot 10^{+129}:\\ \;\;\;\;\frac{\mathsf{expm1}\left(\left(\sqrt{\frac{1}{2}} - \sqrt{\frac{1}{8}} \cdot x\right) \cdot F - \left(F \cdot F\right) \cdot \frac{1}{4}\right)}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\frac{-1}{2}}\right)\right) \cdot \frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]

Reproduce

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