Average Error: 3.8 → 0.1
Time: 2.4s
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

Original3.8
Target0.1
Herbie0.1
\[x + \left(x \cdot y\right) \cdot y \]

Derivation

  1. Initial program 3.8

    \[x \cdot \left(1 + y \cdot y\right) \]
  2. Simplified3.8

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

    \[\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*_binary643.9

    \[\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. Simplified3.9

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

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

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

    \[\leadsto \left(x \cdot \mathsf{hypot}\left(1, y\right)\right) \cdot \left(\sqrt{\mathsf{hypot}\left(1, y\right)} \cdot \color{blue}{\sqrt{\mathsf{hypot}\left(1, y\right)}}\right) \]
  9. Applied rem-square-sqrt_binary640.1

    \[\leadsto \left(x \cdot \mathsf{hypot}\left(1, y\right)\right) \cdot \color{blue}{\mathsf{hypot}\left(1, y\right)} \]
  10. 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 2022068 
(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))))