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

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

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

\end{array}
double f(double F, double B, double x) {
        double r2149189 = x;
        double r2149190 = 1.0;
        double r2149191 = B;
        double r2149192 = tan(r2149191);
        double r2149193 = r2149190 / r2149192;
        double r2149194 = r2149189 * r2149193;
        double r2149195 = -r2149194;
        double r2149196 = F;
        double r2149197 = sin(r2149191);
        double r2149198 = r2149196 / r2149197;
        double r2149199 = r2149196 * r2149196;
        double r2149200 = 2.0;
        double r2149201 = r2149199 + r2149200;
        double r2149202 = r2149200 * r2149189;
        double r2149203 = r2149201 + r2149202;
        double r2149204 = r2149190 / r2149200;
        double r2149205 = -r2149204;
        double r2149206 = pow(r2149203, r2149205);
        double r2149207 = r2149198 * r2149206;
        double r2149208 = r2149195 + r2149207;
        return r2149208;
}

double f(double F, double B, double x) {
        double r2149209 = F;
        double r2149210 = -1011.2161346004847;
        bool r2149211 = r2149209 <= r2149210;
        double r2149212 = 1.0;
        double r2149213 = -r2149212;
        double r2149214 = B;
        double r2149215 = tan(r2149214);
        double r2149216 = r2149213 / r2149215;
        double r2149217 = x;
        double r2149218 = -1.0;
        double r2149219 = sin(r2149214);
        double r2149220 = r2149218 / r2149219;
        double r2149221 = r2149209 * r2149209;
        double r2149222 = r2149212 / r2149221;
        double r2149223 = r2149222 / r2149219;
        double r2149224 = r2149220 + r2149223;
        double r2149225 = fma(r2149216, r2149217, r2149224);
        double r2149226 = 4.890764603747723;
        bool r2149227 = r2149209 <= r2149226;
        double r2149228 = r2149212 / r2149219;
        double r2149229 = -r2149228;
        double r2149230 = cos(r2149214);
        double r2149231 = r2149229 * r2149230;
        double r2149232 = r2149209 / r2149219;
        double r2149233 = 2.0;
        double r2149234 = fma(r2149217, r2149233, r2149233);
        double r2149235 = fma(r2149209, r2149209, r2149234);
        double r2149236 = r2149213 / r2149233;
        double r2149237 = pow(r2149235, r2149236);
        double r2149238 = r2149232 * r2149237;
        double r2149239 = fma(r2149231, r2149217, r2149238);
        double r2149240 = 1.0;
        double r2149241 = r2149240 / r2149219;
        double r2149242 = r2149241 - r2149223;
        double r2149243 = fma(r2149216, r2149217, r2149242);
        double r2149244 = r2149227 ? r2149239 : r2149243;
        double r2149245 = r2149211 ? r2149225 : r2149244;
        return r2149245;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

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

    1. Initial program 25.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. Simplified25.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. Using strategy rm
    4. Applied div-inv25.4

      \[\leadsto \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 \color{blue}{\left(F \cdot \frac{1}{\sin B}\right)}\right)\]
    5. Applied associate-*r*19.9

      \[\leadsto \mathsf{fma}\left(\frac{-1}{\tan B}, x, \color{blue}{\left({\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(x, 2, 2\right)\right)\right)}^{\left(\frac{-1}{2}\right)} \cdot F\right) \cdot \frac{1}{\sin B}}\right)\]
    6. 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)\]
    7. Simplified0.2

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

    if -1011.2161346004847 < F < 4.890764603747723

    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. Using strategy rm
    4. Applied tan-quot0.4

      \[\leadsto \mathsf{fma}\left(\frac{-1}{\color{blue}{\frac{\sin B}{\cos 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)\]
    5. Applied associate-/r/0.4

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{\sin B} \cdot \cos 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 4.890764603747723 < F

    1. Initial program 23.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. Simplified23.3

      \[\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(\frac{-1}{\tan B}, x, \color{blue}{\frac{1}{\sin B} - 1 \cdot \frac{1}{{F}^{2} \cdot \sin B}}\right)\]
    4. Simplified0.4

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

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

Reproduce

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