Average Error: 0 → 0
Time: 5.4s
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(\frac{1}{9} \cdot 2\right) \cdot \mathsf{fma}\left(2, 1, \frac{1}{9}\right)\]
2 \cdot \left(\left(1 \cdot \frac{1}{9} + \frac{1}{9} \cdot \frac{1}{9}\right) + \frac{1}{9} \cdot 1\right)
\left(\frac{1}{9} \cdot 2\right) \cdot \mathsf{fma}\left(2, 1, \frac{1}{9}\right)
double f() {
        double r44364 = 2.0;
        double r44365 = 1.0;
        double r44366 = 9.0;
        double r44367 = r44365 / r44366;
        double r44368 = r44365 * r44367;
        double r44369 = r44367 * r44367;
        double r44370 = r44368 + r44369;
        double r44371 = r44367 * r44365;
        double r44372 = r44370 + r44371;
        double r44373 = r44364 * r44372;
        return r44373;
}

double f() {
        double r44374 = 1.0;
        double r44375 = 9.0;
        double r44376 = r44374 / r44375;
        double r44377 = 2.0;
        double r44378 = r44376 * r44377;
        double r44379 = 2.0;
        double r44380 = fma(r44379, r44374, r44376);
        double r44381 = r44378 * r44380;
        return r44381;
}

Error

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(\frac{1}{9} \cdot 2\right) \cdot \mathsf{fma}\left(2, 1, \frac{1}{9}\right)}\]
  3. Final simplification0

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

Reproduce

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