Average Error: 0.2 → 0.2
Time: 6.1s
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
\[\left(-1 \cdot \left(x \cdot \frac{\cos B}{\sin B}\right)\right) + \frac{1}{\sin B}\]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\left(-1 \cdot \left(x \cdot \frac{\cos B}{\sin B}\right)\right) + \frac{1}{\sin B}
double f(double B, double x) {
        double r71796 = x;
        double r71797 = 1.0;
        double r71798 = B;
        double r71799 = tan(r71798);
        double r71800 = r71797 / r71799;
        double r71801 = r71796 * r71800;
        double r71802 = -r71801;
        double r71803 = sin(r71798);
        double r71804 = r71797 / r71803;
        double r71805 = r71802 + r71804;
        return r71805;
}

double f(double B, double x) {
        double r71806 = 1.0;
        double r71807 = x;
        double r71808 = B;
        double r71809 = cos(r71808);
        double r71810 = sin(r71808);
        double r71811 = r71809 / r71810;
        double r71812 = r71807 * r71811;
        double r71813 = r71806 * r71812;
        double r71814 = -r71813;
        double r71815 = r71806 / r71810;
        double r71816 = r71814 + r71815;
        return r71816;
}

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. Taylor expanded around inf 0.2

    \[\leadsto \left(-\color{blue}{1 \cdot \frac{x \cdot \cos B}{\sin B}}\right) + \frac{1}{\sin B}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity0.2

    \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{\color{blue}{1 \cdot \sin B}}\right) + \frac{1}{\sin B}\]
  5. Applied times-frac0.2

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

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

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

Reproduce

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