Average Error: 13.6 → 10.6
Time: 32.8s
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)}\]
\[\frac{{\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}} \cdot \left({\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}} \cdot F\right)}{\sin B} - \frac{x}{\tan B}\]
\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)}
\frac{{\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}} \cdot \left({\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}} \cdot F\right)}{\sin B} - \frac{x}{\tan B}
double f(double F, double B, double x) {
        double r1951254 = x;
        double r1951255 = 1.0;
        double r1951256 = B;
        double r1951257 = tan(r1951256);
        double r1951258 = r1951255 / r1951257;
        double r1951259 = r1951254 * r1951258;
        double r1951260 = -r1951259;
        double r1951261 = F;
        double r1951262 = sin(r1951256);
        double r1951263 = r1951261 / r1951262;
        double r1951264 = r1951261 * r1951261;
        double r1951265 = 2.0;
        double r1951266 = r1951264 + r1951265;
        double r1951267 = r1951265 * r1951254;
        double r1951268 = r1951266 + r1951267;
        double r1951269 = r1951255 / r1951265;
        double r1951270 = -r1951269;
        double r1951271 = pow(r1951268, r1951270);
        double r1951272 = r1951263 * r1951271;
        double r1951273 = r1951260 + r1951272;
        return r1951273;
}

double f(double F, double B, double x) {
        double r1951274 = 2.0;
        double r1951275 = x;
        double r1951276 = F;
        double r1951277 = fma(r1951276, r1951276, r1951274);
        double r1951278 = fma(r1951274, r1951275, r1951277);
        double r1951279 = sqrt(r1951278);
        double r1951280 = -0.5;
        double r1951281 = pow(r1951279, r1951280);
        double r1951282 = r1951281 * r1951276;
        double r1951283 = r1951281 * r1951282;
        double r1951284 = B;
        double r1951285 = sin(r1951284);
        double r1951286 = r1951283 / r1951285;
        double r1951287 = tan(r1951284);
        double r1951288 = r1951275 / r1951287;
        double r1951289 = r1951286 - r1951288;
        return r1951289;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Initial program 13.6

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

    \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(2, x, \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/10.5

    \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(2, x, \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 add-sqr-sqrt10.5

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

    \[\leadsto \frac{\color{blue}{\left({\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}}\right)} \cdot F}{\sin B} - \frac{x}{\tan B}\]
  8. Applied associate-*l*10.6

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

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

Reproduce

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