Average Error: 13.5 → 7.6
Time: 35.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 -7.71339148553278 \cdot 10^{+170}:\\ \;\;\;\;\frac{\mathsf{expm1}\left(\left(\sqrt{\frac{1}{2}} - x \cdot \sqrt{\frac{1}{8}}\right) \cdot F - \left(\frac{1}{2} \cdot \left(F \cdot F\right)\right) \cdot \frac{1}{2}\right)}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\frac{-1}{2}}\right)\right)}{\sin B} - \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 -7.71339148553278 \cdot 10^{+170}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(\left(\sqrt{\frac{1}{2}} - x \cdot \sqrt{\frac{1}{8}}\right) \cdot F - \left(\frac{1}{2} \cdot \left(F \cdot F\right)\right) \cdot \frac{1}{2}\right)}{\sin B} - \frac{x}{\tan B}\\

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

\end{array}
double f(double F, double B, double x) {
        double r701281 = x;
        double r701282 = 1.0;
        double r701283 = B;
        double r701284 = tan(r701283);
        double r701285 = r701282 / r701284;
        double r701286 = r701281 * r701285;
        double r701287 = -r701286;
        double r701288 = F;
        double r701289 = sin(r701283);
        double r701290 = r701288 / r701289;
        double r701291 = r701288 * r701288;
        double r701292 = 2.0;
        double r701293 = r701291 + r701292;
        double r701294 = r701292 * r701281;
        double r701295 = r701293 + r701294;
        double r701296 = r701282 / r701292;
        double r701297 = -r701296;
        double r701298 = pow(r701295, r701297);
        double r701299 = r701290 * r701298;
        double r701300 = r701287 + r701299;
        return r701300;
}

double f(double F, double B, double x) {
        double r701301 = F;
        double r701302 = -7.71339148553278e+170;
        bool r701303 = r701301 <= r701302;
        double r701304 = 0.5;
        double r701305 = sqrt(r701304);
        double r701306 = x;
        double r701307 = 0.125;
        double r701308 = sqrt(r701307);
        double r701309 = r701306 * r701308;
        double r701310 = r701305 - r701309;
        double r701311 = r701310 * r701301;
        double r701312 = r701301 * r701301;
        double r701313 = r701304 * r701312;
        double r701314 = r701313 * r701304;
        double r701315 = r701311 - r701314;
        double r701316 = expm1(r701315);
        double r701317 = B;
        double r701318 = sin(r701317);
        double r701319 = r701316 / r701318;
        double r701320 = tan(r701317);
        double r701321 = r701306 / r701320;
        double r701322 = r701319 - r701321;
        double r701323 = 2.0;
        double r701324 = fma(r701301, r701301, r701323);
        double r701325 = fma(r701306, r701323, r701324);
        double r701326 = -0.5;
        double r701327 = pow(r701325, r701326);
        double r701328 = r701301 * r701327;
        double r701329 = log1p(r701328);
        double r701330 = expm1(r701329);
        double r701331 = r701330 / r701318;
        double r701332 = r701331 - r701321;
        double r701333 = r701303 ? r701322 : r701332;
        return r701333;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if F < -7.71339148553278e+170

    1. Initial program 40.3

      \[\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. Simplified40.2

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

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\frac{-1}{2}} \cdot F}{\sin B}} - \frac{x}{\tan B}\]
    5. Using strategy rm
    6. Applied expm1-log1p-u35.7

      \[\leadsto \frac{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\frac{-1}{2}} \cdot F\right)\right)}}{\sin B} - \frac{x}{\tan B}\]
    7. Taylor expanded around 0 9.3

      \[\leadsto \frac{\mathsf{expm1}\left(\color{blue}{F \cdot \sqrt{\frac{1}{2}} - \left(x \cdot \left(F \cdot \sqrt{\frac{1}{8}}\right) + \frac{1}{2} \cdot \left({F}^{2} \cdot {\left(\sqrt{\frac{1}{2}}\right)}^{2}\right)\right)}\right)}{\sin B} - \frac{x}{\tan B}\]
    8. Simplified9.3

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

    if -7.71339148553278e+170 < F

    1. Initial program 9.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. Simplified9.4

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

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

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

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

Reproduce

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