Average Error: 0.2 → 0.2
Time: 16.8s
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 r21920 = x;
        double r21921 = 1.0;
        double r21922 = B;
        double r21923 = tan(r21922);
        double r21924 = r21921 / r21923;
        double r21925 = r21920 * r21924;
        double r21926 = -r21925;
        double r21927 = sin(r21922);
        double r21928 = r21921 / r21927;
        double r21929 = r21926 + r21928;
        return r21929;
}

double f(double B, double x) {
        double r21930 = 1.0;
        double r21931 = B;
        double r21932 = tan(r21931);
        double r21933 = r21930 / r21932;
        double r21934 = x;
        double r21935 = r21933 * r21934;
        double r21936 = 1.0;
        double r21937 = -r21936;
        double r21938 = sin(r21931);
        double r21939 = r21936 / r21938;
        double r21940 = fma(r21935, r21937, r21939);
        return r21940;
}

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