Average Error: 0.2 → 0.2
Time: 7.0m
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
\[\frac{1}{\sin B} - \frac{x}{\sin B} \cdot \cos B\]
double f(double B, double x) {
        double r8699997 = x;
        double r8699998 = 1.0;
        double r8699999 = B;
        double r8700000 = tan(r8699999);
        double r8700001 = r8699998 / r8700000;
        double r8700002 = r8699997 * r8700001;
        double r8700003 = -r8700002;
        double r8700004 = sin(r8699999);
        double r8700005 = r8699998 / r8700004;
        double r8700006 = r8700003 + r8700005;
        return r8700006;
}

double f(double B, double x) {
        double r8700007 = 1.0;
        double r8700008 = B;
        double r8700009 = sin(r8700008);
        double r8700010 = r8700007 / r8700009;
        double r8700011 = x;
        double r8700012 = r8700011 / r8700009;
        double r8700013 = cos(r8700008);
        double r8700014 = r8700012 * r8700013;
        double r8700015 = r8700010 - r8700014;
        return r8700015;
}

\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\frac{1}{\sin B} - \frac{x}{\sin B} \cdot \cos B

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. Simplified0.1

    \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}}\]
  3. Using strategy rm
  4. Applied tan-quot0.2

    \[\leadsto \frac{1}{\sin B} - \frac{x}{\color{blue}{\frac{\sin B}{\cos B}}}\]
  5. Applied associate-/r/0.2

    \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{x}{\sin B} \cdot \cos B}\]
  6. Final simplification0.2

    \[\leadsto \frac{1}{\sin B} - \frac{x}{\sin B} \cdot \cos B\]

Reproduce

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