Average Error: 0.1 → 0.1
Time: 11.5s
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 r181223 = x;
        double r181224 = y;
        double r181225 = sin(r181224);
        double r181226 = r181223 * r181225;
        double r181227 = z;
        double r181228 = cos(r181224);
        double r181229 = r181227 * r181228;
        double r181230 = r181226 + r181229;
        return r181230;
}

double f(double x, double y, double z) {
        double r181231 = x;
        double r181232 = y;
        double r181233 = sin(r181232);
        double r181234 = z;
        double r181235 = cos(r181232);
        double r181236 = r181234 * r181235;
        double r181237 = fma(r181231, r181233, r181236);
        return r181237;
}

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