Average Error: 0.1 → 0.1
Time: 4.9s
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 r187016 = x;
        double r187017 = y;
        double r187018 = sin(r187017);
        double r187019 = r187016 * r187018;
        double r187020 = z;
        double r187021 = cos(r187017);
        double r187022 = r187020 * r187021;
        double r187023 = r187019 + r187022;
        return r187023;
}

double f(double x, double y, double z) {
        double r187024 = x;
        double r187025 = y;
        double r187026 = sin(r187025);
        double r187027 = z;
        double r187028 = cos(r187025);
        double r187029 = r187027 * r187028;
        double r187030 = fma(r187024, r187026, r187029);
        return r187030;
}

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