Average Error: 0.2 → 0.2
Time: 16.7s
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
\[\mathsf{fma}\left(\frac{1}{\tan B} \cdot x, -1, \frac{1}{\sin B}\right)\]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\mathsf{fma}\left(\frac{1}{\tan B} \cdot x, -1, \frac{1}{\sin B}\right)
double f(double B, double x) {
        double r46132 = x;
        double r46133 = 1.0;
        double r46134 = B;
        double r46135 = tan(r46134);
        double r46136 = r46133 / r46135;
        double r46137 = r46132 * r46136;
        double r46138 = -r46137;
        double r46139 = sin(r46134);
        double r46140 = r46133 / r46139;
        double r46141 = r46138 + r46140;
        return r46141;
}

double f(double B, double x) {
        double r46142 = 1.0;
        double r46143 = B;
        double r46144 = tan(r46143);
        double r46145 = r46142 / r46144;
        double r46146 = x;
        double r46147 = r46145 * r46146;
        double r46148 = 1.0;
        double r46149 = -r46148;
        double r46150 = sin(r46143);
        double r46151 = r46148 / r46150;
        double r46152 = fma(r46147, r46149, r46151);
        return r46152;
}

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. Using strategy rm
  4. Applied div-inv0.2

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

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

Reproduce

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