Average Error: 0.1 → 0.1
Time: 16.1s
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 r201076 = x;
        double r201077 = y;
        double r201078 = sin(r201077);
        double r201079 = r201076 * r201078;
        double r201080 = z;
        double r201081 = cos(r201077);
        double r201082 = r201080 * r201081;
        double r201083 = r201079 + r201082;
        return r201083;
}

double f(double x, double y, double z) {
        double r201084 = x;
        double r201085 = y;
        double r201086 = sin(r201085);
        double r201087 = z;
        double r201088 = cos(r201085);
        double r201089 = r201087 * r201088;
        double r201090 = fma(r201084, r201086, r201089);
        return r201090;
}

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