Average Error: 13.6 → 0.3
Time: 38.6s
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 -29785009876925.47265625:\\ \;\;\;\;\mathsf{fma}\left(\frac{-1}{\tan B}, x, \frac{-1}{\sin B} + \frac{\frac{1}{\sin B}}{F \cdot F}\right)\\ \mathbf{elif}\;F \le 5611841369517.248046875:\\ \;\;\;\;\mathsf{fma}\left(\frac{\cos B}{\sin B} \cdot -1, x, {\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(x, 2, 2\right)\right)\right)}^{\left(-\frac{1}{2}\right)} \cdot \frac{F}{\sin B}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-1}{\tan B}, x, \frac{1}{\sin B} - \frac{\frac{1}{\sin B}}{F \cdot F}\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 -29785009876925.47265625:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{\tan B}, x, \frac{-1}{\sin B} + \frac{\frac{1}{\sin B}}{F \cdot F}\right)\\

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

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

\end{array}
double f(double F, double B, double x) {
        double r1851647 = x;
        double r1851648 = 1.0;
        double r1851649 = B;
        double r1851650 = tan(r1851649);
        double r1851651 = r1851648 / r1851650;
        double r1851652 = r1851647 * r1851651;
        double r1851653 = -r1851652;
        double r1851654 = F;
        double r1851655 = sin(r1851649);
        double r1851656 = r1851654 / r1851655;
        double r1851657 = r1851654 * r1851654;
        double r1851658 = 2.0;
        double r1851659 = r1851657 + r1851658;
        double r1851660 = r1851658 * r1851647;
        double r1851661 = r1851659 + r1851660;
        double r1851662 = r1851648 / r1851658;
        double r1851663 = -r1851662;
        double r1851664 = pow(r1851661, r1851663);
        double r1851665 = r1851656 * r1851664;
        double r1851666 = r1851653 + r1851665;
        return r1851666;
}

double f(double F, double B, double x) {
        double r1851667 = F;
        double r1851668 = -29785009876925.473;
        bool r1851669 = r1851667 <= r1851668;
        double r1851670 = 1.0;
        double r1851671 = -r1851670;
        double r1851672 = B;
        double r1851673 = tan(r1851672);
        double r1851674 = r1851671 / r1851673;
        double r1851675 = x;
        double r1851676 = -1.0;
        double r1851677 = sin(r1851672);
        double r1851678 = r1851676 / r1851677;
        double r1851679 = r1851670 / r1851677;
        double r1851680 = r1851667 * r1851667;
        double r1851681 = r1851679 / r1851680;
        double r1851682 = r1851678 + r1851681;
        double r1851683 = fma(r1851674, r1851675, r1851682);
        double r1851684 = 5611841369517.248;
        bool r1851685 = r1851667 <= r1851684;
        double r1851686 = cos(r1851672);
        double r1851687 = r1851686 / r1851677;
        double r1851688 = -1.0;
        double r1851689 = r1851687 * r1851688;
        double r1851690 = 2.0;
        double r1851691 = fma(r1851675, r1851690, r1851690);
        double r1851692 = fma(r1851667, r1851667, r1851691);
        double r1851693 = r1851670 / r1851690;
        double r1851694 = -r1851693;
        double r1851695 = pow(r1851692, r1851694);
        double r1851696 = r1851667 / r1851677;
        double r1851697 = r1851695 * r1851696;
        double r1851698 = fma(r1851689, r1851675, r1851697);
        double r1851699 = 1.0;
        double r1851700 = r1851699 / r1851677;
        double r1851701 = r1851700 - r1851681;
        double r1851702 = fma(r1851674, r1851675, r1851701);
        double r1851703 = r1851685 ? r1851698 : r1851702;
        double r1851704 = r1851669 ? r1851683 : r1851703;
        return r1851704;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

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

    1. Initial program 25.5

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

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

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

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

    if -29785009876925.473 < F < 5611841369517.248

    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{-1}{\tan B}, x, {\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(x, 2, 2\right)\right)\right)}^{\left(\frac{-1}{2}\right)} \cdot \frac{F}{\sin B}\right)}\]
    3. Taylor expanded around inf 0.4

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

    if 5611841369517.248 < F

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

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

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

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

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

Reproduce

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