Average Error: 0 → 0
Time: 387.0ms
Precision: 64
\[2 \cdot \left(\left(1 \cdot \frac{1}{9} + \frac{1}{9} \cdot \frac{1}{9}\right) + \frac{1}{9} \cdot 1\right)\]
\[\left(\mathsf{fma}\left(2, 1, \frac{1}{9}\right) \cdot \frac{2}{9}\right) \cdot 1\]
2 \cdot \left(\left(1 \cdot \frac{1}{9} + \frac{1}{9} \cdot \frac{1}{9}\right) + \frac{1}{9} \cdot 1\right)
\left(\mathsf{fma}\left(2, 1, \frac{1}{9}\right) \cdot \frac{2}{9}\right) \cdot 1
double code() {
	return (2.0 * (((1.0 * (1.0 / 9.0)) + ((1.0 / 9.0) * (1.0 / 9.0))) + ((1.0 / 9.0) * 1.0)));
}
double code() {
	return ((fma(2.0, 1.0, (1.0 / 9.0)) * (2.0 / 9.0)) * 1.0);
}

Error

Try it out

Your Program's Arguments

    Results

    Enter valid numbers for all inputs

    Target

    Original0
    Target0
    Herbie0
    \[\left(\left(\frac{1}{9} \cdot 1\right) \cdot 2 + 2 \cdot \left(\frac{1}{9} \cdot \frac{1}{9}\right)\right) + 2 \cdot \left(1 \cdot \frac{1}{9}\right)\]

    Derivation

    1. Initial program 0

      \[2 \cdot \left(\left(1 \cdot \frac{1}{9} + \frac{1}{9} \cdot \frac{1}{9}\right) + \frac{1}{9} \cdot 1\right)\]
    2. Simplified0

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(2, 1, \frac{1}{9}\right) \cdot \frac{2}{9}\right) \cdot 1}\]
    3. Final simplification0

      \[\leadsto \left(\mathsf{fma}\left(2, 1, \frac{1}{9}\right) \cdot \frac{2}{9}\right) \cdot 1\]

    Reproduce

    herbie shell --seed 2020091 +o rules:numerics
    (FPCore ()
      :name "Rectangular parallelepiped of dimension a×b×c"
      :precision binary64
    
      :herbie-target
      (+ (+ (* (* (/ 1 9) 1) 2) (* 2 (* (/ 1 9) (/ 1 9)))) (* 2 (* 1 (/ 1 9))))
    
      (* 2 (+ (+ (* 1 (/ 1 9)) (* (/ 1 9) (/ 1 9))) (* (/ 1 9) 1))))