Average Error: 0.1 → 0.1
Time: 11.6s
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 r171325 = x;
        double r171326 = y;
        double r171327 = sin(r171326);
        double r171328 = r171325 * r171327;
        double r171329 = z;
        double r171330 = cos(r171326);
        double r171331 = r171329 * r171330;
        double r171332 = r171328 + r171331;
        return r171332;
}

double f(double x, double y, double z) {
        double r171333 = x;
        double r171334 = y;
        double r171335 = sin(r171334);
        double r171336 = z;
        double r171337 = cos(r171334);
        double r171338 = r171336 * r171337;
        double r171339 = fma(r171333, r171335, r171338);
        return r171339;
}

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