Average Error: 0.2 → 0.3
Time: 34.4s
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
\[\frac{1}{\sin B} \cdot \left(1 - \left(\cos B \cdot x\right) \cdot 1\right)\]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\frac{1}{\sin B} \cdot \left(1 - \left(\cos B \cdot x\right) \cdot 1\right)
double f(double B, double x) {
        double r1885005 = x;
        double r1885006 = 1.0;
        double r1885007 = B;
        double r1885008 = tan(r1885007);
        double r1885009 = r1885006 / r1885008;
        double r1885010 = r1885005 * r1885009;
        double r1885011 = -r1885010;
        double r1885012 = sin(r1885007);
        double r1885013 = r1885006 / r1885012;
        double r1885014 = r1885011 + r1885013;
        return r1885014;
}

double f(double B, double x) {
        double r1885015 = 1.0;
        double r1885016 = B;
        double r1885017 = sin(r1885016);
        double r1885018 = r1885015 / r1885017;
        double r1885019 = 1.0;
        double r1885020 = cos(r1885016);
        double r1885021 = x;
        double r1885022 = r1885020 * r1885021;
        double r1885023 = r1885022 * r1885019;
        double r1885024 = r1885019 - r1885023;
        double r1885025 = r1885018 * r1885024;
        return r1885025;
}

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} - \frac{x \cdot 1}{\tan B}}\]
  3. Taylor expanded around inf 0.2

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

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

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

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

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

Reproduce

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