Average Error: 0.1 → 0.1
Time: 11.5s
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 r181258 = x;
        double r181259 = y;
        double r181260 = sin(r181259);
        double r181261 = r181258 * r181260;
        double r181262 = z;
        double r181263 = cos(r181259);
        double r181264 = r181262 * r181263;
        double r181265 = r181261 + r181264;
        return r181265;
}

double f(double x, double y, double z) {
        double r181266 = x;
        double r181267 = y;
        double r181268 = sin(r181267);
        double r181269 = z;
        double r181270 = cos(r181267);
        double r181271 = r181269 * r181270;
        double r181272 = fma(r181266, r181268, r181271);
        return r181272;
}

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