Average Error: 0.1 → 0.0
Time: 4.2s
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 r155337 = x;
        double r155338 = y;
        double r155339 = z;
        double r155340 = r155338 + r155339;
        double r155341 = r155340 + r155339;
        double r155342 = r155341 + r155338;
        double r155343 = t;
        double r155344 = r155342 + r155343;
        double r155345 = r155337 * r155344;
        double r155346 = 5.0;
        double r155347 = r155338 * r155346;
        double r155348 = r155345 + r155347;
        return r155348;
}

double f(double x, double y, double z, double t) {
        double r155349 = y;
        double r155350 = z;
        double r155351 = r155349 + r155350;
        double r155352 = x;
        double r155353 = r155352 + r155352;
        double r155354 = 5.0;
        double r155355 = t;
        double r155356 = r155355 * r155352;
        double r155357 = fma(r155354, r155349, r155356);
        double r155358 = fma(r155351, r155353, r155357);
        return r155358;
}

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