Average Error: 0.1 → 0.1
Time: 21.1s
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 r226016 = x;
        double r226017 = y;
        double r226018 = sin(r226017);
        double r226019 = r226016 * r226018;
        double r226020 = z;
        double r226021 = cos(r226017);
        double r226022 = r226020 * r226021;
        double r226023 = r226019 + r226022;
        return r226023;
}

double f(double x, double y, double z) {
        double r226024 = x;
        double r226025 = y;
        double r226026 = sin(r226025);
        double r226027 = z;
        double r226028 = cos(r226025);
        double r226029 = r226027 * r226028;
        double r226030 = fma(r226024, r226026, r226029);
        return r226030;
}

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