Average Error: 0.3 → 0.3
Time: 10.1s
Precision: 64
\[\frac{\left(\frac{\left(d1 \cdot \left(10\right)\right)}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot \left(20\right)\right)}\]
\[d1 \cdot \left(10 + d2\right) + d1 \cdot 20\]
\frac{\left(\frac{\left(d1 \cdot \left(10\right)\right)}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot \left(20\right)\right)}
d1 \cdot \left(10 + d2\right) + d1 \cdot 20
double f(double d1, double d2) {
        double r1138061 = d1;
        double r1138062 = 10.0;
        double r1138063 = /* ERROR: no posit support in C */;
        double r1138064 = r1138061 * r1138063;
        double r1138065 = d2;
        double r1138066 = r1138061 * r1138065;
        double r1138067 = r1138064 + r1138066;
        double r1138068 = 20.0;
        double r1138069 = /* ERROR: no posit support in C */;
        double r1138070 = r1138061 * r1138069;
        double r1138071 = r1138067 + r1138070;
        return r1138071;
}

double f(double d1, double d2) {
        double r1138072 = d1;
        double r1138073 = 10.0;
        double r1138074 = d2;
        double r1138075 = r1138073 + r1138074;
        double r1138076 = r1138072 * r1138075;
        double r1138077 = 20.0;
        double r1138078 = r1138072 * r1138077;
        double r1138079 = r1138076 + r1138078;
        return r1138079;
}

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 2019104 +o rules:numerics
(FPCore (d1 d2)
  :name "FastMath test2"
  (+.p16 (+.p16 (*.p16 d1 (real->posit16 10)) (*.p16 d1 d2)) (*.p16 d1 (real->posit16 20))))