Average Error: 0.1 → 0.1
Time: 20.7s
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 r101530 = x;
        double r101531 = y;
        double r101532 = sin(r101531);
        double r101533 = r101530 * r101532;
        double r101534 = z;
        double r101535 = cos(r101531);
        double r101536 = r101534 * r101535;
        double r101537 = r101533 + r101536;
        return r101537;
}

double f(double x, double y, double z) {
        double r101538 = x;
        double r101539 = y;
        double r101540 = sin(r101539);
        double r101541 = z;
        double r101542 = cos(r101539);
        double r101543 = r101541 * r101542;
        double r101544 = fma(r101538, r101540, r101543);
        return r101544;
}

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