Average Error: 0.2 → 0.1
Time: 6.5s
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
\[0 - \mathsf{fma}\left(\frac{x}{\tan B}, 1, -\frac{1}{\sin B}\right)\]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
0 - \mathsf{fma}\left(\frac{x}{\tan B}, 1, -\frac{1}{\sin B}\right)
double f(double B, double x) {
        double r14858 = x;
        double r14859 = 1.0;
        double r14860 = B;
        double r14861 = tan(r14860);
        double r14862 = r14859 / r14861;
        double r14863 = r14858 * r14862;
        double r14864 = -r14863;
        double r14865 = sin(r14860);
        double r14866 = r14859 / r14865;
        double r14867 = r14864 + r14866;
        return r14867;
}

double f(double B, double x) {
        double r14868 = 0.0;
        double r14869 = x;
        double r14870 = B;
        double r14871 = tan(r14870);
        double r14872 = r14869 / r14871;
        double r14873 = 1.0;
        double r14874 = sin(r14870);
        double r14875 = r14873 / r14874;
        double r14876 = -r14875;
        double r14877 = fma(r14872, r14873, r14876);
        double r14878 = r14868 - r14877;
        return r14878;
}

Error

Bits error versus B

Bits error versus x

Derivation

  1. Initial program 0.2

    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
  2. Using strategy rm
  3. Applied associate-*r/0.1

    \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{1}{\sin B}\]
  4. Using strategy rm
  5. Applied clear-num0.2

    \[\leadsto \left(-\color{blue}{\frac{1}{\frac{\tan B}{x \cdot 1}}}\right) + \frac{1}{\sin B}\]
  6. Using strategy rm
  7. Applied neg-sub00.2

    \[\leadsto \color{blue}{\left(0 - \frac{1}{\frac{\tan B}{x \cdot 1}}\right)} + \frac{1}{\sin B}\]
  8. Applied associate-+l-0.2

    \[\leadsto \color{blue}{0 - \left(\frac{1}{\frac{\tan B}{x \cdot 1}} - \frac{1}{\sin B}\right)}\]
  9. Simplified0.1

    \[\leadsto 0 - \color{blue}{\mathsf{fma}\left(\frac{x}{\tan B}, 1, -\frac{1}{\sin B}\right)}\]
  10. Final simplification0.1

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

Reproduce

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