Average Error: 0.1 → 0.1
Time: 16.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, 5, \mathsf{fma}\left(\left(y + z\right) \cdot 2, x, 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, 5, \mathsf{fma}\left(\left(y + z\right) \cdot 2, x, t \cdot x\right)\right)
double f(double x, double y, double z, double t) {
        double r6034242 = x;
        double r6034243 = y;
        double r6034244 = z;
        double r6034245 = r6034243 + r6034244;
        double r6034246 = r6034245 + r6034244;
        double r6034247 = r6034246 + r6034243;
        double r6034248 = t;
        double r6034249 = r6034247 + r6034248;
        double r6034250 = r6034242 * r6034249;
        double r6034251 = 5.0;
        double r6034252 = r6034243 * r6034251;
        double r6034253 = r6034250 + r6034252;
        return r6034253;
}

double f(double x, double y, double z, double t) {
        double r6034254 = y;
        double r6034255 = 5.0;
        double r6034256 = z;
        double r6034257 = r6034254 + r6034256;
        double r6034258 = 2.0;
        double r6034259 = r6034257 * r6034258;
        double r6034260 = x;
        double r6034261 = t;
        double r6034262 = r6034261 * r6034260;
        double r6034263 = fma(r6034259, r6034260, r6034262);
        double r6034264 = fma(r6034254, r6034255, r6034263);
        return r6034264;
}

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, 5, x \cdot \mathsf{fma}\left(y + z, 2, t\right)\right)}\]
  3. Using strategy rm
  4. Applied fma-udef0.1

    \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(\left(y + z\right) \cdot 2 + t\right)}\right)\]
  5. Applied distribute-rgt-in0.1

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

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

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

Reproduce

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