Average Error: 13.5 → 7.3
Time: 42.0s
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 -5.495021983986923 \cdot 10^{+84}:\\ \;\;\;\;\frac{\mathsf{expm1}\left(\left(\sqrt{\frac{1}{2}} - \sqrt{\frac{1}{8}} \cdot x\right) \cdot F - \left(\frac{1}{2} \cdot F\right) \cdot \left(\frac{1}{2} \cdot F\right)\right)}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\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)}{\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 -5.495021983986923 \cdot 10^{+84}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(\left(\sqrt{\frac{1}{2}} - \sqrt{\frac{1}{8}} \cdot x\right) \cdot F - \left(\frac{1}{2} \cdot F\right) \cdot \left(\frac{1}{2} \cdot F\right)\right)}{\sin B} - \frac{x}{\tan B}\\

\mathbf{else}:\\
\;\;\;\;\frac{\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)}{\sin B} - \frac{x}{\tan B}\\

\end{array}
double f(double F, double B, double x) {
        double r1552389 = x;
        double r1552390 = 1.0;
        double r1552391 = B;
        double r1552392 = tan(r1552391);
        double r1552393 = r1552390 / r1552392;
        double r1552394 = r1552389 * r1552393;
        double r1552395 = -r1552394;
        double r1552396 = F;
        double r1552397 = sin(r1552391);
        double r1552398 = r1552396 / r1552397;
        double r1552399 = r1552396 * r1552396;
        double r1552400 = 2.0;
        double r1552401 = r1552399 + r1552400;
        double r1552402 = r1552400 * r1552389;
        double r1552403 = r1552401 + r1552402;
        double r1552404 = r1552390 / r1552400;
        double r1552405 = -r1552404;
        double r1552406 = pow(r1552403, r1552405);
        double r1552407 = r1552398 * r1552406;
        double r1552408 = r1552395 + r1552407;
        return r1552408;
}

double f(double F, double B, double x) {
        double r1552409 = F;
        double r1552410 = -5.495021983986923e+84;
        bool r1552411 = r1552409 <= r1552410;
        double r1552412 = 0.5;
        double r1552413 = sqrt(r1552412);
        double r1552414 = 0.125;
        double r1552415 = sqrt(r1552414);
        double r1552416 = x;
        double r1552417 = r1552415 * r1552416;
        double r1552418 = r1552413 - r1552417;
        double r1552419 = r1552418 * r1552409;
        double r1552420 = r1552412 * r1552409;
        double r1552421 = r1552420 * r1552420;
        double r1552422 = r1552419 - r1552421;
        double r1552423 = expm1(r1552422);
        double r1552424 = B;
        double r1552425 = sin(r1552424);
        double r1552426 = r1552423 / r1552425;
        double r1552427 = tan(r1552424);
        double r1552428 = r1552416 / r1552427;
        double r1552429 = r1552426 - r1552428;
        double r1552430 = 2.0;
        double r1552431 = fma(r1552409, r1552409, r1552430);
        double r1552432 = fma(r1552430, r1552416, r1552431);
        double r1552433 = -0.5;
        double r1552434 = pow(r1552432, r1552433);
        double r1552435 = r1552409 * r1552434;
        double r1552436 = log1p(r1552435);
        double r1552437 = expm1(r1552436);
        double r1552438 = r1552437 / r1552425;
        double r1552439 = r1552438 - r1552428;
        double r1552440 = r1552411 ? r1552429 : r1552439;
        return r1552440;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if F < -5.495021983986923e+84

    1. Initial program 31.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. Simplified31.4

      \[\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/25.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-u25.5

      \[\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 9.4

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

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

    if -5.495021983986923e+84 < F

    1. Initial program 8.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. Simplified8.5

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

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

      \[\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}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification7.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -5.495021983986923 \cdot 10^{+84}:\\ \;\;\;\;\frac{\mathsf{expm1}\left(\left(\sqrt{\frac{1}{2}} - \sqrt{\frac{1}{8}} \cdot x\right) \cdot F - \left(\frac{1}{2} \cdot F\right) \cdot \left(\frac{1}{2} \cdot F\right)\right)}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\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)}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]

Reproduce

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