Average Error: 0.1 → 0.1
Time: 22.8s
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 r206812 = x;
        double r206813 = y;
        double r206814 = sin(r206813);
        double r206815 = r206812 * r206814;
        double r206816 = z;
        double r206817 = cos(r206813);
        double r206818 = r206816 * r206817;
        double r206819 = r206815 + r206818;
        return r206819;
}

double f(double x, double y, double z) {
        double r206820 = x;
        double r206821 = y;
        double r206822 = sin(r206821);
        double r206823 = z;
        double r206824 = cos(r206821);
        double r206825 = r206823 * r206824;
        double r206826 = fma(r206820, r206822, r206825);
        return r206826;
}

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