Average Error: 0.1 → 0.1
Time: 7.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 r180536 = x;
        double r180537 = y;
        double r180538 = sin(r180537);
        double r180539 = r180536 * r180538;
        double r180540 = z;
        double r180541 = cos(r180537);
        double r180542 = r180540 * r180541;
        double r180543 = r180539 + r180542;
        return r180543;
}

double f(double x, double y, double z) {
        double r180544 = x;
        double r180545 = y;
        double r180546 = sin(r180545);
        double r180547 = z;
        double r180548 = cos(r180545);
        double r180549 = r180547 * r180548;
        double r180550 = fma(r180544, r180546, r180549);
        return r180550;
}

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