Average Error: 0.3 → 0.1
Time: 19.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)}\]
\[\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)\]
\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 \left(10\right)\right)\right), d1, d2\right)\right), d1, \left(20\right)\right)\right)
double f(double d1, double d2) {
        double r3646679 = d1;
        double r3646680 = 10.0;
        double r3646681 = /* ERROR: no posit support in C */;
        double r3646682 = r3646679 * r3646681;
        double r3646683 = d2;
        double r3646684 = r3646679 * r3646683;
        double r3646685 = r3646682 + r3646684;
        double r3646686 = 20.0;
        double r3646687 = /* ERROR: no posit support in C */;
        double r3646688 = r3646679 * r3646687;
        double r3646689 = r3646685 + r3646688;
        return r3646689;
}

double f(double d1, double d2) {
        double r3646690 = d1;
        double r3646691 = 10.0;
        double r3646692 = /* ERROR: no posit support in C */;
        double r3646693 = r3646690 * r3646692;
        double r3646694 = /*Error: no posit support in C */;
        double r3646695 = d2;
        double r3646696 = /*Error: no posit support in C */;
        double r3646697 = 20.0;
        double r3646698 = /* ERROR: no posit support in C */;
        double r3646699 = /*Error: no posit support in C */;
        double r3646700 = /*Error: no posit support in C */;
        return r3646700;
}

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 \left(10\right)\right)\right), d1, d2\right)\right), d1, \left(20\right)\right)\right)\]

Reproduce

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