Average Error: 0.1 → 0.1
Time: 4.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 r186479 = x;
        double r186480 = y;
        double r186481 = sin(r186480);
        double r186482 = r186479 * r186481;
        double r186483 = z;
        double r186484 = cos(r186480);
        double r186485 = r186483 * r186484;
        double r186486 = r186482 + r186485;
        return r186486;
}

double f(double x, double y, double z) {
        double r186487 = x;
        double r186488 = y;
        double r186489 = sin(r186488);
        double r186490 = z;
        double r186491 = cos(r186488);
        double r186492 = r186490 * r186491;
        double r186493 = fma(r186487, r186489, r186492);
        return r186493;
}

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. Using strategy rm
  4. Applied *-un-lft-identity0.1

    \[\leadsto \color{blue}{1 \cdot \mathsf{fma}\left(x, \sin y, z \cdot \cos y\right)}\]
  5. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(x, \sin y, z \cdot \cos y\right)\]

Reproduce

herbie shell --seed 2020036 +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))))