Average Error: 0.0 → 0.0
Time: 940.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 r198921 = x;
        double r198922 = 2.0;
        double r198923 = r198921 / r198922;
        double r198924 = y;
        double r198925 = r198924 * r198921;
        double r198926 = r198923 + r198925;
        double r198927 = z;
        double r198928 = r198926 + r198927;
        return r198928;
}

double f(double x, double y, double z) {
        double r198929 = x;
        double r198930 = y;
        double r198931 = z;
        double r198932 = 2.0;
        double r198933 = r198929 / r198932;
        double r198934 = r198931 + r198933;
        double r198935 = fma(r198929, r198930, r198934);
        return r198935;
}

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