Average Error: 0.1 → 0.1
Time: 5.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 r197802 = x;
        double r197803 = y;
        double r197804 = sin(r197803);
        double r197805 = r197802 * r197804;
        double r197806 = z;
        double r197807 = cos(r197803);
        double r197808 = r197806 * r197807;
        double r197809 = r197805 + r197808;
        return r197809;
}

double f(double x, double y, double z) {
        double r197810 = x;
        double r197811 = y;
        double r197812 = sin(r197811);
        double r197813 = z;
        double r197814 = cos(r197811);
        double r197815 = r197813 * r197814;
        double r197816 = fma(r197810, r197812, r197815);
        return r197816;
}

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