Average Error: 13.3 → 0.4
Time: 50.5s
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 -2.048028622360406 \cdot 10^{+25}:\\ \;\;\;\;\left(\frac{\frac{1}{F \cdot F}}{\sin B} - \frac{1}{\sin B}\right) - \frac{x}{\tan B}\\ \mathbf{elif}\;F \le 0.0010356528232137428:\\ \;\;\;\;\frac{F}{\frac{\sin B}{{\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}}} \cdot \frac{1}{{\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}}}} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - \frac{\frac{1}{F \cdot F}}{\sin B}\right) - \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 -2.048028622360406 \cdot 10^{+25}:\\
\;\;\;\;\left(\frac{\frac{1}{F \cdot F}}{\sin B} - \frac{1}{\sin B}\right) - \frac{x}{\tan B}\\

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

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

\end{array}
double f(double F, double B, double x) {
        double r1849389 = x;
        double r1849390 = 1.0;
        double r1849391 = B;
        double r1849392 = tan(r1849391);
        double r1849393 = r1849390 / r1849392;
        double r1849394 = r1849389 * r1849393;
        double r1849395 = -r1849394;
        double r1849396 = F;
        double r1849397 = sin(r1849391);
        double r1849398 = r1849396 / r1849397;
        double r1849399 = r1849396 * r1849396;
        double r1849400 = 2.0;
        double r1849401 = r1849399 + r1849400;
        double r1849402 = r1849400 * r1849389;
        double r1849403 = r1849401 + r1849402;
        double r1849404 = r1849390 / r1849400;
        double r1849405 = -r1849404;
        double r1849406 = pow(r1849403, r1849405);
        double r1849407 = r1849398 * r1849406;
        double r1849408 = r1849395 + r1849407;
        return r1849408;
}

double f(double F, double B, double x) {
        double r1849409 = F;
        double r1849410 = -2.048028622360406e+25;
        bool r1849411 = r1849409 <= r1849410;
        double r1849412 = 1.0;
        double r1849413 = r1849409 * r1849409;
        double r1849414 = r1849412 / r1849413;
        double r1849415 = B;
        double r1849416 = sin(r1849415);
        double r1849417 = r1849414 / r1849416;
        double r1849418 = r1849412 / r1849416;
        double r1849419 = r1849417 - r1849418;
        double r1849420 = x;
        double r1849421 = tan(r1849415);
        double r1849422 = r1849420 / r1849421;
        double r1849423 = r1849419 - r1849422;
        double r1849424 = 0.0010356528232137428;
        bool r1849425 = r1849409 <= r1849424;
        double r1849426 = 2.0;
        double r1849427 = fma(r1849409, r1849409, r1849426);
        double r1849428 = fma(r1849426, r1849420, r1849427);
        double r1849429 = sqrt(r1849428);
        double r1849430 = -0.5;
        double r1849431 = pow(r1849429, r1849430);
        double r1849432 = r1849416 / r1849431;
        double r1849433 = r1849412 / r1849431;
        double r1849434 = r1849432 * r1849433;
        double r1849435 = r1849409 / r1849434;
        double r1849436 = r1849435 - r1849422;
        double r1849437 = r1849418 - r1849417;
        double r1849438 = r1849437 - r1849422;
        double r1849439 = r1849425 ? r1849436 : r1849438;
        double r1849440 = r1849411 ? r1849423 : r1849439;
        return r1849440;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if F < -2.048028622360406e+25

    1. Initial program 25.0

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

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

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

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

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

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

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

    if -2.048028622360406e+25 < F < 0.0010356528232137428

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

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

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

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

      \[\leadsto \frac{\color{blue}{F}}{\frac{\sin B}{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\frac{-1}{2}}}} - \frac{x}{\tan B}\]
    8. Using strategy rm
    9. Applied add-sqr-sqrt0.3

      \[\leadsto \frac{F}{\frac{\sin B}{{\color{blue}{\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}}^{\frac{-1}{2}}}} - \frac{x}{\tan B}\]
    10. Applied unpow-prod-down0.3

      \[\leadsto \frac{F}{\frac{\sin B}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}}}}} - \frac{x}{\tan B}\]
    11. Applied *-un-lft-identity0.3

      \[\leadsto \frac{F}{\frac{\color{blue}{1 \cdot \sin B}}{{\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}}}} - \frac{x}{\tan B}\]
    12. Applied times-frac0.3

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

    if 0.0010356528232137428 < F

    1. Initial program 24.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. Simplified19.1

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

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

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

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

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

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

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

Reproduce

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