Average Error: 0.1 → 0.1
Time: 22.2s
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 r106763 = x;
        double r106764 = y;
        double r106765 = sin(r106764);
        double r106766 = r106763 * r106765;
        double r106767 = z;
        double r106768 = cos(r106764);
        double r106769 = r106767 * r106768;
        double r106770 = r106766 + r106769;
        return r106770;
}

double f(double x, double y, double z) {
        double r106771 = x;
        double r106772 = y;
        double r106773 = sin(r106772);
        double r106774 = z;
        double r106775 = cos(r106772);
        double r106776 = r106774 * r106775;
        double r106777 = fma(r106771, r106773, r106776);
        return r106777;
}

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