Average Error: 0.2 → 0.2
Time: 19.1s
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 r23288 = x;
        double r23289 = 1.0;
        double r23290 = B;
        double r23291 = tan(r23290);
        double r23292 = r23289 / r23291;
        double r23293 = r23288 * r23292;
        double r23294 = -r23293;
        double r23295 = sin(r23290);
        double r23296 = r23289 / r23295;
        double r23297 = r23294 + r23296;
        return r23297;
}

double f(double B, double x) {
        double r23298 = x;
        double r23299 = B;
        double r23300 = sin(r23299);
        double r23301 = r23298 / r23300;
        double r23302 = cos(r23299);
        double r23303 = r23301 * r23302;
        double r23304 = 1.0;
        double r23305 = -r23304;
        double r23306 = r23304 / r23300;
        double r23307 = fma(r23303, r23305, r23306);
        return r23307;
}

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