Average Error: 61.8 → 0.3
Time: 9.9s
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(\left(2 \cdot 10^{-16} \cdot t\right) \cdot t\right) \cdot 2 \cdot 10^{-16}\]
\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(\left(2 \cdot 10^{-16} \cdot t\right) \cdot t\right) \cdot 2 \cdot 10^{-16}
double f(double t) {
        double r1332545 = 1.0;
        double r1332546 = t;
        double r1332547 = 2e-16;
        double r1332548 = r1332546 * r1332547;
        double r1332549 = r1332545 + r1332548;
        double r1332550 = r1332549 * r1332549;
        double r1332551 = -1.0;
        double r1332552 = 2.0;
        double r1332553 = r1332552 * r1332548;
        double r1332554 = r1332551 - r1332553;
        double r1332555 = r1332550 + r1332554;
        return r1332555;
}

double f(double t) {
        double r1332556 = 2e-16;
        double r1332557 = t;
        double r1332558 = r1332556 * r1332557;
        double r1332559 = r1332558 * r1332557;
        double r1332560 = r1332559 * r1332556;
        return r1332560;
}

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. Final simplification0.3

    \[\leadsto \left(\left(2 \cdot 10^{-16} \cdot t\right) \cdot t\right) \cdot 2 \cdot 10^{-16}\]

Reproduce

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