Average Error: 0 → 0
Time: 1.7s
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)\]
\[\frac{38}{81}\]
double f() {
        double r5663178 = 2.0;
        double r5663179 = 1.0;
        double r5663180 = 9.0;
        double r5663181 = r5663179 / r5663180;
        double r5663182 = r5663179 * r5663181;
        double r5663183 = r5663181 * r5663181;
        double r5663184 = r5663182 + r5663183;
        double r5663185 = r5663181 * r5663179;
        double r5663186 = r5663184 + r5663185;
        double r5663187 = r5663178 * r5663186;
        return r5663187;
}

double f() {
        double r5663188 = 0.4691358024691358;
        return r5663188;
}

2 \cdot \left(\left(1 \cdot \frac{1}{9} + \frac{1}{9} \cdot \frac{1}{9}\right) + \frac{1}{9} \cdot 1\right)
\frac{38}{81}

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}{\frac{38}{81}}\]
  3. Final simplification0

    \[\leadsto \frac{38}{81}\]

Reproduce

herbie shell --seed 2019101 +o rules:numerics
(FPCore ()
  :name "Rectangular parallelepiped of dimension a×b×c"

  :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))))