Average Error: 5.2 → 0.1
Time: 3.5s
Precision: 64
\[x \cdot \left(1 + y \cdot y\right)\]
\[\mathsf{hypot}\left(\sqrt{1}, y\right) \cdot \left(x \cdot \mathsf{hypot}\left(\sqrt{1}, y\right)\right)\]
x \cdot \left(1 + y \cdot y\right)
\mathsf{hypot}\left(\sqrt{1}, y\right) \cdot \left(x \cdot \mathsf{hypot}\left(\sqrt{1}, y\right)\right)
double code(double x, double y) {
	return (x * (1.0 + (y * y)));
}
double code(double x, double y) {
	return (hypot(sqrt(1.0), y) * (x * hypot(sqrt(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.2
Target0.1
Herbie0.1
\[x + \left(x \cdot y\right) \cdot y\]

Derivation

  1. Initial program 5.2

    \[x \cdot \left(1 + y \cdot y\right)\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt5.3

    \[\leadsto x \cdot \color{blue}{\left(\sqrt{1 + y \cdot y} \cdot \sqrt{1 + y \cdot y}\right)}\]
  4. Applied associate-*r*5.3

    \[\leadsto \color{blue}{\left(x \cdot \sqrt{1 + y \cdot y}\right) \cdot \sqrt{1 + y \cdot y}}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt5.3

    \[\leadsto \left(x \cdot \sqrt{1 + y \cdot y}\right) \cdot \sqrt{\color{blue}{\sqrt{1 + y \cdot y} \cdot \sqrt{1 + y \cdot y}}}\]
  7. Applied sqrt-prod5.4

    \[\leadsto \left(x \cdot \sqrt{1 + y \cdot y}\right) \cdot \color{blue}{\left(\sqrt{\sqrt{1 + y \cdot y}} \cdot \sqrt{\sqrt{1 + y \cdot y}}\right)}\]
  8. Applied associate-*r*5.3

    \[\leadsto \color{blue}{\left(\left(x \cdot \sqrt{1 + y \cdot y}\right) \cdot \sqrt{\sqrt{1 + y \cdot y}}\right) \cdot \sqrt{\sqrt{1 + y \cdot y}}}\]
  9. Simplified5.3

    \[\leadsto \color{blue}{\left(\left(x \cdot \sqrt{\sqrt{1 + y \cdot y}}\right) \cdot \mathsf{hypot}\left(\sqrt{1}, y\right)\right)} \cdot \sqrt{\sqrt{1 + y \cdot y}}\]
  10. Using strategy rm
  11. Applied pow15.3

    \[\leadsto \left(\left(x \cdot \sqrt{\sqrt{1 + y \cdot y}}\right) \cdot \mathsf{hypot}\left(\sqrt{1}, y\right)\right) \cdot \color{blue}{{\left(\sqrt{\sqrt{1 + y \cdot y}}\right)}^{1}}\]
  12. Applied pow15.3

    \[\leadsto \left(\left(x \cdot \sqrt{\sqrt{1 + y \cdot y}}\right) \cdot \color{blue}{{\left(\mathsf{hypot}\left(\sqrt{1}, y\right)\right)}^{1}}\right) \cdot {\left(\sqrt{\sqrt{1 + y \cdot y}}\right)}^{1}\]
  13. Applied pow15.3

    \[\leadsto \left(\left(x \cdot \color{blue}{{\left(\sqrt{\sqrt{1 + y \cdot y}}\right)}^{1}}\right) \cdot {\left(\mathsf{hypot}\left(\sqrt{1}, y\right)\right)}^{1}\right) \cdot {\left(\sqrt{\sqrt{1 + y \cdot y}}\right)}^{1}\]
  14. Applied pow15.3

    \[\leadsto \left(\left(\color{blue}{{x}^{1}} \cdot {\left(\sqrt{\sqrt{1 + y \cdot y}}\right)}^{1}\right) \cdot {\left(\mathsf{hypot}\left(\sqrt{1}, y\right)\right)}^{1}\right) \cdot {\left(\sqrt{\sqrt{1 + y \cdot y}}\right)}^{1}\]
  15. Applied pow-prod-down5.3

    \[\leadsto \left(\color{blue}{{\left(x \cdot \sqrt{\sqrt{1 + y \cdot y}}\right)}^{1}} \cdot {\left(\mathsf{hypot}\left(\sqrt{1}, y\right)\right)}^{1}\right) \cdot {\left(\sqrt{\sqrt{1 + y \cdot y}}\right)}^{1}\]
  16. Applied pow-prod-down5.3

    \[\leadsto \color{blue}{{\left(\left(x \cdot \sqrt{\sqrt{1 + y \cdot y}}\right) \cdot \mathsf{hypot}\left(\sqrt{1}, y\right)\right)}^{1}} \cdot {\left(\sqrt{\sqrt{1 + y \cdot y}}\right)}^{1}\]
  17. Applied pow-prod-down5.3

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

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

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

Reproduce

herbie shell --seed 2020049 +o rules:numerics
(FPCore (x y)
  :name "Numeric.Integration.TanhSinh:everywhere from integration-0.2.1"
  :precision binary64

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

  (* x (+ 1 (* y y))))