Average Error: 0.5 → 0.3
Time: 11.9s
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 r1341145 = d1;
        double r1341146 = 3.0;
        double r1341147 = /* ERROR: no posit support in C */;
        double r1341148 = r1341145 * r1341147;
        double r1341149 = d2;
        double r1341150 = r1341145 * r1341149;
        double r1341151 = r1341148 + r1341150;
        double r1341152 = d3;
        double r1341153 = r1341145 * r1341152;
        double r1341154 = r1341151 + r1341153;
        return r1341154;
}

double f(double d1, double d2, double d3) {
        double r1341155 = d1;
        double r1341156 = 3.0;
        double r1341157 = r1341155 * r1341156;
        double r1341158 = /*Error: no posit support in C */;
        double r1341159 = d2;
        double r1341160 = /*Error: no posit support in C */;
        double r1341161 = d3;
        double r1341162 = /*Error: no posit support in C */;
        double r1341163 = /*Error: no posit support in C */;
        return r1341163;
}

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 +o rules:numerics
(FPCore (d1 d2 d3)
  :name "FastMath test3"
  (+.p16 (+.p16 (*.p16 d1 (real->posit16 3)) (*.p16 d1 d2)) (*.p16 d1 d3)))