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

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.1

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

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

    \[\leadsto \mathsf{fma}\left(x, \color{blue}{\log \left(e^{\cos y}\right)}, z \cdot \sin y\right) \]
  4. Applied *-un-lft-identity_binary640.3

    \[\leadsto \mathsf{fma}\left(x, \log \left(e^{\color{blue}{1 \cdot \cos y}}\right), z \cdot \sin y\right) \]
  5. Applied exp-prod_binary640.3

    \[\leadsto \mathsf{fma}\left(x, \log \color{blue}{\left({\left(e^{1}\right)}^{\cos y}\right)}, z \cdot \sin y\right) \]
  6. Applied log-pow_binary640.1

    \[\leadsto \mathsf{fma}\left(x, \color{blue}{\cos y \cdot \log \left(e^{1}\right)}, z \cdot \sin y\right) \]
  7. Final simplification0.1

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

Reproduce

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