Average Error: 5.5 → 0.2
Time: 3.0s
Precision: binary64
\[x \cdot \left(1 + y \cdot y\right) \]
\[\begin{array}{l} t_0 := \sqrt{\mathsf{hypot}\left(1, y\right)}\\ \left(x \cdot \mathsf{hypot}\left(1, y\right)\right) \cdot \left(t_0 \cdot t_0\right) \end{array} \]
(FPCore (x y) :precision binary64 (* x (+ 1.0 (* y y))))
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (sqrt (hypot 1.0 y)))) (* (* x (hypot 1.0 y)) (* t_0 t_0))))
double code(double x, double y) {
	return x * (1.0 + (y * y));
}
double code(double x, double y) {
	double t_0 = sqrt(hypot(1.0, y));
	return (x * hypot(1.0, y)) * (t_0 * t_0);
}
public static double code(double x, double y) {
	return x * (1.0 + (y * y));
}
public static double code(double x, double y) {
	double t_0 = Math.sqrt(Math.hypot(1.0, y));
	return (x * Math.hypot(1.0, y)) * (t_0 * t_0);
}
def code(x, y):
	return x * (1.0 + (y * y))
def code(x, y):
	t_0 = math.sqrt(math.hypot(1.0, y))
	return (x * math.hypot(1.0, y)) * (t_0 * t_0)
function code(x, y)
	return Float64(x * Float64(1.0 + Float64(y * y)))
end
function code(x, y)
	t_0 = sqrt(hypot(1.0, y))
	return Float64(Float64(x * hypot(1.0, y)) * Float64(t_0 * t_0))
end
function tmp = code(x, y)
	tmp = x * (1.0 + (y * y));
end
function tmp = code(x, y)
	t_0 = sqrt(hypot(1.0, y));
	tmp = (x * hypot(1.0, y)) * (t_0 * t_0);
end
code[x_, y_] := N[(x * N[(1.0 + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[Sqrt[N[Sqrt[1.0 ^ 2 + y ^ 2], $MachinePrecision]], $MachinePrecision]}, N[(N[(x * N[Sqrt[1.0 ^ 2 + y ^ 2], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
x \cdot \left(1 + y \cdot y\right)
\begin{array}{l}
t_0 := \sqrt{\mathsf{hypot}\left(1, y\right)}\\
\left(x \cdot \mathsf{hypot}\left(1, y\right)\right) \cdot \left(t_0 \cdot t_0\right)
\end{array}

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.2
\[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 add-sqr-sqrt_binary645.5

    \[\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.5

    \[\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.5

    \[\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_binary645.6

    \[\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. Simplified5.6

    \[\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 pow1_binary640.2

    \[\leadsto \left(x \cdot \color{blue}{{\left(\mathsf{hypot}\left(1, y\right)\right)}^{1}}\right) \cdot \left(\sqrt{\mathsf{hypot}\left(1, y\right)} \cdot \sqrt{\mathsf{hypot}\left(1, y\right)}\right) \]
  10. Applied pow1_binary640.2

    \[\leadsto \left(\color{blue}{{x}^{1}} \cdot {\left(\mathsf{hypot}\left(1, y\right)\right)}^{1}\right) \cdot \left(\sqrt{\mathsf{hypot}\left(1, y\right)} \cdot \sqrt{\mathsf{hypot}\left(1, y\right)}\right) \]
  11. Applied pow-prod-down_binary640.2

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

    \[\leadsto \left(x \cdot \mathsf{hypot}\left(1, y\right)\right) \cdot \left(\sqrt{\mathsf{hypot}\left(1, y\right)} \cdot \sqrt{\mathsf{hypot}\left(1, y\right)}\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))))