Average Error: 14.4 → 0.3
Time: 39.1s
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 -43148.54865461154258809983730316162109375:\\ \;\;\;\;\mathsf{fma}\left(\frac{-1}{\tan B}, x, \frac{\frac{1}{F \cdot F} + -1}{\sin B}\right)\\ \mathbf{elif}\;F \le 46346400992546841952256:\\ \;\;\;\;\mathsf{fma}\left(\frac{\cos B}{\sin B} \cdot -1, 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 - \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 -43148.54865461154258809983730316162109375:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{\tan B}, x, \frac{\frac{1}{F \cdot F} + -1}{\sin B}\right)\\

\mathbf{elif}\;F \le 46346400992546841952256:\\
\;\;\;\;\mathsf{fma}\left(\frac{\cos B}{\sin B} \cdot -1, 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 - \frac{1}{F \cdot F}}{\sin B}\right)\\

\end{array}
double f(double F, double B, double x) {
        double r2055126 = x;
        double r2055127 = 1.0;
        double r2055128 = B;
        double r2055129 = tan(r2055128);
        double r2055130 = r2055127 / r2055129;
        double r2055131 = r2055126 * r2055130;
        double r2055132 = -r2055131;
        double r2055133 = F;
        double r2055134 = sin(r2055128);
        double r2055135 = r2055133 / r2055134;
        double r2055136 = r2055133 * r2055133;
        double r2055137 = 2.0;
        double r2055138 = r2055136 + r2055137;
        double r2055139 = r2055137 * r2055126;
        double r2055140 = r2055138 + r2055139;
        double r2055141 = r2055127 / r2055137;
        double r2055142 = -r2055141;
        double r2055143 = pow(r2055140, r2055142);
        double r2055144 = r2055135 * r2055143;
        double r2055145 = r2055132 + r2055144;
        return r2055145;
}

double f(double F, double B, double x) {
        double r2055146 = F;
        double r2055147 = -43148.54865461154;
        bool r2055148 = r2055146 <= r2055147;
        double r2055149 = 1.0;
        double r2055150 = -r2055149;
        double r2055151 = B;
        double r2055152 = tan(r2055151);
        double r2055153 = r2055150 / r2055152;
        double r2055154 = x;
        double r2055155 = r2055146 * r2055146;
        double r2055156 = r2055149 / r2055155;
        double r2055157 = -1.0;
        double r2055158 = r2055156 + r2055157;
        double r2055159 = sin(r2055151);
        double r2055160 = r2055158 / r2055159;
        double r2055161 = fma(r2055153, r2055154, r2055160);
        double r2055162 = 4.634640099254684e+22;
        bool r2055163 = r2055146 <= r2055162;
        double r2055164 = cos(r2055151);
        double r2055165 = r2055164 / r2055159;
        double r2055166 = -1.0;
        double r2055167 = r2055165 * r2055166;
        double r2055168 = r2055146 / r2055159;
        double r2055169 = 2.0;
        double r2055170 = fma(r2055154, r2055169, r2055169);
        double r2055171 = fma(r2055146, r2055146, r2055170);
        double r2055172 = r2055150 / r2055169;
        double r2055173 = pow(r2055171, r2055172);
        double r2055174 = r2055168 * r2055173;
        double r2055175 = fma(r2055167, r2055154, r2055174);
        double r2055176 = 1.0;
        double r2055177 = r2055176 - r2055156;
        double r2055178 = r2055177 / r2055159;
        double r2055179 = fma(r2055153, r2055154, r2055178);
        double r2055180 = r2055163 ? r2055175 : r2055179;
        double r2055181 = r2055148 ? r2055161 : r2055180;
        return r2055181;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

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

    1. Initial program 26.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. Simplified26.0

      \[\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 associate-*r/19.9

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

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

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

    if -43148.54865461154 < F < 4.634640099254684e+22

    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 4.634640099254684e+22 < F

    1. Initial program 26.9

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

      \[\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 associate-*r/21.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -43148.54865461154258809983730316162109375:\\ \;\;\;\;\mathsf{fma}\left(\frac{-1}{\tan B}, x, \frac{\frac{1}{F \cdot F} + -1}{\sin B}\right)\\ \mathbf{elif}\;F \le 46346400992546841952256:\\ \;\;\;\;\mathsf{fma}\left(\frac{\cos B}{\sin B} \cdot -1, 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 - \frac{1}{F \cdot F}}{\sin B}\right)\\ \end{array}\]

Reproduce

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