Average Error: 0.2 → 0.2
Time: 7.2m
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 r7354496 = x;
        double r7354497 = 1.0;
        double r7354498 = B;
        double r7354499 = tan(r7354498);
        double r7354500 = r7354497 / r7354499;
        double r7354501 = r7354496 * r7354500;
        double r7354502 = -r7354501;
        double r7354503 = sin(r7354498);
        double r7354504 = r7354497 / r7354503;
        double r7354505 = r7354502 + r7354504;
        return r7354505;
}

double f(double B, double x) {
        double r7354506 = 1.0;
        double r7354507 = B;
        double r7354508 = sin(r7354507);
        double r7354509 = r7354506 / r7354508;
        double r7354510 = x;
        double r7354511 = r7354510 / r7354508;
        double r7354512 = cos(r7354507);
        double r7354513 = r7354511 * r7354512;
        double r7354514 = r7354509 - r7354513;
        return r7354514;
}

\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))))