Average Error: 0 → 0
Time: 573.0ms
Precision: 64
\[\left(\left(\left(x + x\right) + x\right) + x\right) + x\]
\[\mathsf{fma}\left(x, 4, x\right)\]
\left(\left(\left(x + x\right) + x\right) + x\right) + x
\mathsf{fma}\left(x, 4, x\right)
double f(double x) {
        double r171003 = x;
        double r171004 = r171003 + r171003;
        double r171005 = r171004 + r171003;
        double r171006 = r171005 + r171003;
        double r171007 = r171006 + r171003;
        return r171007;
}

double f(double x) {
        double r171008 = x;
        double r171009 = 4.0;
        double r171010 = fma(r171008, r171009, r171008);
        return r171010;
}

Error

Bits error versus x

Derivation

  1. Initial program 0

    \[\left(\left(\left(x + x\right) + x\right) + x\right) + x\]
  2. Simplified0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 4, x\right)}\]
  3. Final simplification0

    \[\leadsto \mathsf{fma}\left(x, 4, x\right)\]

Reproduce

herbie shell --seed 2020020 +o rules:numerics
(FPCore (x)
  :name "Main:i from "
  :precision binary64
  (+ (+ (+ (+ x x) x) x) x))