Average Error: 15.2 → 0.3
Time: 9.4s
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 frac-2neg_binary640.3

    \[\leadsto r \cdot \color{blue}{\frac{-\sin b}{-\left(\cos a \cdot \cos b - \sin a \cdot \sin b\right)}} \]
  4. Simplified0.3

    \[\leadsto r \cdot \frac{-\sin b}{\color{blue}{\mathsf{fma}\left(\cos a, -\cos b, \sin a \cdot \sin b\right)}} \]
  5. 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 2021280 
(FPCore (r a b)
  :name "rsin B"
  :precision binary64
  (* r (/ (sin b) (cos (+ a b)))))