Average Error: 0.2 → 0.2
Time: 4.6s
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
\[\mathsf{fma}\left(-x, 1 \cdot \frac{\cos B}{\sin B}, \frac{1}{\sin B}\right)\]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\mathsf{fma}\left(-x, 1 \cdot \frac{\cos B}{\sin B}, \frac{1}{\sin B}\right)
double f(double B, double x) {
        double r54444 = x;
        double r54445 = 1.0;
        double r54446 = B;
        double r54447 = tan(r54446);
        double r54448 = r54445 / r54447;
        double r54449 = r54444 * r54448;
        double r54450 = -r54449;
        double r54451 = sin(r54446);
        double r54452 = r54445 / r54451;
        double r54453 = r54450 + r54452;
        return r54453;
}

double f(double B, double x) {
        double r54454 = x;
        double r54455 = -r54454;
        double r54456 = 1.0;
        double r54457 = B;
        double r54458 = cos(r54457);
        double r54459 = sin(r54457);
        double r54460 = r54458 / r54459;
        double r54461 = r54456 * r54460;
        double r54462 = r54456 / r54459;
        double r54463 = fma(r54455, r54461, r54462);
        return r54463;
}

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

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

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

Reproduce

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