Average Error: 61.8 → 0.3
Time: 17.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(\left(t \cdot 2 \cdot 10^{-16}\right) \cdot 2 \cdot 10^{-16}\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(\left(t \cdot 2 \cdot 10^{-16}\right) \cdot 2 \cdot 10^{-16}\right) \cdot t
double f(double t) {
        double r5653092 = 1.0;
        double r5653093 = t;
        double r5653094 = 2e-16;
        double r5653095 = r5653093 * r5653094;
        double r5653096 = r5653092 + r5653095;
        double r5653097 = r5653096 * r5653096;
        double r5653098 = -1.0;
        double r5653099 = 2.0;
        double r5653100 = r5653099 * r5653095;
        double r5653101 = r5653098 - r5653100;
        double r5653102 = r5653097 + r5653101;
        return r5653102;
}

double f(double t) {
        double r5653103 = t;
        double r5653104 = 2e-16;
        double r5653105 = r5653103 * r5653104;
        double r5653106 = r5653105 * r5653104;
        double r5653107 = r5653106 * r5653103;
        return r5653107;
}

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 *-commutative0.4

    \[\leadsto \left(t \cdot 2 \cdot 10^{-16}\right) \cdot \color{blue}{\left(2 \cdot 10^{-16} \cdot t\right)}\]
  5. Applied associate-*r*0.3

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

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

Reproduce

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