Average Error: 0.2 → 0.2
Time: 5.6s
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
\[\left(-\frac{1}{\frac{\sin B}{x \cdot 1}} \cdot \cos B\right) + \frac{1}{\sin B}\]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\left(-\frac{1}{\frac{\sin B}{x \cdot 1}} \cdot \cos B\right) + \frac{1}{\sin B}
double f(double B, double x) {
        double r42416 = x;
        double r42417 = 1.0;
        double r42418 = B;
        double r42419 = tan(r42418);
        double r42420 = r42417 / r42419;
        double r42421 = r42416 * r42420;
        double r42422 = -r42421;
        double r42423 = sin(r42418);
        double r42424 = r42417 / r42423;
        double r42425 = r42422 + r42424;
        return r42425;
}

double f(double B, double x) {
        double r42426 = 1.0;
        double r42427 = B;
        double r42428 = sin(r42427);
        double r42429 = x;
        double r42430 = 1.0;
        double r42431 = r42429 * r42430;
        double r42432 = r42428 / r42431;
        double r42433 = r42426 / r42432;
        double r42434 = cos(r42427);
        double r42435 = r42433 * r42434;
        double r42436 = -r42435;
        double r42437 = r42430 / r42428;
        double r42438 = r42436 + r42437;
        return r42438;
}

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 tan-quot0.2

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

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

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

    \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\sin B}} \cdot \cos B\right) + \frac{1}{\sin B}\]
  8. Using strategy rm
  9. Applied clear-num0.2

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

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

Reproduce

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