Average Error: 0.3 → 0.3
Time: 7.9s
Precision: 64
\[\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20\]
\[d1 \cdot \left(10 + d2\right) + d1 \cdot 20\]
double f(double d1, double d2) {
        double r736961 = d1;
        double r736962 = 10.0;
        double r736963 = r736961 * r736962;
        double r736964 = d2;
        double r736965 = r736961 * r736964;
        double r736966 = r736963 + r736965;
        double r736967 = 20.0;
        double r736968 = r736961 * r736967;
        double r736969 = r736966 + r736968;
        return r736969;
}

double f(double d1, double d2) {
        double r736970 = d1;
        double r736971 = 10.0;
        double r736972 = d2;
        double r736973 = r736971 + r736972;
        double r736974 = r736970 * r736973;
        double r736975 = 20.0;
        double r736976 = r736970 * r736975;
        double r736977 = r736974 + r736976;
        return r736977;
}

\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20
d1 \cdot \left(10 + d2\right) + d1 \cdot 20

Error

Bits error versus d1

Bits error versus d2

Derivation

  1. Initial program 0.3

    \[\frac{\left(\frac{\left(d1 \cdot \left(10\right)\right)}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot \left(20\right)\right)}\]
  2. Using strategy rm
  3. Applied distribute-lft-out0.3

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

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

Reproduce

herbie shell --seed 2019102 
(FPCore (d1 d2)
  :name "FastMath test2"
  (+.p16 (+.p16 (*.p16 d1 (real->posit16 10)) (*.p16 d1 d2)) (*.p16 d1 (real->posit16 20))))