Average Error: 0.1 → 0.1
Time: 20.9s
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 r128783 = x;
        double r128784 = y;
        double r128785 = sin(r128784);
        double r128786 = r128783 * r128785;
        double r128787 = z;
        double r128788 = cos(r128784);
        double r128789 = r128787 * r128788;
        double r128790 = r128786 + r128789;
        return r128790;
}

double f(double x, double y, double z) {
        double r128791 = x;
        double r128792 = y;
        double r128793 = sin(r128792);
        double r128794 = z;
        double r128795 = cos(r128792);
        double r128796 = r128794 * r128795;
        double r128797 = fma(r128791, r128793, r128796);
        return r128797;
}

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