Average Error: 0.1 → 0.1
Time: 22.0s
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 r146149 = x;
        double r146150 = y;
        double r146151 = sin(r146150);
        double r146152 = r146149 * r146151;
        double r146153 = z;
        double r146154 = cos(r146150);
        double r146155 = r146153 * r146154;
        double r146156 = r146152 + r146155;
        return r146156;
}

double f(double x, double y, double z) {
        double r146157 = x;
        double r146158 = y;
        double r146159 = sin(r146158);
        double r146160 = z;
        double r146161 = cos(r146158);
        double r146162 = r146160 * r146161;
        double r146163 = fma(r146157, r146159, r146162);
        return r146163;
}

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