Average Error: 15.0 → 0.3
Time: 6.7s
Precision: 64
\[r \cdot \frac{\sin b}{\cos \left(a + b\right)}\]
\[r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos a, \cos b, -\sin a \cdot \sin b\right)}\]
r \cdot \frac{\sin b}{\cos \left(a + b\right)}
r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos a, \cos b, -\sin a \cdot \sin b\right)}
double f(double r, double a, double b) {
        double r17063 = r;
        double r17064 = b;
        double r17065 = sin(r17064);
        double r17066 = a;
        double r17067 = r17066 + r17064;
        double r17068 = cos(r17067);
        double r17069 = r17065 / r17068;
        double r17070 = r17063 * r17069;
        return r17070;
}

double f(double r, double a, double b) {
        double r17071 = r;
        double r17072 = b;
        double r17073 = sin(r17072);
        double r17074 = a;
        double r17075 = cos(r17074);
        double r17076 = cos(r17072);
        double r17077 = sin(r17074);
        double r17078 = r17077 * r17073;
        double r17079 = -r17078;
        double r17080 = fma(r17075, r17076, r17079);
        double r17081 = r17073 / r17080;
        double r17082 = r17071 * r17081;
        return r17082;
}

Error

Bits error versus r

Bits error versus a

Bits error versus b

Derivation

  1. Initial program 15.0

    \[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, -\sin a \cdot \sin b\right)}\]

Reproduce

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