Average Error: 0.1 → 0.0
Time: 1.4s
Precision: 64
\[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5\]
\[\mathsf{fma}\left(y + z, x + x, \mathsf{fma}\left(5, y, t \cdot x\right)\right)\]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\mathsf{fma}\left(y + z, x + x, \mathsf{fma}\left(5, y, t \cdot x\right)\right)
double f(double x, double y, double z, double t) {
        double r123283 = x;
        double r123284 = y;
        double r123285 = z;
        double r123286 = r123284 + r123285;
        double r123287 = r123286 + r123285;
        double r123288 = r123287 + r123284;
        double r123289 = t;
        double r123290 = r123288 + r123289;
        double r123291 = r123283 * r123290;
        double r123292 = 5.0;
        double r123293 = r123284 * r123292;
        double r123294 = r123291 + r123293;
        return r123294;
}

double f(double x, double y, double z, double t) {
        double r123295 = y;
        double r123296 = z;
        double r123297 = r123295 + r123296;
        double r123298 = x;
        double r123299 = r123298 + r123298;
        double r123300 = 5.0;
        double r123301 = t;
        double r123302 = r123301 * r123298;
        double r123303 = fma(r123300, r123295, r123302);
        double r123304 = fma(r123297, r123299, r123303);
        return r123304;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 0.1

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5\]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(y + z, x + x, \mathsf{fma}\left(t, x, y \cdot 5\right)\right)}\]
  3. Taylor expanded around 0 0.1

    \[\leadsto \mathsf{fma}\left(y + z, x + x, \color{blue}{5 \cdot y + t \cdot x}\right)\]
  4. Simplified0.0

    \[\leadsto \mathsf{fma}\left(y + z, x + x, \color{blue}{\mathsf{fma}\left(5, y, t \cdot x\right)}\right)\]
  5. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(y + z, x + x, \mathsf{fma}\left(5, y, t \cdot x\right)\right)\]

Reproduce

herbie shell --seed 2020001 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
  :precision binary64
  (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5)))