Average Error: 0.2 → 0
Time: 4.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 r270149 = d;
        double r270150 = 10.0;
        double r270151 = /* ERROR: no posit support in C */;
        double r270152 = r270149 * r270151;
        double r270153 = 20.0;
        double r270154 = /* ERROR: no posit support in C */;
        double r270155 = r270149 * r270154;
        double r270156 = r270152 + r270155;
        return r270156;
}

double f(double d) {
        double r270157 = d;
        double r270158 = 20.0;
        double r270159 = 10.0;
        double r270160 = r270158 + r270159;
        double r270161 = r270157 * r270160;
        return r270161;
}

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 2019152 
(FPCore (d)
  :name "FastMath test1"
  (+.p16 (*.p16 d (real->posit16 10)) (*.p16 d (real->posit16 20))))