Average Error: 61.8 → 0.3
Time: 11.4s
Precision: 64
\[\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 r4062624 = 1.0;
        double r4062625 = t;
        double r4062626 = 2e-16;
        double r4062627 = r4062625 * r4062626;
        double r4062628 = r4062624 + r4062627;
        double r4062629 = r4062628 * r4062628;
        double r4062630 = -1.0;
        double r4062631 = 2.0;
        double r4062632 = r4062631 * r4062627;
        double r4062633 = r4062630 - r4062632;
        double r4062634 = r4062629 + r4062633;
        return r4062634;
}

double f(double t) {
        double r4062635 = 3.9999999999999997e-32;
        double r4062636 = t;
        double r4062637 = r4062636 * r4062636;
        double r4062638 = r4062635 * r4062637;
        return r4062638;
}

\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)

Error

Bits error versus t

Target

Original61.8
Target50.6
Herbie0.3
\[(\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))_*\]

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.5

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

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

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

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

Reproduce

herbie shell --seed 2019102 
(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)))))