Average Error: 0.2 → 0
Time: 4.3s
Precision: 64
\[d \cdot 10 + d \cdot 20\]
\[d \cdot \left(20 + 10\right)\]
double f(double d) {
        double r2208504 = d;
        double r2208505 = 10.0;
        double r2208506 = r2208504 * r2208505;
        double r2208507 = 20.0;
        double r2208508 = r2208504 * r2208507;
        double r2208509 = r2208506 + r2208508;
        return r2208509;
}

double f(double d) {
        double r2208510 = d;
        double r2208511 = 20.0;
        double r2208512 = 10.0;
        double r2208513 = r2208511 + r2208512;
        double r2208514 = r2208510 * r2208513;
        return r2208514;
}

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 2019102 
(FPCore (d)
  :name "FastMath test1"
  (+.p16 (*.p16 d (real->posit16 10)) (*.p16 d (real->posit16 20))))