Average Error: 0.1 → 0.1
Time: 14.8s
Precision: 64
\[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)
double f(double x, double y, double z) {
        double r238846 = x;
        double r238847 = y;
        double r238848 = sin(r238847);
        double r238849 = r238846 * r238848;
        double r238850 = z;
        double r238851 = cos(r238847);
        double r238852 = r238850 * r238851;
        double r238853 = r238849 + r238852;
        return r238853;
}

double f(double x, double y, double z) {
        double r238854 = x;
        double r238855 = y;
        double r238856 = sin(r238855);
        double r238857 = z;
        double r238858 = cos(r238855);
        double r238859 = r238857 * r238858;
        double r238860 = fma(r238854, r238856, r238859);
        return r238860;
}

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. Final simplification0.1

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

Reproduce

herbie shell --seed 2020046 +o rules:numerics
(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))))