Average Error: 0.2 → 0
Time: 3.3s
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 r1896831 = d;
        double r1896832 = 10.0;
        double r1896833 = /* ERROR: no posit support in C */;
        double r1896834 = r1896831 * r1896833;
        double r1896835 = 20.0;
        double r1896836 = /* ERROR: no posit support in C */;
        double r1896837 = r1896831 * r1896836;
        double r1896838 = r1896834 + r1896837;
        return r1896838;
}

double f(double d) {
        double r1896839 = d;
        double r1896840 = 20.0;
        double r1896841 = 10.0;
        double r1896842 = r1896840 + r1896841;
        double r1896843 = r1896839 * r1896842;
        return r1896843;
}

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