Average Error: 13.8 → 0.6
Time: 12.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 -1.514749380973243 \cdot 10^{125}:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{1}{\sin B} \cdot \frac{F}{\mathsf{fma}\left({\left(\frac{1}{{-1}^{1} \cdot {F}^{1}}\right)}^{1}, 1, {\left(\frac{-1}{F}\right)}^{-1}\right)}\\ \mathbf{elif}\;F \le 19373.4447765834666:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{\frac{F}{\sin B}}{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \left(\frac{1}{\sin B} - 1 \cdot \frac{1}{\sin B \cdot {F}^{2}}\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 -1.514749380973243 \cdot 10^{125}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{1}{\sin B} \cdot \frac{F}{\mathsf{fma}\left({\left(\frac{1}{{-1}^{1} \cdot {F}^{1}}\right)}^{1}, 1, {\left(\frac{-1}{F}\right)}^{-1}\right)}\\

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

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

\end{array}
double f(double F, double B, double x) {
        double r40409 = x;
        double r40410 = 1.0;
        double r40411 = B;
        double r40412 = tan(r40411);
        double r40413 = r40410 / r40412;
        double r40414 = r40409 * r40413;
        double r40415 = -r40414;
        double r40416 = F;
        double r40417 = sin(r40411);
        double r40418 = r40416 / r40417;
        double r40419 = r40416 * r40416;
        double r40420 = 2.0;
        double r40421 = r40419 + r40420;
        double r40422 = r40420 * r40409;
        double r40423 = r40421 + r40422;
        double r40424 = r40410 / r40420;
        double r40425 = -r40424;
        double r40426 = pow(r40423, r40425);
        double r40427 = r40418 * r40426;
        double r40428 = r40415 + r40427;
        return r40428;
}

double f(double F, double B, double x) {
        double r40429 = F;
        double r40430 = -1.514749380973243e+125;
        bool r40431 = r40429 <= r40430;
        double r40432 = x;
        double r40433 = 1.0;
        double r40434 = r40432 * r40433;
        double r40435 = B;
        double r40436 = tan(r40435);
        double r40437 = r40434 / r40436;
        double r40438 = -r40437;
        double r40439 = 1.0;
        double r40440 = sin(r40435);
        double r40441 = r40439 / r40440;
        double r40442 = -1.0;
        double r40443 = pow(r40442, r40433);
        double r40444 = pow(r40429, r40433);
        double r40445 = r40443 * r40444;
        double r40446 = r40439 / r40445;
        double r40447 = pow(r40446, r40433);
        double r40448 = r40442 / r40429;
        double r40449 = -1.0;
        double r40450 = pow(r40448, r40449);
        double r40451 = fma(r40447, r40433, r40450);
        double r40452 = r40429 / r40451;
        double r40453 = r40441 * r40452;
        double r40454 = r40438 + r40453;
        double r40455 = 19373.444776583467;
        bool r40456 = r40429 <= r40455;
        double r40457 = r40429 / r40440;
        double r40458 = r40429 * r40429;
        double r40459 = 2.0;
        double r40460 = r40458 + r40459;
        double r40461 = r40459 * r40432;
        double r40462 = r40460 + r40461;
        double r40463 = r40433 / r40459;
        double r40464 = pow(r40462, r40463);
        double r40465 = r40457 / r40464;
        double r40466 = r40438 + r40465;
        double r40467 = 2.0;
        double r40468 = pow(r40429, r40467);
        double r40469 = r40440 * r40468;
        double r40470 = r40439 / r40469;
        double r40471 = r40433 * r40470;
        double r40472 = r40441 - r40471;
        double r40473 = r40438 + r40472;
        double r40474 = r40456 ? r40466 : r40473;
        double r40475 = r40431 ? r40454 : r40474;
        return r40475;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if F < -1.514749380973243e+125

    1. Initial program 36.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. Using strategy rm
    3. Applied pow-neg36.1

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

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{\color{blue}{F}}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\]
    6. Using strategy rm
    7. Applied associate-*r/30.1

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 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)}}\]
    8. Using strategy rm
    9. Applied *-un-lft-identity30.1

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

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

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

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

    if -1.514749380973243e+125 < F < 19373.444776583467

    1. Initial program 1.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. Using strategy rm
    3. Applied pow-neg1.1

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

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

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

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 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)}}\]
    8. Using strategy rm
    9. Applied associate-/r*0.9

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

    if 19373.444776583467 < F

    1. Initial program 25.8

      \[\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. Using strategy rm
    3. Applied pow-neg25.8

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

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{\color{blue}{F}}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\]
    6. Using strategy rm
    7. Applied associate-*r/20.1

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 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)}}\]
    8. Taylor expanded around inf 0.1

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

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

Reproduce

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