Average Error: 0.1 → 0.1
Time: 8.7s
Precision: binary64
\[x \cdot \sin y + z \cdot \cos y \]
\[\mathsf{fma}\left(x, \sin y, z \cdot \cos y\right) \]
x \cdot \sin y + z \cdot \cos y
\mathsf{fma}\left(x, \sin y, z \cdot \cos y\right)
(FPCore (x y z) :precision binary64 (+ (* x (sin y)) (* z (cos y))))
(FPCore (x y z) :precision binary64 (fma x (sin y) (* z (cos y))))
double code(double x, double y, double z) {
	return (x * sin(y)) + (z * cos(y));
}
double code(double x, double y, double z) {
	return fma(x, sin(y), (z * cos(y)));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.1

    \[x \cdot \sin y + z \cdot \cos y \]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \sin y, z \cdot \cos y\right)} \]
  3. Applied add-cube-cbrt_binary640.6

    \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\sqrt[3]{\sin y} \cdot \sqrt[3]{\sin y}\right) \cdot \sqrt[3]{\sin y}}, z \cdot \cos y\right) \]
  4. Applied pow1/3_binary6432.6

    \[\leadsto \mathsf{fma}\left(x, \left(\sqrt[3]{\sin y} \cdot \sqrt[3]{\sin y}\right) \cdot \color{blue}{{\sin y}^{0.3333333333333333}}, z \cdot \cos y\right) \]
  5. Applied pow1/3_binary6432.7

    \[\leadsto \mathsf{fma}\left(x, \left(\sqrt[3]{\sin y} \cdot \color{blue}{{\sin y}^{0.3333333333333333}}\right) \cdot {\sin y}^{0.3333333333333333}, z \cdot \cos y\right) \]
  6. Applied pow1/3_binary6432.7

    \[\leadsto \mathsf{fma}\left(x, \left(\color{blue}{{\sin y}^{0.3333333333333333}} \cdot {\sin y}^{0.3333333333333333}\right) \cdot {\sin y}^{0.3333333333333333}, z \cdot \cos y\right) \]
  7. Applied pow-sqr_binary6432.7

    \[\leadsto \mathsf{fma}\left(x, \color{blue}{{\sin y}^{\left(2 \cdot 0.3333333333333333\right)}} \cdot {\sin y}^{0.3333333333333333}, z \cdot \cos y\right) \]
  8. Applied pow-prod-up_binary640.1

    \[\leadsto \mathsf{fma}\left(x, \color{blue}{{\sin y}^{\left(2 \cdot 0.3333333333333333 + 0.3333333333333333\right)}}, z \cdot \cos y\right) \]
  9. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(x, \sin y, z \cdot \cos y\right) \]

Reproduce

herbie shell --seed 2021280 
(FPCore (x y z)
  :name "Diagrams.ThreeD.Transform:aboutX from diagrams-lib-1.3.0.3, B"
  :precision binary64
  (+ (* x (sin y)) (* z (cos y))))