Average Error: 0.2 → 0
Time: 4.0s
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 r6162771 = d;
        double r6162772 = 10.0;
        double r6162773 = /* ERROR: no posit support in C */;
        double r6162774 = r6162771 * r6162773;
        double r6162775 = 20.0;
        double r6162776 = /* ERROR: no posit support in C */;
        double r6162777 = r6162771 * r6162776;
        double r6162778 = r6162774 + r6162777;
        return r6162778;
}

double f(double d) {
        double r6162779 = d;
        double r6162780 = 20.0;
        double r6162781 = 10.0;
        double r6162782 = r6162780 + r6162781;
        double r6162783 = r6162779 * r6162782;
        return r6162783;
}

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