Average Error: 61.8 → 0.3
Time: 13.2s
Precision: 64
\[0.900000000000000022 \le t \le 1.1000000000000001\]
\[\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(t \cdot 3.9999999999999997 \cdot 10^{-32}\right) \cdot {t}^{\left(\frac{2}{2}\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)
\left(t \cdot 3.9999999999999997 \cdot 10^{-32}\right) \cdot {t}^{\left(\frac{2}{2}\right)}
double f(double t) {
        double r123964 = 1.0;
        double r123965 = t;
        double r123966 = 2e-16;
        double r123967 = r123965 * r123966;
        double r123968 = r123964 + r123967;
        double r123969 = r123968 * r123968;
        double r123970 = -1.0;
        double r123971 = 2.0;
        double r123972 = r123971 * r123967;
        double r123973 = r123970 - r123972;
        double r123974 = r123969 + r123973;
        return r123974;
}

double f(double t) {
        double r123975 = t;
        double r123976 = 3.9999999999999997e-32;
        double r123977 = r123975 * r123976;
        double r123978 = 2.0;
        double r123979 = r123978 / r123978;
        double r123980 = pow(r123975, r123979);
        double r123981 = r123977 * r123980;
        return r123981;
}

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. Simplified50.6

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(t, 2 \cdot 10^{-16}, 1\right), \mathsf{fma}\left(t, 2 \cdot 10^{-16}, 1\right), -1 - 2 \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right)}\]
  3. Taylor expanded around 0 0.3

    \[\leadsto \color{blue}{3.9999999999999997 \cdot 10^{-32} \cdot {t}^{2}}\]
  4. Using strategy rm
  5. Applied sqr-pow0.3

    \[\leadsto 3.9999999999999997 \cdot 10^{-32} \cdot \color{blue}{\left({t}^{\left(\frac{2}{2}\right)} \cdot {t}^{\left(\frac{2}{2}\right)}\right)}\]
  6. Applied associate-*r*0.3

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

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

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

Reproduce

herbie shell --seed 2020045 +o rules:numerics
(FPCore (t)
  :name "fma_test1"
  :precision binary64
  :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)))))