Average Error: 0.2 → 0
Time: 4.1s
Precision: 64
\[d \cdot 10 + d \cdot 20\]
\[d \cdot \left(20 + 10\right)\]
double f(double d) {
        double r1205357 = d;
        double r1205358 = 10.0;
        double r1205359 = r1205357 * r1205358;
        double r1205360 = 20.0;
        double r1205361 = r1205357 * r1205360;
        double r1205362 = r1205359 + r1205361;
        return r1205362;
}

double f(double d) {
        double r1205363 = d;
        double r1205364 = 20.0;
        double r1205365 = 10.0;
        double r1205366 = r1205364 + r1205365;
        double r1205367 = r1205363 * r1205366;
        return r1205367;
}

d \cdot 10 + d \cdot 20
d \cdot \left(20 + 10\right)

Error

Bits error versus d

Derivation

  1. Initial program 0.2

    \[\frac{\left(d \cdot \left(10\right)\right)}{\left(d \cdot \left(20\right)\right)}\]
  2. Simplified0

    \[\leadsto \color{blue}{d \cdot \left(\frac{\left(20\right)}{\left(10\right)}\right)}\]
  3. Final simplification0

    \[\leadsto d \cdot \left(20 + 10\right)\]

Reproduce

herbie shell --seed 2019101 
(FPCore (d)
  :name "FastMath test1"
  (+.p16 (*.p16 d (real->posit16 10)) (*.p16 d (real->posit16 20))))