Average Error: 0.2 → 0.2
Time: 5.2s
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
\[\frac{-x}{\frac{\sin B}{1 \cdot \cos B}} + \frac{1}{\sin B}\]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\frac{-x}{\frac{\sin B}{1 \cdot \cos B}} + \frac{1}{\sin B}
double f(double B, double x) {
        double r53254 = x;
        double r53255 = 1.0;
        double r53256 = B;
        double r53257 = tan(r53256);
        double r53258 = r53255 / r53257;
        double r53259 = r53254 * r53258;
        double r53260 = -r53259;
        double r53261 = sin(r53256);
        double r53262 = r53255 / r53261;
        double r53263 = r53260 + r53262;
        return r53263;
}

double f(double B, double x) {
        double r53264 = x;
        double r53265 = -r53264;
        double r53266 = B;
        double r53267 = sin(r53266);
        double r53268 = 1.0;
        double r53269 = cos(r53266);
        double r53270 = r53268 * r53269;
        double r53271 = r53267 / r53270;
        double r53272 = r53265 / r53271;
        double r53273 = r53268 / r53267;
        double r53274 = r53272 + r53273;
        return r53274;
}

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}{\mathsf{fma}\left(-x, \frac{1}{\tan B}, \frac{1}{\sin B}\right)}\]
  3. Taylor expanded around inf 0.2

    \[\leadsto \mathsf{fma}\left(-x, \color{blue}{1 \cdot \frac{\cos B}{\sin B}}, \frac{1}{\sin B}\right)\]
  4. Using strategy rm
  5. Applied fma-udef0.2

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

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

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

    \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{1 \cdot \cos B}}} + \frac{1}{\sin B}\]
  11. Final simplification0.2

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

Reproduce

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