Average Error: 61.8 → 0.3
Time: 10.4s
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)\]
\[\left(3.9999999999999997 \cdot 10^{-32} \cdot t\right) \cdot t\]
\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)
\left(3.9999999999999997 \cdot 10^{-32} \cdot t\right) \cdot t
double f(double t) {
        double r1381126 = 1.0;
        double r1381127 = t;
        double r1381128 = 2e-16;
        double r1381129 = r1381127 * r1381128;
        double r1381130 = r1381126 + r1381129;
        double r1381131 = r1381130 * r1381130;
        double r1381132 = -1.0;
        double r1381133 = 2.0;
        double r1381134 = r1381133 * r1381129;
        double r1381135 = r1381132 - r1381134;
        double r1381136 = r1381131 + r1381135;
        return r1381136;
}

double f(double t) {
        double r1381137 = 3.9999999999999997e-32;
        double r1381138 = t;
        double r1381139 = r1381137 * r1381138;
        double r1381140 = r1381139 * r1381138;
        return r1381140;
}

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. Simplified61.8

    \[\leadsto \color{blue}{\left(2 \cdot 10^{-16} \cdot t\right) \cdot \left(\left(2 + 2 \cdot 10^{-16} \cdot t\right) - 2\right)}\]
  3. Using strategy rm
  4. Applied associate-*l*61.8

    \[\leadsto \color{blue}{2 \cdot 10^{-16} \cdot \left(t \cdot \left(\left(2 + 2 \cdot 10^{-16} \cdot t\right) - 2\right)\right)}\]
  5. Simplified0.3

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

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

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

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

Reproduce

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