Average Error: 61.8 → 0.3
Time: 33.9s
Precision: 64
\[0.9 \le t \le 1.1\]
\[\left(1.0 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(1.0 + t \cdot 2 \cdot 10^{-16}\right) + \left(-1.0 - 2.0 \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right)\]
\[\left(3.9999999999999997 \cdot 10^{-32} \cdot t\right) \cdot t\]
\left(1.0 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(1.0 + t \cdot 2 \cdot 10^{-16}\right) + \left(-1.0 - 2.0 \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 r3859699 = 1.0;
        double r3859700 = t;
        double r3859701 = 2e-16;
        double r3859702 = r3859700 * r3859701;
        double r3859703 = r3859699 + r3859702;
        double r3859704 = r3859703 * r3859703;
        double r3859705 = -1.0;
        double r3859706 = 2.0;
        double r3859707 = r3859706 * r3859702;
        double r3859708 = r3859705 - r3859707;
        double r3859709 = r3859704 + r3859708;
        return r3859709;
}

double f(double t) {
        double r3859710 = 3.9999999999999997e-32;
        double r3859711 = t;
        double r3859712 = r3859710 * r3859711;
        double r3859713 = r3859712 * r3859711;
        return r3859713;
}

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.0 + t \cdot 2 \cdot 10^{-16}, 1.0 + t \cdot 2 \cdot 10^{-16}, -1.0 - 2.0 \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right)\]

Derivation

  1. Initial program 61.8

    \[\left(1.0 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(1.0 + t \cdot 2 \cdot 10^{-16}\right) + \left(-1.0 - 2.0 \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right)\]
  2. Simplified50.6

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(t, 2 \cdot 10^{-16}, 1.0\right), \mathsf{fma}\left(t, 2 \cdot 10^{-16}, 1.0\right), -1.0 - \left(2 \cdot 10^{-16} \cdot t\right) \cdot 2.0\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}{\left(3.9999999999999997 \cdot 10^{-32} \cdot t\right) \cdot t}\]
  5. Final simplification0.3

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

Reproduce

herbie shell --seed 2019165 +o rules:numerics
(FPCore (t)
  :name "fma_test1"
  :pre (<= 0.9 t 1.1)

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

  (+ (* (+ 1.0 (* t 2e-16)) (+ 1.0 (* t 2e-16))) (- -1.0 (* 2.0 (* t 2e-16)))))