Average Error: 0.2 → 0
Time: 3.7s
Precision: 64
\[\frac{\left(d \cdot \left(10\right)\right)}{\left(d \cdot \left(20\right)\right)}\]
\[d \cdot \left(20 + 10\right)\]
\frac{\left(d \cdot \left(10\right)\right)}{\left(d \cdot \left(20\right)\right)}
d \cdot \left(20 + 10\right)
double f(double d) {
        double r4137152 = d;
        double r4137153 = 10.0;
        double r4137154 = /* ERROR: no posit support in C */;
        double r4137155 = r4137152 * r4137154;
        double r4137156 = 20.0;
        double r4137157 = /* ERROR: no posit support in C */;
        double r4137158 = r4137152 * r4137157;
        double r4137159 = r4137155 + r4137158;
        return r4137159;
}

double f(double d) {
        double r4137160 = d;
        double r4137161 = 20.0;
        double r4137162 = 10.0;
        double r4137163 = r4137161 + r4137162;
        double r4137164 = r4137160 * r4137163;
        return r4137164;
}

Error

Bits error versus d

Derivation

  1. Initial program 0.2

    \[\frac{\left(d \cdot \left(10\right)\right)}{\left(d \cdot \left(20\right)\right)}\]
  2. Simplified0

    \[\leadsto \color{blue}{d \cdot \left(\frac{\left(20\right)}{\left(10\right)}\right)}\]
  3. Final simplification0

    \[\leadsto d \cdot \left(20 + 10\right)\]

Reproduce

herbie shell --seed 2019158 
(FPCore (d)
  :name "FastMath test1"
  (+.p16 (*.p16 d (real->posit16 10)) (*.p16 d (real->posit16 20))))