Average Error: 0.2 → 0.2
Time: 17.3s
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
\[\mathsf{fma}\left(-1, \frac{x}{\sin B} \cdot \cos B, \frac{1}{\sin B}\right)\]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\mathsf{fma}\left(-1, \frac{x}{\sin B} \cdot \cos B, \frac{1}{\sin B}\right)
double f(double B, double x) {
        double r23405 = x;
        double r23406 = 1.0;
        double r23407 = B;
        double r23408 = tan(r23407);
        double r23409 = r23406 / r23408;
        double r23410 = r23405 * r23409;
        double r23411 = -r23410;
        double r23412 = sin(r23407);
        double r23413 = r23406 / r23412;
        double r23414 = r23411 + r23413;
        return r23414;
}

double f(double B, double x) {
        double r23415 = 1.0;
        double r23416 = -r23415;
        double r23417 = x;
        double r23418 = B;
        double r23419 = sin(r23418);
        double r23420 = r23417 / r23419;
        double r23421 = cos(r23418);
        double r23422 = r23420 * r23421;
        double r23423 = r23415 / r23419;
        double r23424 = fma(r23416, r23422, r23423);
        return r23424;
}

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}{\mathsf{fma}\left(\frac{x}{\tan B}, -1, \frac{1}{\sin B}\right)}\]
  3. Taylor expanded around inf 0.2

    \[\leadsto \color{blue}{1 \cdot \frac{1}{\sin B} - 1 \cdot \frac{x \cdot \cos B}{\sin B}}\]
  4. Simplified0.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{x}{\frac{\sin B}{\cos B}}, \frac{1}{\sin B}\right)}\]
  5. Using strategy rm
  6. Applied associate-/r/0.2

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

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

Reproduce

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