Average Error: 0.3 → 0.1
Time: 18.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), \left(d1 \cdot d2\right), 1.0\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), \left(d1 \cdot d2\right), 1.0\right)\right), d1, 20\right)\right)
double f(double d1, double d2) {
        double r1616253 = d1;
        double r1616254 = 10.0;
        double r1616255 = /* ERROR: no posit support in C */;
        double r1616256 = r1616253 * r1616255;
        double r1616257 = d2;
        double r1616258 = r1616253 * r1616257;
        double r1616259 = r1616256 + r1616258;
        double r1616260 = 20.0;
        double r1616261 = /* ERROR: no posit support in C */;
        double r1616262 = r1616253 * r1616261;
        double r1616263 = r1616259 + r1616262;
        return r1616263;
}

double f(double d1, double d2) {
        double r1616264 = d1;
        double r1616265 = 10.0;
        double r1616266 = r1616264 * r1616265;
        double r1616267 = /*Error: no posit support in C */;
        double r1616268 = d2;
        double r1616269 = r1616264 * r1616268;
        double r1616270 = 1.0;
        double r1616271 = /*Error: no posit support in C */;
        double r1616272 = 20.0;
        double r1616273 = /*Error: no posit support in C */;
        double r1616274 = /*Error: no posit support in C */;
        return r1616274;
}

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-add0.3

    \[\leadsto \frac{\color{blue}{\left(\left(\mathsf{qma}\left(\left(\left(d1 \cdot \left(10\right)\right)\right), \left(d1 \cdot d2\right), \left(1.0\right)\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), \left(d1 \cdot d2\right), \left(1.0\right)\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), \left(d1 \cdot d2\right), 1.0\right)\right), d1, 20\right)\right)\]

Reproduce

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