Average Error: 0.2 → 0.3
Time: 13.3s
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 r59057 = x;
        double r59058 = 1.0;
        double r59059 = B;
        double r59060 = tan(r59059);
        double r59061 = r59058 / r59060;
        double r59062 = r59057 * r59061;
        double r59063 = -r59062;
        double r59064 = sin(r59059);
        double r59065 = r59058 / r59064;
        double r59066 = r59063 + r59065;
        return r59066;
}

double f(double B, double x) {
        double r59067 = x;
        double r59068 = 1.0;
        double r59069 = B;
        double r59070 = sin(r59069);
        double r59071 = r59068 / r59070;
        double r59072 = r59067 * r59071;
        double r59073 = cos(r59069);
        double r59074 = r59072 * r59073;
        double r59075 = -r59074;
        double r59076 = r59075 + r59071;
        return r59076;
}

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