Average Error: 10.6 → 5.2
Time: 2.0s
Precision: binary64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y \]
\[\begin{array}{l} \mathbf{if}\;y \leq 1.22793750833344 \cdot 10^{-308}:\\ \;\;\;\;y \cdot \left(x \cdot \left(x \cdot 3\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(x \cdot \sqrt{y \cdot 3}\right)}^{2}\\ \end{array} \]
(FPCore (x y) :precision binary64 (* (* (* x 3.0) x) y))
(FPCore (x y)
 :precision binary64
 (if (<= y 1.22793750833344e-308)
   (* y (* x (* x 3.0)))
   (pow (* x (sqrt (* y 3.0))) 2.0)))
double code(double x, double y) {
	return ((x * 3.0) * x) * y;
}
double code(double x, double y) {
	double tmp;
	if (y <= 1.22793750833344e-308) {
		tmp = y * (x * (x * 3.0));
	} else {
		tmp = pow((x * sqrt((y * 3.0))), 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 <= 1.22793750833344d-308) then
        tmp = y * (x * (x * 3.0d0))
    else
        tmp = (x * sqrt((y * 3.0d0))) ** 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 <= 1.22793750833344e-308) {
		tmp = y * (x * (x * 3.0));
	} else {
		tmp = Math.pow((x * Math.sqrt((y * 3.0))), 2.0);
	}
	return tmp;
}
def code(x, y):
	return ((x * 3.0) * x) * y
def code(x, y):
	tmp = 0
	if y <= 1.22793750833344e-308:
		tmp = y * (x * (x * 3.0))
	else:
		tmp = math.pow((x * math.sqrt((y * 3.0))), 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 <= 1.22793750833344e-308)
		tmp = Float64(y * Float64(x * Float64(x * 3.0)));
	else
		tmp = Float64(x * sqrt(Float64(y * 3.0))) ^ 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 <= 1.22793750833344e-308)
		tmp = y * (x * (x * 3.0));
	else
		tmp = (x * sqrt((y * 3.0))) ^ 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, 1.22793750833344e-308], N[(y * N[(x * N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(x * N[Sqrt[N[(y * 3.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\begin{array}{l}
\mathbf{if}\;y \leq 1.22793750833344 \cdot 10^{-308}:\\
\;\;\;\;y \cdot \left(x \cdot \left(x \cdot 3\right)\right)\\

\mathbf{else}:\\
\;\;\;\;{\left(x \cdot \sqrt{y \cdot 3}\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

Original10.6
Target0.2
Herbie5.2
\[\left(x \cdot 3\right) \cdot \left(x \cdot y\right) \]

Derivation

  1. Split input into 2 regimes
  2. if y < 1.22793750833344e-308

    1. Initial program 10.1

      \[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y \]

    if 1.22793750833344e-308 < y

    1. Initial program 11.0

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

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

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

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

Reproduce

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