Average Error: 0.2 → 0
Time: 4.4s
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 r296033 = d;
        double r296034 = 10.0;
        double r296035 = /* ERROR: no posit support in C */;
        double r296036 = r296033 * r296035;
        double r296037 = 20.0;
        double r296038 = /* ERROR: no posit support in C */;
        double r296039 = r296033 * r296038;
        double r296040 = r296036 + r296039;
        return r296040;
}

double f(double d) {
        double r296041 = d;
        double r296042 = 20.0;
        double r296043 = 10.0;
        double r296044 = r296042 + r296043;
        double r296045 = r296041 * r296044;
        return r296045;
}

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