Average Error: 0.1 → 0.1
Time: 21.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 r170584 = x;
        double r170585 = y;
        double r170586 = sin(r170585);
        double r170587 = r170584 * r170586;
        double r170588 = z;
        double r170589 = cos(r170585);
        double r170590 = r170588 * r170589;
        double r170591 = r170587 + r170590;
        return r170591;
}

double f(double x, double y, double z) {
        double r170592 = x;
        double r170593 = y;
        double r170594 = sin(r170593);
        double r170595 = z;
        double r170596 = cos(r170593);
        double r170597 = r170595 * r170596;
        double r170598 = fma(r170592, r170594, r170597);
        return r170598;
}

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 2019325 +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))))