Average Error: 61.8 → 0.3
Time: 22.6s
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 r1457640 = 1.0;
        double r1457641 = t;
        double r1457642 = 2e-16;
        double r1457643 = r1457641 * r1457642;
        double r1457644 = r1457640 + r1457643;
        double r1457645 = r1457644 * r1457644;
        double r1457646 = -1.0;
        double r1457647 = 2.0;
        double r1457648 = r1457647 * r1457643;
        double r1457649 = r1457646 - r1457648;
        double r1457650 = r1457645 + r1457649;
        return r1457650;
}

double f(double t) {
        double r1457651 = 2e-16;
        double r1457652 = t;
        double r1457653 = r1457651 * r1457652;
        double r1457654 = r1457653 * r1457652;
        double r1457655 = r1457654 * r1457651;
        return r1457655;
}

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(2 \cdot 10^{-16} \cdot t\right) \cdot \left(2 \cdot 10^{-16} \cdot t\right)}\]
  3. Using strategy rm
  4. Applied associate-*l*0.3

    \[\leadsto \color{blue}{2 \cdot 10^{-16} \cdot \left(t \cdot \left(2 \cdot 10^{-16} \cdot t\right)\right)}\]
  5. 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 2019139 +o rules:numerics
(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)))))