Average Error: 5.5 → 0.1
Time: 3.1s
Precision: binary64
\[x \cdot \left(1 + y \cdot y\right) \]
\[\left(\mathsf{hypot}\left(1, y\right) \cdot x\right) \cdot \mathsf{hypot}\left(1, y\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);
}
public static double code(double x, double y) {
	return x * (1.0 + (y * y));
}
public static double code(double x, double y) {
	return (Math.hypot(1.0, y) * x) * Math.hypot(1.0, y);
}
def code(x, y):
	return x * (1.0 + (y * y))
def code(x, y):
	return (math.hypot(1.0, y) * x) * math.hypot(1.0, y)
function code(x, y)
	return Float64(x * Float64(1.0 + Float64(y * y)))
end
function code(x, y)
	return Float64(Float64(hypot(1.0, y) * x) * hypot(1.0, y))
end
function tmp = code(x, y)
	tmp = x * (1.0 + (y * y));
end
function tmp = code(x, y)
	tmp = (hypot(1.0, y) * x) * hypot(1.0, y);
end
code[x_, y_] := N[(x * N[(1.0 + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[(N[Sqrt[1.0 ^ 2 + y ^ 2], $MachinePrecision] * x), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + y ^ 2], $MachinePrecision]), $MachinePrecision]
x \cdot \left(1 + y \cdot y\right)
\left(\mathsf{hypot}\left(1, y\right) \cdot x\right) \cdot \mathsf{hypot}\left(1, y\right)

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.5
Target0.1
Herbie0.1
\[x + \left(x \cdot y\right) \cdot y \]

Derivation

  1. Initial program 5.5

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

    \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(y, y, 1\right)} \]
  3. Applied egg-rr0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{hypot}\left(1, y\right), x \cdot \mathsf{hypot}\left(1, y\right), 0\right)} \]
  4. Applied egg-rr0.1

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

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

Reproduce

herbie shell --seed 2022131 
(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))))