Average Error: 0.0 → 0.0
Time: 859.0ms
Precision: 64
\[\left(\frac{x}{2} + y \cdot x\right) + z\]
\[\mathsf{fma}\left(x, y, z + \frac{x}{2}\right)\]
\left(\frac{x}{2} + y \cdot x\right) + z
\mathsf{fma}\left(x, y, z + \frac{x}{2}\right)
double f(double x, double y, double z) {
        double r198379 = x;
        double r198380 = 2.0;
        double r198381 = r198379 / r198380;
        double r198382 = y;
        double r198383 = r198382 * r198379;
        double r198384 = r198381 + r198383;
        double r198385 = z;
        double r198386 = r198384 + r198385;
        return r198386;
}

double f(double x, double y, double z) {
        double r198387 = x;
        double r198388 = y;
        double r198389 = z;
        double r198390 = 2.0;
        double r198391 = r198387 / r198390;
        double r198392 = r198389 + r198391;
        double r198393 = fma(r198387, r198388, r198392);
        return r198393;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.0

    \[\left(\frac{x}{2} + y \cdot x\right) + z\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, z\right) + \frac{x}{2}}\]
  3. Using strategy rm
  4. Applied fma-udef0.0

    \[\leadsto \color{blue}{\left(x \cdot y + z\right)} + \frac{x}{2}\]
  5. Applied associate-+l+0.0

    \[\leadsto \color{blue}{x \cdot y + \left(z + \frac{x}{2}\right)}\]
  6. Using strategy rm
  7. Applied fma-def0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, z + \frac{x}{2}\right)}\]
  8. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(x, y, z + \frac{x}{2}\right)\]

Reproduce

herbie shell --seed 2020001 +o rules:numerics
(FPCore (x y z)
  :name "Data.Histogram.Bin.BinF:$cfromIndex from histogram-fill-0.8.4.1"
  :precision binary64
  (+ (+ (/ x 2) (* y x)) z))