Average Error: 0.3 → 0.3
Time: 10.8s
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 r5467484 = d1;
        double r5467485 = 10.0;
        double r5467486 = /* ERROR: no posit support in C */;
        double r5467487 = r5467484 * r5467486;
        double r5467488 = d2;
        double r5467489 = r5467484 * r5467488;
        double r5467490 = r5467487 + r5467489;
        double r5467491 = 20.0;
        double r5467492 = /* ERROR: no posit support in C */;
        double r5467493 = r5467484 * r5467492;
        double r5467494 = r5467490 + r5467493;
        return r5467494;
}

double f(double d1, double d2) {
        double r5467495 = d1;
        double r5467496 = 10.0;
        double r5467497 = d2;
        double r5467498 = r5467496 + r5467497;
        double r5467499 = r5467495 * r5467498;
        double r5467500 = 20.0;
        double r5467501 = r5467495 * r5467500;
        double r5467502 = r5467499 + r5467501;
        return r5467502;
}

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