Average Error: 15.2 → 0.3
Time: 17.8s
Precision: binary64
\[r \cdot \frac{\sin b}{\cos \left(a + b\right)} \]
\[r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos a, \cos b, -\sin b \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, -\sin b \cdot \sin a\right)}
(FPCore (r a b) :precision binary64 (* r (/ (sin b) (cos (+ a b)))))
(FPCore (r a b)
 :precision binary64
 (* r (/ (sin b) (fma (cos a) (cos b) (- (* (sin b) (sin a)))))))
double code(double r, double a, double b) {
	return r * (sin(b) / cos(a + b));
}
double code(double r, double a, double b) {
	return r * (sin(b) / fma(cos(a), cos(b), -(sin(b) * sin(a))));
}

Error

Bits error versus r

Bits error versus a

Bits error versus b

Derivation

  1. Initial program 15.2

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

    \[\leadsto r \cdot \frac{\sin b}{\color{blue}{\cos a \cdot \cos b - \sin a \cdot \sin b}} \]
  3. Applied fma-neg_binary640.3

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

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

Reproduce

herbie shell --seed 2022005 
(FPCore (r a b)
  :name "rsin B"
  :precision binary64
  (* r (/ (sin b) (cos (+ a b)))))