Average Error: 0.2 → 0
Time: 3.6s
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 r3825667 = d;
        double r3825668 = 10.0;
        double r3825669 = /* ERROR: no posit support in C */;
        double r3825670 = r3825667 * r3825669;
        double r3825671 = 20.0;
        double r3825672 = /* ERROR: no posit support in C */;
        double r3825673 = r3825667 * r3825672;
        double r3825674 = r3825670 + r3825673;
        return r3825674;
}

double f(double d) {
        double r3825675 = d;
        double r3825676 = 20.0;
        double r3825677 = 10.0;
        double r3825678 = r3825676 + r3825677;
        double r3825679 = r3825675 * r3825678;
        return r3825679;
}

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))))