Average Error: 0.2 → 0.1
Time: 48.1s
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
\[\mathsf{fma}\left(\frac{x}{\tan B}, -1, \frac{1}{\sin B}\right)\]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\mathsf{fma}\left(\frac{x}{\tan B}, -1, \frac{1}{\sin B}\right)
double f(double B, double x) {
        double r33472 = x;
        double r33473 = 1.0;
        double r33474 = B;
        double r33475 = tan(r33474);
        double r33476 = r33473 / r33475;
        double r33477 = r33472 * r33476;
        double r33478 = -r33477;
        double r33479 = sin(r33474);
        double r33480 = r33473 / r33479;
        double r33481 = r33478 + r33480;
        return r33481;
}

double f(double B, double x) {
        double r33482 = x;
        double r33483 = B;
        double r33484 = tan(r33483);
        double r33485 = r33482 / r33484;
        double r33486 = 1.0;
        double r33487 = -r33486;
        double r33488 = sin(r33483);
        double r33489 = r33486 / r33488;
        double r33490 = fma(r33485, r33487, r33489);
        return r33490;
}

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. Using strategy rm
  3. Applied *-un-lft-identity0.2

    \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1 \cdot \frac{1}{\sin B}}\]
  4. Applied *-un-lft-identity0.2

    \[\leadsto \color{blue}{1 \cdot \left(-x \cdot \frac{1}{\tan B}\right)} + 1 \cdot \frac{1}{\sin B}\]
  5. Applied distribute-lft-out0.2

    \[\leadsto \color{blue}{1 \cdot \left(\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\right)}\]
  6. Simplified0.1

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

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

Reproduce

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