Average Error: 61.8 → 0.3
Time: 10.0s
Precision: 64
\[\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 r5910490 = 1.0;
        double r5910491 = t;
        double r5910492 = 2e-16;
        double r5910493 = r5910491 * r5910492;
        double r5910494 = r5910490 + r5910493;
        double r5910495 = r5910494 * r5910494;
        double r5910496 = -1.0;
        double r5910497 = 2.0;
        double r5910498 = r5910497 * r5910493;
        double r5910499 = r5910496 - r5910498;
        double r5910500 = r5910495 + r5910499;
        return r5910500;
}

double f(double t) {
        double r5910501 = t;
        double r5910502 = 3.9999999999999997e-32;
        double r5910503 = r5910501 * r5910502;
        double r5910504 = r5910501 * r5910503;
        return r5910504;
}

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

Error

Bits error versus t

Target

Original61.8
Target50.6
Herbie0.3
\[(\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.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 associate-*l*0.3

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

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

Reproduce

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