Average Error: 0.5 → 0.3
Time: 12.8s
Precision: 64
\[\frac{\left(\frac{\left(d1 \cdot \left(3\right)\right)}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot d3\right)}\]
\[\left(\mathsf{qma}\left(\left(\mathsf{qma}\left(\left(\left(d1 \cdot 3\right)\right), d1, d2\right)\right), d1, d3\right)\right)\]
\frac{\left(\frac{\left(d1 \cdot \left(3\right)\right)}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot d3\right)}
\left(\mathsf{qma}\left(\left(\mathsf{qma}\left(\left(\left(d1 \cdot 3\right)\right), d1, d2\right)\right), d1, d3\right)\right)
double f(double d1, double d2, double d3) {
        double r1225891 = d1;
        double r1225892 = 3.0;
        double r1225893 = /* ERROR: no posit support in C */;
        double r1225894 = r1225891 * r1225893;
        double r1225895 = d2;
        double r1225896 = r1225891 * r1225895;
        double r1225897 = r1225894 + r1225896;
        double r1225898 = d3;
        double r1225899 = r1225891 * r1225898;
        double r1225900 = r1225897 + r1225899;
        return r1225900;
}

double f(double d1, double d2, double d3) {
        double r1225901 = d1;
        double r1225902 = 3.0;
        double r1225903 = r1225901 * r1225902;
        double r1225904 = /*Error: no posit support in C */;
        double r1225905 = d2;
        double r1225906 = /*Error: no posit support in C */;
        double r1225907 = d3;
        double r1225908 = /*Error: no posit support in C */;
        double r1225909 = /*Error: no posit support in C */;
        return r1225909;
}

Error

Bits error versus d1

Bits error versus d2

Bits error versus d3

Derivation

  1. Initial program 0.5

    \[\frac{\left(\frac{\left(d1 \cdot \left(3\right)\right)}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot d3\right)}\]
  2. Using strategy rm
  3. Applied introduce-quire0.5

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

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

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

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

Reproduce

herbie shell --seed 2019156 
(FPCore (d1 d2 d3)
  :name "FastMath test3"
  (+.p16 (+.p16 (*.p16 d1 (real->posit16 3)) (*.p16 d1 d2)) (*.p16 d1 d3)))