Average Error: 0.3 → 0.1
Time: 15.7s
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 r1397398 = d1;
        double r1397399 = 10.0;
        double r1397400 = /* ERROR: no posit support in C */;
        double r1397401 = r1397398 * r1397400;
        double r1397402 = d2;
        double r1397403 = r1397398 * r1397402;
        double r1397404 = r1397401 + r1397403;
        double r1397405 = 20.0;
        double r1397406 = /* ERROR: no posit support in C */;
        double r1397407 = r1397398 * r1397406;
        double r1397408 = r1397404 + r1397407;
        return r1397408;
}

double f(double d1, double d2) {
        double r1397409 = d1;
        double r1397410 = 10.0;
        double r1397411 = r1397409 * r1397410;
        double r1397412 = /*Error: no posit support in C */;
        double r1397413 = d2;
        double r1397414 = /*Error: no posit support in C */;
        double r1397415 = 20.0;
        double r1397416 = /*Error: no posit support in C */;
        double r1397417 = /*Error: no posit support in C */;
        return r1397417;
}

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