Average Error: 0.2 → 0
Time: 5.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 r5744002 = d;
        double r5744003 = 10.0;
        double r5744004 = /* ERROR: no posit support in C */;
        double r5744005 = r5744002 * r5744004;
        double r5744006 = 20.0;
        double r5744007 = /* ERROR: no posit support in C */;
        double r5744008 = r5744002 * r5744007;
        double r5744009 = r5744005 + r5744008;
        return r5744009;
}

double f(double d) {
        double r5744010 = d;
        double r5744011 = 20.0;
        double r5744012 = 10.0;
        double r5744013 = r5744011 + r5744012;
        double r5744014 = r5744010 * r5744013;
        return r5744014;
}

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