Average Error: 0.2 → 0.2
Time: 6.5s
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 r19661 = x;
        double r19662 = 1.0;
        double r19663 = B;
        double r19664 = tan(r19663);
        double r19665 = r19662 / r19664;
        double r19666 = r19661 * r19665;
        double r19667 = -r19666;
        double r19668 = sin(r19663);
        double r19669 = r19662 / r19668;
        double r19670 = r19667 + r19669;
        return r19670;
}

double f(double B, double x) {
        double r19671 = 1.0;
        double r19672 = x;
        double r19673 = B;
        double r19674 = cos(r19673);
        double r19675 = sin(r19673);
        double r19676 = r19674 / r19675;
        double r19677 = r19672 * r19676;
        double r19678 = r19671 * r19677;
        double r19679 = -r19678;
        double r19680 = r19671 / r19675;
        double r19681 = r19679 + r19680;
        return r19681;
}

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