Average Error: 0.2 → 0.2
Time: 22.0s
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
\[\frac{1}{\sin B} - \frac{\frac{1}{\tan B}}{\frac{1}{x \cdot 1}}\]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\frac{1}{\sin B} - \frac{\frac{1}{\tan B}}{\frac{1}{x \cdot 1}}
double f(double B, double x) {
        double r50822 = x;
        double r50823 = 1.0;
        double r50824 = B;
        double r50825 = tan(r50824);
        double r50826 = r50823 / r50825;
        double r50827 = r50822 * r50826;
        double r50828 = -r50827;
        double r50829 = sin(r50824);
        double r50830 = r50823 / r50829;
        double r50831 = r50828 + r50830;
        return r50831;
}

double f(double B, double x) {
        double r50832 = 1.0;
        double r50833 = B;
        double r50834 = sin(r50833);
        double r50835 = r50832 / r50834;
        double r50836 = 1.0;
        double r50837 = tan(r50833);
        double r50838 = r50836 / r50837;
        double r50839 = x;
        double r50840 = r50839 * r50832;
        double r50841 = r50836 / r50840;
        double r50842 = r50838 / r50841;
        double r50843 = r50835 - r50842;
        return r50843;
}

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. Simplified0.2

    \[\leadsto \color{blue}{\frac{1}{\sin B} - x \cdot \frac{1}{\tan B}}\]
  3. Using strategy rm
  4. Applied associate-*r/0.2

    \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{x \cdot 1}{\tan B}}\]
  5. Using strategy rm
  6. Applied clear-num0.2

    \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1}{\frac{\tan B}{x \cdot 1}}}\]
  7. Using strategy rm
  8. Applied div-inv0.3

    \[\leadsto \frac{1}{\sin B} - \frac{1}{\color{blue}{\tan B \cdot \frac{1}{x \cdot 1}}}\]
  9. Applied associate-/r*0.2

    \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{\frac{1}{\tan B}}{\frac{1}{x \cdot 1}}}\]
  10. Final simplification0.2

    \[\leadsto \frac{1}{\sin B} - \frac{\frac{1}{\tan B}}{\frac{1}{x \cdot 1}}\]

Reproduce

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