Average Error: 61.8 → 0.3
Time: 20.0s
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 r2380362 = 1.0;
        double r2380363 = t;
        double r2380364 = 2e-16;
        double r2380365 = r2380363 * r2380364;
        double r2380366 = r2380362 + r2380365;
        double r2380367 = r2380366 * r2380366;
        double r2380368 = -1.0;
        double r2380369 = 2.0;
        double r2380370 = r2380369 * r2380365;
        double r2380371 = r2380368 - r2380370;
        double r2380372 = r2380367 + r2380371;
        return r2380372;
}

double f(double t) {
        double r2380373 = t;
        double r2380374 = 3.9999999999999997e-32;
        double r2380375 = r2380373 * r2380374;
        double r2380376 = r2380373 * r2380375;
        return r2380376;
}

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 2019162 
(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)))))