Average Error: 0.1 → 0.1
Time: 12.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 r223585 = x;
        double r223586 = y;
        double r223587 = sin(r223586);
        double r223588 = r223585 * r223587;
        double r223589 = z;
        double r223590 = cos(r223586);
        double r223591 = r223589 * r223590;
        double r223592 = r223588 + r223591;
        return r223592;
}

double f(double x, double y, double z) {
        double r223593 = x;
        double r223594 = y;
        double r223595 = sin(r223594);
        double r223596 = z;
        double r223597 = cos(r223594);
        double r223598 = r223596 * r223597;
        double r223599 = fma(r223593, r223595, r223598);
        return r223599;
}

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