Average Error: 61.8 → 0.3
Time: 25.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)\]
\[\left(\left(t \cdot \sqrt{3.9999999999999997 \cdot 10^{-32}}\right) \cdot t\right) \cdot \sqrt{3.9999999999999997 \cdot 10^{-32}}\]
\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 \sqrt{3.9999999999999997 \cdot 10^{-32}}\right) \cdot t\right) \cdot \sqrt{3.9999999999999997 \cdot 10^{-32}}
double f(double t) {
        double r13667771 = 1.0;
        double r13667772 = t;
        double r13667773 = 2e-16;
        double r13667774 = r13667772 * r13667773;
        double r13667775 = r13667771 + r13667774;
        double r13667776 = r13667775 * r13667775;
        double r13667777 = -1.0;
        double r13667778 = 2.0;
        double r13667779 = r13667778 * r13667774;
        double r13667780 = r13667777 - r13667779;
        double r13667781 = r13667776 + r13667780;
        return r13667781;
}

double f(double t) {
        double r13667782 = t;
        double r13667783 = 3.9999999999999997e-32;
        double r13667784 = sqrt(r13667783);
        double r13667785 = r13667782 * r13667784;
        double r13667786 = r13667785 * r13667782;
        double r13667787 = r13667786 * r13667784;
        return r13667787;
}

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(\left(1 + t \cdot 2 \cdot 10^{-16}\right), \left(1 + t \cdot 2 \cdot 10^{-16}\right), \left(-1 - 2 \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\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}{\mathsf{fma}\left(\left(2 \cdot 10^{-16} \cdot t\right), -2, \left(\mathsf{fma}\left(\left(2 \cdot 10^{-16} \cdot t\right), \left(2 \cdot 10^{-16} \cdot t\right), \left(2 \cdot 10^{-16} \cdot t\right)\right)\right)\right) + 2 \cdot 10^{-16} \cdot t}\]
  3. Taylor expanded around 0 0.3

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

    \[\leadsto \color{blue}{\left(t \cdot t\right) \cdot 3.9999999999999997 \cdot 10^{-32}}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt0.3

    \[\leadsto \left(t \cdot t\right) \cdot \color{blue}{\left(\sqrt{3.9999999999999997 \cdot 10^{-32}} \cdot \sqrt{3.9999999999999997 \cdot 10^{-32}}\right)}\]
  7. Applied associate-*r*0.4

    \[\leadsto \color{blue}{\left(\left(t \cdot t\right) \cdot \sqrt{3.9999999999999997 \cdot 10^{-32}}\right) \cdot \sqrt{3.9999999999999997 \cdot 10^{-32}}}\]
  8. Using strategy rm
  9. Applied associate-*l*0.3

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

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

Reproduce

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