Average Error: 0.1 → 0.1
Time: 18.7s
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 r118541 = x;
        double r118542 = y;
        double r118543 = sin(r118542);
        double r118544 = r118541 * r118543;
        double r118545 = z;
        double r118546 = cos(r118542);
        double r118547 = r118545 * r118546;
        double r118548 = r118544 + r118547;
        return r118548;
}

double f(double x, double y, double z) {
        double r118549 = x;
        double r118550 = y;
        double r118551 = sin(r118550);
        double r118552 = z;
        double r118553 = cos(r118550);
        double r118554 = r118552 * r118553;
        double r118555 = fma(r118549, r118551, r118554);
        return r118555;
}

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