Average Error: 15.1 → 0.4
Time: 6.6s
Precision: 64
\[r \cdot \frac{\sin b}{\cos \left(a + b\right)}\]
\[r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos a, \cos b, -\log \left(e^{\sin a \cdot \sin b}\right)\right)}\]
r \cdot \frac{\sin b}{\cos \left(a + b\right)}
r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos a, \cos b, -\log \left(e^{\sin a \cdot \sin b}\right)\right)}
double f(double r, double a, double b) {
        double r17273 = r;
        double r17274 = b;
        double r17275 = sin(r17274);
        double r17276 = a;
        double r17277 = r17276 + r17274;
        double r17278 = cos(r17277);
        double r17279 = r17275 / r17278;
        double r17280 = r17273 * r17279;
        return r17280;
}

double f(double r, double a, double b) {
        double r17281 = r;
        double r17282 = b;
        double r17283 = sin(r17282);
        double r17284 = a;
        double r17285 = cos(r17284);
        double r17286 = cos(r17282);
        double r17287 = sin(r17284);
        double r17288 = r17287 * r17283;
        double r17289 = exp(r17288);
        double r17290 = log(r17289);
        double r17291 = -r17290;
        double r17292 = fma(r17285, r17286, r17291);
        double r17293 = r17283 / r17292;
        double r17294 = r17281 * r17293;
        return r17294;
}

Error

Bits error versus r

Bits error versus a

Bits error versus b

Derivation

  1. Initial program 15.1

    \[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. Using strategy rm
  7. Applied add-log-exp0.4

    \[\leadsto r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos a, \cos b, -\color{blue}{\log \left(e^{\sin a \cdot \sin b}\right)}\right)}\]
  8. Final simplification0.4

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

Reproduce

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