Average Error: 61.8 → 0.3
Time: 20.1s
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)\]
\[t \cdot \left(t \cdot 3.9999999999999997 \cdot 10^{-32}\right)\]
\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)
t \cdot \left(t \cdot 3.9999999999999997 \cdot 10^{-32}\right)
double f(double t) {
        double r3365810 = 1.0;
        double r3365811 = t;
        double r3365812 = 2e-16;
        double r3365813 = r3365811 * r3365812;
        double r3365814 = r3365810 + r3365813;
        double r3365815 = r3365814 * r3365814;
        double r3365816 = -1.0;
        double r3365817 = 2.0;
        double r3365818 = r3365817 * r3365813;
        double r3365819 = r3365816 - r3365818;
        double r3365820 = r3365815 + r3365819;
        return r3365820;
}

double f(double t) {
        double r3365821 = t;
        double r3365822 = 3.9999999999999997e-32;
        double r3365823 = r3365821 * r3365822;
        double r3365824 = r3365821 * r3365823;
        return r3365824;
}

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

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

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

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

Reproduce

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