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 r1081643 = d1;
        double r1081644 = 10.0;
        double r1081645 = /* ERROR: no posit support in C */;
        double r1081646 = r1081643 * r1081645;
        double r1081647 = d2;
        double r1081648 = r1081643 * r1081647;
        double r1081649 = r1081646 + r1081648;
        double r1081650 = 20.0;
        double r1081651 = /* ERROR: no posit support in C */;
        double r1081652 = r1081643 * r1081651;
        double r1081653 = r1081649 + r1081652;
        return r1081653;
}

double f(double d1, double d2) {
        double r1081654 = d1;
        double r1081655 = 10.0;
        double r1081656 = d2;
        double r1081657 = r1081655 + r1081656;
        double r1081658 = r1081654 * r1081657;
        double r1081659 = 20.0;
        double r1081660 = r1081654 * r1081659;
        double r1081661 = r1081658 + r1081660;
        return r1081661;
}

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