Average Error: 0.1 → 0.1
Time: 22.4s
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 r116264 = x;
        double r116265 = y;
        double r116266 = sin(r116265);
        double r116267 = r116264 * r116266;
        double r116268 = z;
        double r116269 = cos(r116265);
        double r116270 = r116268 * r116269;
        double r116271 = r116267 + r116270;
        return r116271;
}

double f(double x, double y, double z) {
        double r116272 = x;
        double r116273 = y;
        double r116274 = sin(r116273);
        double r116275 = z;
        double r116276 = cos(r116273);
        double r116277 = r116275 * r116276;
        double r116278 = fma(r116272, r116274, r116277);
        return r116278;
}

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