Average Error: 0.2 → 0.3
Time: 13.9s
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
\[\left(-\left(x \cdot \frac{1}{\sin B}\right) \cdot \cos B\right) + \frac{1}{\sin B}\]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\left(-\left(x \cdot \frac{1}{\sin B}\right) \cdot \cos B\right) + \frac{1}{\sin B}
double f(double B, double x) {
        double r13024 = x;
        double r13025 = 1.0;
        double r13026 = B;
        double r13027 = tan(r13026);
        double r13028 = r13025 / r13027;
        double r13029 = r13024 * r13028;
        double r13030 = -r13029;
        double r13031 = sin(r13026);
        double r13032 = r13025 / r13031;
        double r13033 = r13030 + r13032;
        return r13033;
}

double f(double B, double x) {
        double r13034 = x;
        double r13035 = 1.0;
        double r13036 = B;
        double r13037 = sin(r13036);
        double r13038 = r13035 / r13037;
        double r13039 = r13034 * r13038;
        double r13040 = cos(r13036);
        double r13041 = r13039 * r13040;
        double r13042 = -r13041;
        double r13043 = r13042 + r13038;
        return r13043;
}

Error

Bits error versus B

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.2

    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
  2. Using strategy rm
  3. Applied associate-*r/0.2

    \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{1}{\sin B}\]
  4. Using strategy rm
  5. Applied tan-quot0.2

    \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\frac{\sin B}{\cos B}}}\right) + \frac{1}{\sin B}\]
  6. Applied associate-/r/0.2

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

    \[\leadsto \left(-\color{blue}{\left(x \cdot \frac{1}{\sin B}\right)} \cdot \cos B\right) + \frac{1}{\sin B}\]
  8. Final simplification0.3

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

Reproduce

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