Average Error: 13.6 → 13.5
Time: 31.9s
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)}\]
\[\mathsf{fma}\left({\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-1\right)}\right)}^{\left(\frac{1}{2}\right)}, \frac{F}{\sin B}, -\frac{x \cdot 1}{\tan B}\right)\]
\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)}
\mathsf{fma}\left({\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-1\right)}\right)}^{\left(\frac{1}{2}\right)}, \frac{F}{\sin B}, -\frac{x \cdot 1}{\tan B}\right)
double f(double F, double B, double x) {
        double r54994 = x;
        double r54995 = 1.0;
        double r54996 = B;
        double r54997 = tan(r54996);
        double r54998 = r54995 / r54997;
        double r54999 = r54994 * r54998;
        double r55000 = -r54999;
        double r55001 = F;
        double r55002 = sin(r54996);
        double r55003 = r55001 / r55002;
        double r55004 = r55001 * r55001;
        double r55005 = 2.0;
        double r55006 = r55004 + r55005;
        double r55007 = r55005 * r54994;
        double r55008 = r55006 + r55007;
        double r55009 = r54995 / r55005;
        double r55010 = -r55009;
        double r55011 = pow(r55008, r55010);
        double r55012 = r55003 * r55011;
        double r55013 = r55000 + r55012;
        return r55013;
}

double f(double F, double B, double x) {
        double r55014 = 2.0;
        double r55015 = x;
        double r55016 = F;
        double r55017 = fma(r55016, r55016, r55014);
        double r55018 = fma(r55014, r55015, r55017);
        double r55019 = 1.0;
        double r55020 = -r55019;
        double r55021 = pow(r55018, r55020);
        double r55022 = 1.0;
        double r55023 = r55022 / r55014;
        double r55024 = pow(r55021, r55023);
        double r55025 = B;
        double r55026 = sin(r55025);
        double r55027 = r55016 / r55026;
        double r55028 = r55015 * r55019;
        double r55029 = tan(r55025);
        double r55030 = r55028 / r55029;
        double r55031 = -r55030;
        double r55032 = fma(r55024, r55027, r55031);
        return r55032;
}

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.6

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

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

    \[\leadsto \mathsf{fma}\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-\color{blue}{1 \cdot \frac{1}{2}}\right)}, \frac{F}{\sin B}, -\frac{x \cdot 1}{\tan B}\right)\]
  7. Applied distribute-lft-neg-in13.5

    \[\leadsto \mathsf{fma}\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\color{blue}{\left(\left(-1\right) \cdot \frac{1}{2}\right)}}, \frac{F}{\sin B}, -\frac{x \cdot 1}{\tan B}\right)\]
  8. Applied pow-unpow13.5

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

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

Reproduce

herbie shell --seed 2019208 +o rules:numerics
(FPCore (F B x)
  :name "VandenBroeck and Keller, Equation (23)"
  :precision binary64
  (+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2))))))