Average Error: 0.2 → 0
Time: 3.8s
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 r3513798 = d;
        double r3513799 = 10.0;
        double r3513800 = /* ERROR: no posit support in C */;
        double r3513801 = r3513798 * r3513800;
        double r3513802 = 20.0;
        double r3513803 = /* ERROR: no posit support in C */;
        double r3513804 = r3513798 * r3513803;
        double r3513805 = r3513801 + r3513804;
        return r3513805;
}

double f(double d) {
        double r3513806 = d;
        double r3513807 = 20.0;
        double r3513808 = 10.0;
        double r3513809 = r3513807 + r3513808;
        double r3513810 = r3513806 * r3513809;
        return r3513810;
}

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