Average Error: 0.1 → 0.0
Time: 2.1s
Precision: 64
\[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5\]
\[\mathsf{fma}\left(y, x, \mathsf{fma}\left(5, y, \mathsf{fma}\left(x, \mathsf{fma}\left(2, z, y\right), x \cdot t\right)\right)\right)\]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\mathsf{fma}\left(y, x, \mathsf{fma}\left(5, y, \mathsf{fma}\left(x, \mathsf{fma}\left(2, z, y\right), x \cdot t\right)\right)\right)
double code(double x, double y, double z, double t) {
	return ((x * ((((y + z) + z) + y) + t)) + (y * 5.0));
}
double code(double x, double y, double z, double t) {
	return fma(y, x, fma(5.0, y, fma(x, fma(2.0, z, y), (x * t))));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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. Using strategy rm
  3. Applied associate-+l+0.1

    \[\leadsto x \cdot \left(\left(\color{blue}{\left(y + \left(z + z\right)\right)} + y\right) + t\right) + y \cdot 5\]
  4. Applied associate-+l+0.1

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

    \[\leadsto x \cdot \color{blue}{\left(y + \left(\left(\left(z + z\right) + y\right) + t\right)\right)} + y \cdot 5\]
  6. Applied distribute-lft-in0.1

    \[\leadsto \color{blue}{\left(x \cdot y + x \cdot \left(\left(\left(z + z\right) + y\right) + t\right)\right)} + y \cdot 5\]
  7. Applied associate-+l+0.1

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

    \[\leadsto x \cdot y + \color{blue}{\mathsf{fma}\left(5, y, \mathsf{fma}\left(x, \mathsf{fma}\left(2, z, y\right), x \cdot t\right)\right)}\]
  9. Using strategy rm
  10. Applied *-commutative0.0

    \[\leadsto \color{blue}{y \cdot x} + \mathsf{fma}\left(5, y, \mathsf{fma}\left(x, \mathsf{fma}\left(2, z, y\right), x \cdot t\right)\right)\]
  11. Applied fma-def0.0

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

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

Reproduce

herbie shell --seed 2020078 +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)))