Average Error: 61.8 → 0.3
Time: 15.8s
Precision: 64
\[0.9 \le t \le 1.1\]
\[\left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(1 + t \cdot 2 \cdot 10^{-16}\right) + \left(-1 - 2 \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right)\]
\[3.9999999999999997 \cdot 10^{-32} \cdot \left(t \cdot t\right)\]
\left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(1 + t \cdot 2 \cdot 10^{-16}\right) + \left(-1 - 2 \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right)
3.9999999999999997 \cdot 10^{-32} \cdot \left(t \cdot t\right)
double f(double t) {
        double r2648698 = 1.0;
        double r2648699 = t;
        double r2648700 = 2e-16;
        double r2648701 = r2648699 * r2648700;
        double r2648702 = r2648698 + r2648701;
        double r2648703 = r2648702 * r2648702;
        double r2648704 = -1.0;
        double r2648705 = 2.0;
        double r2648706 = r2648705 * r2648701;
        double r2648707 = r2648704 - r2648706;
        double r2648708 = r2648703 + r2648707;
        return r2648708;
}

double f(double t) {
        double r2648709 = 3.9999999999999997e-32;
        double r2648710 = t;
        double r2648711 = r2648710 * r2648710;
        double r2648712 = r2648709 * r2648711;
        return r2648712;
}

Error

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.8
Target50.6
Herbie0.3
\[\mathsf{fma}\left(1 + t \cdot 2 \cdot 10^{-16}, 1 + t \cdot 2 \cdot 10^{-16}, -1 - 2 \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right)\]

Derivation

  1. Initial program 61.8

    \[\left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(1 + t \cdot 2 \cdot 10^{-16}\right) + \left(-1 - 2 \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right)\]
  2. Simplified0.4

    \[\leadsto \color{blue}{\left(t \cdot 2 \cdot 10^{-16}\right) \cdot \left(t \cdot 2 \cdot 10^{-16}\right)}\]
  3. Taylor expanded around 0 0.3

    \[\leadsto \color{blue}{3.9999999999999997 \cdot 10^{-32} \cdot {t}^{2}}\]
  4. Simplified0.3

    \[\leadsto \color{blue}{3.9999999999999997 \cdot 10^{-32} \cdot \left(t \cdot t\right)}\]
  5. Final simplification0.3

    \[\leadsto 3.9999999999999997 \cdot 10^{-32} \cdot \left(t \cdot t\right)\]

Reproduce

herbie shell --seed 2019163 
(FPCore (t)
  :name "fma_test1"
  :pre (<= 0.9 t 1.1)

  :herbie-target
  (fma (+ 1 (* t 2e-16)) (+ 1 (* t 2e-16)) (- -1 (* 2 (* t 2e-16))))

  (+ (* (+ 1 (* t 2e-16)) (+ 1 (* t 2e-16))) (- -1 (* 2 (* t 2e-16)))))