Average Error: 11.0 → 5.9
Time: 2.2s
Precision: binary64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y \]
\[\begin{array}{l} \mathbf{if}\;y \leq 3.271832721285948 \cdot 10^{-299}:\\ \;\;\;\;y \cdot \left(3 \cdot {x}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;3 \cdot {\left(x \cdot \sqrt{y}\right)}^{2}\\ \end{array} \]
(FPCore (x y) :precision binary64 (* (* (* x 3.0) x) y))
(FPCore (x y)
 :precision binary64
 (if (<= y 3.271832721285948e-299)
   (* y (* 3.0 (pow x 2.0)))
   (* 3.0 (pow (* x (sqrt y)) 2.0))))
double code(double x, double y) {
	return ((x * 3.0) * x) * y;
}
double code(double x, double y) {
	double tmp;
	if (y <= 3.271832721285948e-299) {
		tmp = y * (3.0 * pow(x, 2.0));
	} else {
		tmp = 3.0 * pow((x * sqrt(y)), 2.0);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((x * 3.0d0) * x) * y
end function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 3.271832721285948d-299) then
        tmp = y * (3.0d0 * (x ** 2.0d0))
    else
        tmp = 3.0d0 * ((x * sqrt(y)) ** 2.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	return ((x * 3.0) * x) * y;
}
public static double code(double x, double y) {
	double tmp;
	if (y <= 3.271832721285948e-299) {
		tmp = y * (3.0 * Math.pow(x, 2.0));
	} else {
		tmp = 3.0 * Math.pow((x * Math.sqrt(y)), 2.0);
	}
	return tmp;
}
def code(x, y):
	return ((x * 3.0) * x) * y
def code(x, y):
	tmp = 0
	if y <= 3.271832721285948e-299:
		tmp = y * (3.0 * math.pow(x, 2.0))
	else:
		tmp = 3.0 * math.pow((x * math.sqrt(y)), 2.0)
	return tmp
function code(x, y)
	return Float64(Float64(Float64(x * 3.0) * x) * y)
end
function code(x, y)
	tmp = 0.0
	if (y <= 3.271832721285948e-299)
		tmp = Float64(y * Float64(3.0 * (x ^ 2.0)));
	else
		tmp = Float64(3.0 * (Float64(x * sqrt(y)) ^ 2.0));
	end
	return tmp
end
function tmp = code(x, y)
	tmp = ((x * 3.0) * x) * y;
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 3.271832721285948e-299)
		tmp = y * (3.0 * (x ^ 2.0));
	else
		tmp = 3.0 * ((x * sqrt(y)) ^ 2.0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := N[(N[(N[(x * 3.0), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision]
code[x_, y_] := If[LessEqual[y, 3.271832721285948e-299], N[(y * N[(3.0 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 * N[Power[N[(x * N[Sqrt[y], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\begin{array}{l}
\mathbf{if}\;y \leq 3.271832721285948 \cdot 10^{-299}:\\
\;\;\;\;y \cdot \left(3 \cdot {x}^{2}\right)\\

\mathbf{else}:\\
\;\;\;\;3 \cdot {\left(x \cdot \sqrt{y}\right)}^{2}\\


\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

Original11.0
Target0.3
Herbie5.9
\[\left(x \cdot 3\right) \cdot \left(x \cdot y\right) \]

Derivation

  1. Split input into 2 regimes
  2. if y < 3.27183272128594789e-299

    1. Initial program 11.2

      \[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y \]
    2. Taylor expanded in x around 0 11.2

      \[\leadsto \color{blue}{\left(3 \cdot {x}^{2}\right)} \cdot y \]

    if 3.27183272128594789e-299 < y

    1. Initial program 10.9

      \[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y \]
    2. Taylor expanded in x around 0 10.9

      \[\leadsto \color{blue}{3 \cdot \left(y \cdot {x}^{2}\right)} \]
    3. Applied egg-rr0.5

      \[\leadsto 3 \cdot \color{blue}{{\left(x \cdot \sqrt{y}\right)}^{2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification5.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.271832721285948 \cdot 10^{-299}:\\ \;\;\;\;y \cdot \left(3 \cdot {x}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;3 \cdot {\left(x \cdot \sqrt{y}\right)}^{2}\\ \end{array} \]

Reproduce

herbie shell --seed 2022145 
(FPCore (x y)
  :name "Diagrams.Segment:$catParam from diagrams-lib-1.3.0.3, A"
  :precision binary64

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

  (* (* (* x 3.0) x) y))