Average Error: 14.9 → 0.3
Time: 24.5s
Precision: 64
\[r \cdot \frac{\sin b}{\cos \left(a + b\right)}\]
\[r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos a, \cos b, \left(-\sin b\right) \cdot \sin a\right)}\]
r \cdot \frac{\sin b}{\cos \left(a + b\right)}
r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos a, \cos b, \left(-\sin b\right) \cdot \sin a\right)}
double f(double r, double a, double b) {
        double r810104 = r;
        double r810105 = b;
        double r810106 = sin(r810105);
        double r810107 = a;
        double r810108 = r810107 + r810105;
        double r810109 = cos(r810108);
        double r810110 = r810106 / r810109;
        double r810111 = r810104 * r810110;
        return r810111;
}

double f(double r, double a, double b) {
        double r810112 = r;
        double r810113 = b;
        double r810114 = sin(r810113);
        double r810115 = a;
        double r810116 = cos(r810115);
        double r810117 = cos(r810113);
        double r810118 = -r810114;
        double r810119 = sin(r810115);
        double r810120 = r810118 * r810119;
        double r810121 = fma(r810116, r810117, r810120);
        double r810122 = r810114 / r810121;
        double r810123 = r810112 * r810122;
        return r810123;
}

Error

Bits error versus r

Bits error versus a

Bits error versus b

Derivation

  1. Initial program 14.9

    \[r \cdot \frac{\sin b}{\cos \left(a + b\right)}\]
  2. Using strategy rm
  3. Applied cos-sum0.3

    \[\leadsto r \cdot \frac{\sin b}{\color{blue}{\cos a \cdot \cos b - \sin a \cdot \sin b}}\]
  4. Using strategy rm
  5. Applied fma-neg0.3

    \[\leadsto r \cdot \frac{\sin b}{\color{blue}{\mathsf{fma}\left(\cos a, \cos b, -\sin a \cdot \sin b\right)}}\]
  6. Final simplification0.3

    \[\leadsto r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos a, \cos b, \left(-\sin b\right) \cdot \sin a\right)}\]

Reproduce

herbie shell --seed 2019152 +o rules:numerics
(FPCore (r a b)
  :name "r*sin(b)/cos(a+b), B"
  (* r (/ (sin b) (cos (+ a b)))))