Average Error: 0.3 → 0.1
Time: 14.1s
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 r1600059 = d1;
        double r1600060 = 10.0;
        double r1600061 = /* ERROR: no posit support in C */;
        double r1600062 = r1600059 * r1600061;
        double r1600063 = d2;
        double r1600064 = r1600059 * r1600063;
        double r1600065 = r1600062 + r1600064;
        double r1600066 = 20.0;
        double r1600067 = /* ERROR: no posit support in C */;
        double r1600068 = r1600059 * r1600067;
        double r1600069 = r1600065 + r1600068;
        return r1600069;
}

double f(double d1, double d2) {
        double r1600070 = d1;
        double r1600071 = 10.0;
        double r1600072 = r1600070 * r1600071;
        double r1600073 = /*Error: no posit support in C */;
        double r1600074 = d2;
        double r1600075 = /*Error: no posit support in C */;
        double r1600076 = 20.0;
        double r1600077 = /*Error: no posit support in C */;
        double r1600078 = /*Error: no posit support in C */;
        return r1600078;
}

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