Average Error: 0.1 → 0.1
Time: 5.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 r190891 = x;
        double r190892 = y;
        double r190893 = sin(r190892);
        double r190894 = r190891 * r190893;
        double r190895 = z;
        double r190896 = cos(r190892);
        double r190897 = r190895 * r190896;
        double r190898 = r190894 + r190897;
        return r190898;
}

double f(double x, double y, double z) {
        double r190899 = x;
        double r190900 = y;
        double r190901 = sin(r190900);
        double r190902 = z;
        double r190903 = cos(r190900);
        double r190904 = r190902 * r190903;
        double r190905 = fma(r190899, r190901, r190904);
        return r190905;
}

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