Average Error: 0.1 → 0.1
Time: 5.4s
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 r176795 = x;
        double r176796 = y;
        double r176797 = sin(r176796);
        double r176798 = r176795 * r176797;
        double r176799 = z;
        double r176800 = cos(r176796);
        double r176801 = r176799 * r176800;
        double r176802 = r176798 + r176801;
        return r176802;
}

double f(double x, double y, double z) {
        double r176803 = x;
        double r176804 = y;
        double r176805 = sin(r176804);
        double r176806 = z;
        double r176807 = cos(r176804);
        double r176808 = r176806 * r176807;
        double r176809 = fma(r176803, r176805, r176808);
        return r176809;
}

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