Average Error: 0.1 → 0.1
Time: 5.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 r235150 = x;
        double r235151 = y;
        double r235152 = sin(r235151);
        double r235153 = r235150 * r235152;
        double r235154 = z;
        double r235155 = cos(r235151);
        double r235156 = r235154 * r235155;
        double r235157 = r235153 + r235156;
        return r235157;
}

double f(double x, double y, double z) {
        double r235158 = x;
        double r235159 = y;
        double r235160 = sin(r235159);
        double r235161 = z;
        double r235162 = cos(r235159);
        double r235163 = r235161 * r235162;
        double r235164 = fma(r235158, r235160, r235163);
        return r235164;
}

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