Average Error: 0.1 → 0.1
Time: 5.3s
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 r135914 = x;
        double r135915 = y;
        double r135916 = sin(r135915);
        double r135917 = r135914 * r135916;
        double r135918 = z;
        double r135919 = cos(r135915);
        double r135920 = r135918 * r135919;
        double r135921 = r135917 + r135920;
        return r135921;
}

double f(double x, double y, double z) {
        double r135922 = x;
        double r135923 = y;
        double r135924 = sin(r135923);
        double r135925 = z;
        double r135926 = cos(r135923);
        double r135927 = r135925 * r135926;
        double r135928 = fma(r135922, r135924, r135927);
        return r135928;
}

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