Average Error: 0.1 → 0.1
Time: 14.5s
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 r222614 = x;
        double r222615 = y;
        double r222616 = sin(r222615);
        double r222617 = r222614 * r222616;
        double r222618 = z;
        double r222619 = cos(r222615);
        double r222620 = r222618 * r222619;
        double r222621 = r222617 + r222620;
        return r222621;
}

double f(double x, double y, double z) {
        double r222622 = x;
        double r222623 = y;
        double r222624 = sin(r222623);
        double r222625 = z;
        double r222626 = cos(r222623);
        double r222627 = r222625 * r222626;
        double r222628 = fma(r222622, r222624, r222627);
        return r222628;
}

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