Average Error: 0.1 → 0.1
Time: 4.9s
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 r206215 = x;
        double r206216 = y;
        double r206217 = sin(r206216);
        double r206218 = r206215 * r206217;
        double r206219 = z;
        double r206220 = cos(r206216);
        double r206221 = r206219 * r206220;
        double r206222 = r206218 + r206221;
        return r206222;
}

double f(double x, double y, double z) {
        double r206223 = x;
        double r206224 = y;
        double r206225 = sin(r206224);
        double r206226 = z;
        double r206227 = cos(r206224);
        double r206228 = r206226 * r206227;
        double r206229 = fma(r206223, r206225, r206228);
        return r206229;
}

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