Average Error: 0.2 → 0.2
Time: 17.4s
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 r42241 = x;
        double r42242 = 1.0;
        double r42243 = B;
        double r42244 = tan(r42243);
        double r42245 = r42242 / r42244;
        double r42246 = r42241 * r42245;
        double r42247 = -r42246;
        double r42248 = sin(r42243);
        double r42249 = r42242 / r42248;
        double r42250 = r42247 + r42249;
        return r42250;
}

double f(double B, double x) {
        double r42251 = 1.0;
        double r42252 = -r42251;
        double r42253 = x;
        double r42254 = B;
        double r42255 = sin(r42254);
        double r42256 = r42253 / r42255;
        double r42257 = cos(r42254);
        double r42258 = r42256 * r42257;
        double r42259 = r42251 / r42255;
        double r42260 = fma(r42252, r42258, r42259);
        return r42260;
}

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