Average Error: 0.3 → 0.3
Time: 10.0s
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 r2240936 = d1;
        double r2240937 = 10.0;
        double r2240938 = /* ERROR: no posit support in C */;
        double r2240939 = r2240936 * r2240938;
        double r2240940 = d2;
        double r2240941 = r2240936 * r2240940;
        double r2240942 = r2240939 + r2240941;
        double r2240943 = 20.0;
        double r2240944 = /* ERROR: no posit support in C */;
        double r2240945 = r2240936 * r2240944;
        double r2240946 = r2240942 + r2240945;
        return r2240946;
}

double f(double d1, double d2) {
        double r2240947 = d1;
        double r2240948 = 10.0;
        double r2240949 = d2;
        double r2240950 = r2240948 + r2240949;
        double r2240951 = r2240947 * r2240950;
        double r2240952 = 20.0;
        double r2240953 = r2240947 * r2240952;
        double r2240954 = r2240951 + r2240953;
        return r2240954;
}

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