Average Error: 0.0 → 0.6
Time: 1.1s
Precision: binary64
\[x \cdot e^{y \cdot y} \]
\[\mathsf{fma}\left(y \cdot y, x, x\right) \]
x \cdot e^{y \cdot y}
\mathsf{fma}\left(y \cdot y, x, x\right)
(FPCore (x y) :precision binary64 (* x (exp (* y y))))
(FPCore (x y) :precision binary64 (fma (* y y) x x))
double code(double x, double y) {
	return x * exp(y * y);
}
double code(double x, double y) {
	return fma((y * y), x, x);
}

Error

Bits error versus x

Bits error versus y

Target

Original0.0
Target0.0
Herbie0.6
\[x \cdot {\left(e^{y}\right)}^{y} \]

Derivation

  1. Initial program 0.0

    \[x \cdot e^{y \cdot y} \]
  2. Taylor expanded in y around 0 0.6

    \[\leadsto \color{blue}{{y}^{2} \cdot x + x} \]
  3. Simplified0.6

    \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot y, x, x\right)} \]
  4. Final simplification0.6

    \[\leadsto \mathsf{fma}\left(y \cdot y, x, x\right) \]

Reproduce

herbie shell --seed 2021313 
(FPCore (x y)
  :name "Data.Number.Erf:$dmerfcx from erf-2.0.0.0"
  :precision binary64

  :herbie-target
  (* x (pow (exp y) y))

  (* x (exp (* y y))))