Average Error: 0.1 → 0.1
Time: 4.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 r173162 = x;
        double r173163 = y;
        double r173164 = sin(r173163);
        double r173165 = r173162 * r173164;
        double r173166 = z;
        double r173167 = cos(r173163);
        double r173168 = r173166 * r173167;
        double r173169 = r173165 + r173168;
        return r173169;
}

double f(double x, double y, double z) {
        double r173170 = x;
        double r173171 = y;
        double r173172 = sin(r173171);
        double r173173 = z;
        double r173174 = cos(r173171);
        double r173175 = r173173 * r173174;
        double r173176 = fma(r173170, r173172, r173175);
        return r173176;
}

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. Using strategy rm
  4. Applied *-un-lft-identity0.1

    \[\leadsto \color{blue}{1 \cdot \mathsf{fma}\left(x, \sin y, z \cdot \cos y\right)}\]
  5. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(x, \sin y, z \cdot \cos y\right)\]

Reproduce

herbie shell --seed 2020036 +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))))