Average Error: 0.1 → 0.1
Time: 14.1s
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 r181275 = x;
        double r181276 = y;
        double r181277 = sin(r181276);
        double r181278 = r181275 * r181277;
        double r181279 = z;
        double r181280 = cos(r181276);
        double r181281 = r181279 * r181280;
        double r181282 = r181278 + r181281;
        return r181282;
}

double f(double x, double y, double z) {
        double r181283 = x;
        double r181284 = y;
        double r181285 = sin(r181284);
        double r181286 = z;
        double r181287 = cos(r181284);
        double r181288 = r181286 * r181287;
        double r181289 = fma(r181283, r181285, r181288);
        return r181289;
}

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