Average Error: 0.2 → 0.2
Time: 16.3s
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
\[\mathsf{fma}\left(\frac{x}{\sin B} \cdot \cos B, -1, \frac{1}{\sin B}\right)\]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\mathsf{fma}\left(\frac{x}{\sin B} \cdot \cos B, -1, \frac{1}{\sin B}\right)
double f(double B, double x) {
        double r52543 = x;
        double r52544 = 1.0;
        double r52545 = B;
        double r52546 = tan(r52545);
        double r52547 = r52544 / r52546;
        double r52548 = r52543 * r52547;
        double r52549 = -r52548;
        double r52550 = sin(r52545);
        double r52551 = r52544 / r52550;
        double r52552 = r52549 + r52551;
        return r52552;
}

double f(double B, double x) {
        double r52553 = x;
        double r52554 = B;
        double r52555 = sin(r52554);
        double r52556 = r52553 / r52555;
        double r52557 = cos(r52554);
        double r52558 = r52556 * r52557;
        double r52559 = 1.0;
        double r52560 = -r52559;
        double r52561 = r52559 / r52555;
        double r52562 = fma(r52558, r52560, r52561);
        return r52562;
}

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.2

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

    \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{\frac{\tan B}{x}}}, -1, \frac{1}{\sin B}\right)\]
  5. Using strategy rm
  6. Applied div-inv0.3

    \[\leadsto \mathsf{fma}\left(\frac{1}{\color{blue}{\tan B \cdot \frac{1}{x}}}, -1, \frac{1}{\sin B}\right)\]
  7. Taylor expanded around inf 0.2

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

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

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

Reproduce

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