?

Average Accuracy: 91.4% → 99.8%
Time: 3.4s
Precision: binary64
Cost: 20104

?

\[x \cdot \left(1 + y \cdot y\right) \]
\[\begin{array}{l} \mathbf{if}\;y \leq -6.2 \cdot 10^{+40}:\\ \;\;\;\;y \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;y \leq 1.06 \cdot 10^{+152}:\\ \;\;\;\;x \cdot \left(1 + y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{{\left(y \cdot x\right)}^{2}} \cdot \left(y \cdot \sqrt[3]{y \cdot x}\right)\\ \end{array} \]
(FPCore (x y) :precision binary64 (* x (+ 1.0 (* y y))))
(FPCore (x y)
 :precision binary64
 (if (<= y -6.2e+40)
   (* y (* y x))
   (if (<= y 1.06e+152)
     (* x (+ 1.0 (* y y)))
     (* (cbrt (pow (* y x) 2.0)) (* y (cbrt (* y x)))))))
double code(double x, double y) {
	return x * (1.0 + (y * y));
}
double code(double x, double y) {
	double tmp;
	if (y <= -6.2e+40) {
		tmp = y * (y * x);
	} else if (y <= 1.06e+152) {
		tmp = x * (1.0 + (y * y));
	} else {
		tmp = cbrt(pow((y * x), 2.0)) * (y * cbrt((y * x)));
	}
	return tmp;
}
public static double code(double x, double y) {
	return x * (1.0 + (y * y));
}
public static double code(double x, double y) {
	double tmp;
	if (y <= -6.2e+40) {
		tmp = y * (y * x);
	} else if (y <= 1.06e+152) {
		tmp = x * (1.0 + (y * y));
	} else {
		tmp = Math.cbrt(Math.pow((y * x), 2.0)) * (y * Math.cbrt((y * x)));
	}
	return tmp;
}
function code(x, y)
	return Float64(x * Float64(1.0 + Float64(y * y)))
end
function code(x, y)
	tmp = 0.0
	if (y <= -6.2e+40)
		tmp = Float64(y * Float64(y * x));
	elseif (y <= 1.06e+152)
		tmp = Float64(x * Float64(1.0 + Float64(y * y)));
	else
		tmp = Float64(cbrt((Float64(y * x) ^ 2.0)) * Float64(y * cbrt(Float64(y * x))));
	end
	return tmp
end
code[x_, y_] := N[(x * N[(1.0 + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := If[LessEqual[y, -6.2e+40], N[(y * N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.06e+152], N[(x * N[(1.0 + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Power[N[(y * x), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision] * N[(y * N[Power[N[(y * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
x \cdot \left(1 + y \cdot y\right)
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+40}:\\
\;\;\;\;y \cdot \left(y \cdot x\right)\\

\mathbf{elif}\;y \leq 1.06 \cdot 10^{+152}:\\
\;\;\;\;x \cdot \left(1 + y \cdot y\right)\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original91.4%
Target99.9%
Herbie99.8%
\[x + \left(x \cdot y\right) \cdot y \]

Derivation?

  1. Split input into 3 regimes
  2. if y < -6.1999999999999995e40

    1. Initial program 65.6%

      \[x \cdot \left(1 + y \cdot y\right) \]
    2. Taylor expanded in y around inf 65.6%

      \[\leadsto \color{blue}{{y}^{2} \cdot x} \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{y \cdot \left(y \cdot x\right)} \]
      Proof

      [Start]65.6

      \[ {y}^{2} \cdot x \]

      unpow2 [=>]65.6

      \[ \color{blue}{\left(y \cdot y\right)} \cdot x \]

      associate-*l* [=>]99.6

      \[ \color{blue}{y \cdot \left(y \cdot x\right)} \]

    if -6.1999999999999995e40 < y < 1.06e152

    1. Initial program 99.9%

      \[x \cdot \left(1 + y \cdot y\right) \]

    if 1.06e152 < y

    1. Initial program 2.4%

      \[x \cdot \left(1 + y \cdot y\right) \]
    2. Taylor expanded in y around inf 2.4%

      \[\leadsto \color{blue}{{y}^{2} \cdot x} \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{y \cdot \left(y \cdot x\right)} \]
      Proof

      [Start]2.4

      \[ {y}^{2} \cdot x \]

      unpow2 [=>]2.4

      \[ \color{blue}{\left(y \cdot y\right)} \cdot x \]

      associate-*l* [=>]99.5

      \[ \color{blue}{y \cdot \left(y \cdot x\right)} \]
    4. Applied egg-rr98.1%

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

      [Start]99.5

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

      add-cube-cbrt [=>]98.1

      \[ \color{blue}{\left(\sqrt[3]{y \cdot \left(y \cdot x\right)} \cdot \sqrt[3]{y \cdot \left(y \cdot x\right)}\right) \cdot \sqrt[3]{y \cdot \left(y \cdot x\right)}} \]

      pow3 [=>]98.1

      \[ \color{blue}{{\left(\sqrt[3]{y \cdot \left(y \cdot x\right)}\right)}^{3}} \]
    5. Applied egg-rr97.9%

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

      [Start]98.1

      \[ {\left(\sqrt[3]{y \cdot \left(y \cdot x\right)}\right)}^{3} \]

      rem-cube-cbrt [=>]99.5

      \[ \color{blue}{y \cdot \left(y \cdot x\right)} \]

      *-commutative [=>]99.5

      \[ \color{blue}{\left(y \cdot x\right) \cdot y} \]

      add-cube-cbrt [=>]97.9

      \[ \color{blue}{\left(\left(\sqrt[3]{y \cdot x} \cdot \sqrt[3]{y \cdot x}\right) \cdot \sqrt[3]{y \cdot x}\right)} \cdot y \]

      associate-*l* [=>]97.9

      \[ \color{blue}{\left(\sqrt[3]{y \cdot x} \cdot \sqrt[3]{y \cdot x}\right) \cdot \left(\sqrt[3]{y \cdot x} \cdot y\right)} \]

      pow2 [=>]97.9

      \[ \color{blue}{{\left(\sqrt[3]{y \cdot x}\right)}^{2}} \cdot \left(\sqrt[3]{y \cdot x} \cdot y\right) \]
    6. Applied egg-rr98.5%

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

      [Start]97.9

      \[ {\left(\sqrt[3]{y \cdot x}\right)}^{2} \cdot \left(\sqrt[3]{y \cdot x} \cdot y\right) \]

      unpow2 [=>]97.9

      \[ \color{blue}{\left(\sqrt[3]{y \cdot x} \cdot \sqrt[3]{y \cdot x}\right)} \cdot \left(\sqrt[3]{y \cdot x} \cdot y\right) \]

      cbrt-unprod [=>]98.5

      \[ \color{blue}{\sqrt[3]{\left(y \cdot x\right) \cdot \left(y \cdot x\right)}} \cdot \left(\sqrt[3]{y \cdot x} \cdot y\right) \]

      pow2 [=>]98.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.2 \cdot 10^{+40}:\\ \;\;\;\;y \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;y \leq 1.06 \cdot 10^{+152}:\\ \;\;\;\;x \cdot \left(1 + y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{{\left(y \cdot x\right)}^{2}} \cdot \left(y \cdot \sqrt[3]{y \cdot x}\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy99.8%
Cost13512
\[\begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{+41}:\\ \;\;\;\;y \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;x \cdot \left(1 + y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{y} \cdot \left(\left(y \cdot x\right) \cdot \sqrt{y}\right)\\ \end{array} \]
Alternative 2
Accuracy99.8%
Cost708
\[\begin{array}{l} \mathbf{if}\;y \cdot y \leq 5000000000000:\\ \;\;\;\;x \cdot \left(1 + y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(y \cdot x\right)\\ \end{array} \]
Alternative 3
Accuracy90.0%
Cost580
\[\begin{array}{l} \mathbf{if}\;y \cdot y \leq 1:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot y\right)\\ \end{array} \]
Alternative 4
Accuracy97.8%
Cost580
\[\begin{array}{l} \mathbf{if}\;y \cdot y \leq 10^{-14}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(y \cdot x\right)\\ \end{array} \]
Alternative 5
Accuracy67.8%
Cost64
\[x \]

Error

Reproduce?

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