Average Error: 13.3 → 10.2
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)}\]
\[\frac{{\left(\mathsf{fma}\left(2, x, \left(\mathsf{fma}\left(F, F, 2\right)\right)\right)\right)}^{\frac{-1}{2}} \cdot F}{\sin B} - \frac{x}{\sin B} \cdot \cos 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(\mathsf{fma}\left(2, x, \left(\mathsf{fma}\left(F, F, 2\right)\right)\right)\right)}^{\frac{-1}{2}} \cdot F}{\sin B} - \frac{x}{\sin B} \cdot \cos B
double f(double F, double B, double x) {
        double r1499769 = x;
        double r1499770 = 1.0;
        double r1499771 = B;
        double r1499772 = tan(r1499771);
        double r1499773 = r1499770 / r1499772;
        double r1499774 = r1499769 * r1499773;
        double r1499775 = -r1499774;
        double r1499776 = F;
        double r1499777 = sin(r1499771);
        double r1499778 = r1499776 / r1499777;
        double r1499779 = r1499776 * r1499776;
        double r1499780 = 2.0;
        double r1499781 = r1499779 + r1499780;
        double r1499782 = r1499780 * r1499769;
        double r1499783 = r1499781 + r1499782;
        double r1499784 = r1499770 / r1499780;
        double r1499785 = -r1499784;
        double r1499786 = pow(r1499783, r1499785);
        double r1499787 = r1499778 * r1499786;
        double r1499788 = r1499775 + r1499787;
        return r1499788;
}

double f(double F, double B, double x) {
        double r1499789 = 2.0;
        double r1499790 = x;
        double r1499791 = F;
        double r1499792 = fma(r1499791, r1499791, r1499789);
        double r1499793 = fma(r1499789, r1499790, r1499792);
        double r1499794 = -0.5;
        double r1499795 = pow(r1499793, r1499794);
        double r1499796 = r1499795 * r1499791;
        double r1499797 = B;
        double r1499798 = sin(r1499797);
        double r1499799 = r1499796 / r1499798;
        double r1499800 = r1499790 / r1499798;
        double r1499801 = cos(r1499797);
        double r1499802 = r1499800 * r1499801;
        double r1499803 = r1499799 - r1499802;
        return r1499803;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Initial program 13.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. Simplified13.2

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

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

    \[\leadsto \frac{{\left(\mathsf{fma}\left(2, x, \left(\mathsf{fma}\left(F, F, 2\right)\right)\right)\right)}^{\frac{-1}{2}} \cdot F}{\sin B} - \frac{x}{\color{blue}{\frac{\sin B}{\cos B}}}\]
  7. Applied associate-/r/10.2

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

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

Reproduce

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