Average Error: 0.4 → 0.2
Time: 6.2s
Precision: 64
\[\frac{\left(d1 \cdot d2\right)}{\left(d1 \cdot d3\right)}\]
\[\left(\mathsf{qma}\left(\left(\left(d1 \cdot d2\right)\right), d1, d3\right)\right)\]
\frac{\left(d1 \cdot d2\right)}{\left(d1 \cdot d3\right)}
\left(\mathsf{qma}\left(\left(\left(d1 \cdot d2\right)\right), d1, d3\right)\right)
double f(double d1, double d2, double d3) {
        double r4399988 = d1;
        double r4399989 = d2;
        double r4399990 = r4399988 * r4399989;
        double r4399991 = d3;
        double r4399992 = r4399988 * r4399991;
        double r4399993 = r4399990 + r4399992;
        return r4399993;
}

double f(double d1, double d2, double d3) {
        double r4399994 = d1;
        double r4399995 = d2;
        double r4399996 = r4399994 * r4399995;
        double r4399997 = /*Error: no posit support in C */;
        double r4399998 = d3;
        double r4399999 = /*Error: no posit support in C */;
        double r4400000 = /*Error: no posit support in C */;
        return r4400000;
}

Error

Bits error versus d1

Bits error versus d2

Bits error versus d3

Derivation

  1. Initial program 0.4

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

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

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

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

Reproduce

herbie shell --seed 2019158 
(FPCore (d1 d2 d3)
  :name "FastMath dist"
  (+.p16 (*.p16 d1 d2) (*.p16 d1 d3)))