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 r210820 = x;
        double r210821 = y;
        double r210822 = sin(r210821);
        double r210823 = r210820 * r210822;
        double r210824 = z;
        double r210825 = cos(r210821);
        double r210826 = r210824 * r210825;
        double r210827 = r210823 + r210826;
        return r210827;
}

double f(double x, double y, double z) {
        double r210828 = x;
        double r210829 = y;
        double r210830 = sin(r210829);
        double r210831 = z;
        double r210832 = cos(r210829);
        double r210833 = r210831 * r210832;
        double r210834 = fma(r210828, r210830, r210833);
        return r210834;
}

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