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 r2811155 = 1.0;
        double r2811156 = t;
        double r2811157 = 2e-16;
        double r2811158 = r2811156 * r2811157;
        double r2811159 = r2811155 + r2811158;
        double r2811160 = r2811159 * r2811159;
        double r2811161 = -1.0;
        double r2811162 = 2.0;
        double r2811163 = r2811162 * r2811158;
        double r2811164 = r2811161 - r2811163;
        double r2811165 = r2811160 + r2811164;
        return r2811165;
}

double f(double t) {
        double r2811166 = t;
        double r2811167 = 3.9999999999999997e-32;
        double r2811168 = r2811166 * r2811167;
        double r2811169 = r2811166 * r2811168;
        return r2811169;
}

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 +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)))))