Average Error: 61.8 → 0.4
Time: 15.7s
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(\sqrt{2 \cdot 10^{-16}} \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right) \cdot \sqrt{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(\sqrt{2 \cdot 10^{-16}} \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right) \cdot \sqrt{2 \cdot 10^{-16}}\right) \cdot t
double f(double t) {
        double r2623369 = 1.0;
        double r2623370 = t;
        double r2623371 = 2e-16;
        double r2623372 = r2623370 * r2623371;
        double r2623373 = r2623369 + r2623372;
        double r2623374 = r2623373 * r2623373;
        double r2623375 = -1.0;
        double r2623376 = 2.0;
        double r2623377 = r2623376 * r2623372;
        double r2623378 = r2623375 - r2623377;
        double r2623379 = r2623374 + r2623378;
        return r2623379;
}

double f(double t) {
        double r2623380 = 2e-16;
        double r2623381 = sqrt(r2623380);
        double r2623382 = t;
        double r2623383 = r2623382 * r2623380;
        double r2623384 = r2623381 * r2623383;
        double r2623385 = r2623384 * r2623381;
        double r2623386 = r2623385 * r2623382;
        return r2623386;
}

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
\[\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. Using strategy rm
  6. Applied add-sqr-sqrt0.3

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

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

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

Reproduce

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