Average Error: 0.3 → 0.1
Time: 18.6s
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)}\]
\[\left(\mathsf{qma}\left(\left(\mathsf{qma}\left(\left(\left(d1 \cdot 10\right)\right), d1, d2\right)\right), d1, 20\right)\right)\]
\frac{\left(\frac{\left(d1 \cdot \left(10\right)\right)}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot \left(20\right)\right)}
\left(\mathsf{qma}\left(\left(\mathsf{qma}\left(\left(\left(d1 \cdot 10\right)\right), d1, d2\right)\right), d1, 20\right)\right)
double f(double d1, double d2) {
        double r4371567 = d1;
        double r4371568 = 10.0;
        double r4371569 = /* ERROR: no posit support in C */;
        double r4371570 = r4371567 * r4371569;
        double r4371571 = d2;
        double r4371572 = r4371567 * r4371571;
        double r4371573 = r4371570 + r4371572;
        double r4371574 = 20.0;
        double r4371575 = /* ERROR: no posit support in C */;
        double r4371576 = r4371567 * r4371575;
        double r4371577 = r4371573 + r4371576;
        return r4371577;
}

double f(double d1, double d2) {
        double r4371578 = d1;
        double r4371579 = 10.0;
        double r4371580 = r4371578 * r4371579;
        double r4371581 = /*Error: no posit support in C */;
        double r4371582 = d2;
        double r4371583 = /*Error: no posit support in C */;
        double r4371584 = 20.0;
        double r4371585 = /*Error: no posit support in C */;
        double r4371586 = /*Error: no posit support in C */;
        return r4371586;
}

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 introduce-quire0.3

    \[\leadsto \frac{\left(\frac{\color{blue}{\left(\left(\left(d1 \cdot \left(10\right)\right)\right)\right)}}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot \left(20\right)\right)}\]
  4. Applied insert-quire-fdp-add0.3

    \[\leadsto \frac{\color{blue}{\left(\left(\mathsf{qma}\left(\left(\left(d1 \cdot \left(10\right)\right)\right), d1, d2\right)\right)\right)}}{\left(d1 \cdot \left(20\right)\right)}\]
  5. Applied insert-quire-fdp-add0.1

    \[\leadsto \color{blue}{\left(\mathsf{qma}\left(\left(\mathsf{qma}\left(\left(\left(d1 \cdot \left(10\right)\right)\right), d1, d2\right)\right), d1, \left(20\right)\right)\right)}\]
  6. Final simplification0.1

    \[\leadsto \left(\mathsf{qma}\left(\left(\mathsf{qma}\left(\left(\left(d1 \cdot 10\right)\right), d1, d2\right)\right), d1, 20\right)\right)\]

Reproduce

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