Average Error: 61.8 → 0.4
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)\]
\[3.9999999999999997 \cdot 10^{-32} \cdot \left(t \cdot t\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)
3.9999999999999997 \cdot 10^{-32} \cdot \left(t \cdot t\right)
double f(double t) {
        double r5137379 = 1.0;
        double r5137380 = t;
        double r5137381 = 2e-16;
        double r5137382 = r5137380 * r5137381;
        double r5137383 = r5137379 + r5137382;
        double r5137384 = r5137383 * r5137383;
        double r5137385 = -1.0;
        double r5137386 = 2.0;
        double r5137387 = r5137386 * r5137382;
        double r5137388 = r5137385 - r5137387;
        double r5137389 = r5137384 + r5137388;
        return r5137389;
}

double f(double t) {
        double r5137390 = 3.9999999999999997e-32;
        double r5137391 = t;
        double r5137392 = r5137391 * r5137391;
        double r5137393 = r5137390 * r5137392;
        return r5137393;
}

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.4
\[(\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))_*\]

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. Simplified50.3

    \[\leadsto \color{blue}{(\left(2 \cdot 10^{-16} \cdot t\right) \cdot -2 + \left((\left(2 \cdot 10^{-16} \cdot t\right) \cdot \left(2 \cdot 10^{-16} \cdot t\right) + \left(2 \cdot 10^{-16} \cdot t\right))_*\right))_* + 2 \cdot 10^{-16} \cdot t}\]
  3. Taylor expanded around 0 0.4

    \[\leadsto \color{blue}{3.9999999999999997 \cdot 10^{-32} \cdot {t}^{2}}\]
  4. Simplified0.4

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

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

Reproduce

herbie shell --seed 2019119 +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)))))