Average Error: 5.6 → 0.1
Time: 4.8s
Precision: binary64
\[x \cdot \left(1 + y \cdot y\right) \]
\[\mathsf{hypot}\left(1, y\right) \cdot \left(x \cdot \mathsf{hypot}\left(1, y\right)\right) \]
x \cdot \left(1 + y \cdot y\right)
\mathsf{hypot}\left(1, y\right) \cdot \left(x \cdot \mathsf{hypot}\left(1, y\right)\right)
(FPCore (x y) :precision binary64 (* x (+ 1.0 (* y y))))
(FPCore (x y) :precision binary64 (* (hypot 1.0 y) (* x (hypot 1.0 y))))
double code(double x, double y) {
	return x * (1.0 + (y * y));
}
double code(double x, double y) {
	return hypot(1.0, y) * (x * hypot(1.0, y));
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.6
Target0.1
Herbie0.1
\[x + \left(x \cdot y\right) \cdot y \]

Derivation

  1. Initial program 5.6

    \[x \cdot \left(1 + y \cdot y\right) \]
  2. Simplified5.6

    \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(y, y, 1\right)} \]
  3. Applied add-sqr-sqrt_binary645.6

    \[\leadsto x \cdot \color{blue}{\left(\sqrt{\mathsf{fma}\left(y, y, 1\right)} \cdot \sqrt{\mathsf{fma}\left(y, y, 1\right)}\right)} \]
  4. Applied associate-*r*_binary645.6

    \[\leadsto \color{blue}{\left(x \cdot \sqrt{\mathsf{fma}\left(y, y, 1\right)}\right) \cdot \sqrt{\mathsf{fma}\left(y, y, 1\right)}} \]
  5. Simplified5.6

    \[\leadsto \color{blue}{\left(x \cdot \mathsf{hypot}\left(1, y\right)\right)} \cdot \sqrt{\mathsf{fma}\left(y, y, 1\right)} \]
  6. Applied *-un-lft-identity_binary645.6

    \[\leadsto \left(x \cdot \mathsf{hypot}\left(1, y\right)\right) \cdot \sqrt{\color{blue}{1 \cdot \mathsf{fma}\left(y, y, 1\right)}} \]
  7. Applied sqrt-prod_binary645.6

    \[\leadsto \left(x \cdot \mathsf{hypot}\left(1, y\right)\right) \cdot \color{blue}{\left(\sqrt{1} \cdot \sqrt{\mathsf{fma}\left(y, y, 1\right)}\right)} \]
  8. Simplified5.6

    \[\leadsto \left(x \cdot \mathsf{hypot}\left(1, y\right)\right) \cdot \left(\color{blue}{1} \cdot \sqrt{\mathsf{fma}\left(y, y, 1\right)}\right) \]
  9. Simplified0.1

    \[\leadsto \left(x \cdot \mathsf{hypot}\left(1, y\right)\right) \cdot \left(1 \cdot \color{blue}{\mathsf{hypot}\left(1, y\right)}\right) \]
  10. Applied associate-*r*_binary640.1

    \[\leadsto \color{blue}{\left(\left(x \cdot \mathsf{hypot}\left(1, y\right)\right) \cdot 1\right) \cdot \mathsf{hypot}\left(1, y\right)} \]
  11. Simplified0.1

    \[\leadsto \color{blue}{\left(x \cdot \mathsf{hypot}\left(1, y\right)\right)} \cdot \mathsf{hypot}\left(1, y\right) \]
  12. Final simplification0.1

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

Reproduce

herbie shell --seed 2021275 
(FPCore (x y)
  :name "Numeric.Integration.TanhSinh:everywhere from integration-0.2.1"
  :precision binary64

  :herbie-target
  (+ x (* (* x y) y))

  (* x (+ 1.0 (* y y))))