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 r3083963 = d;
        double r3083964 = 10.0;
        double r3083965 = /* ERROR: no posit support in C */;
        double r3083966 = r3083963 * r3083965;
        double r3083967 = 20.0;
        double r3083968 = /* ERROR: no posit support in C */;
        double r3083969 = r3083963 * r3083968;
        double r3083970 = r3083966 + r3083969;
        return r3083970;
}

double f(double d) {
        double r3083971 = d;
        double r3083972 = 20.0;
        double r3083973 = 10.0;
        double r3083974 = r3083972 + r3083973;
        double r3083975 = r3083971 * r3083974;
        return r3083975;
}

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