Numeric.Integration.TanhSinh:everywhere from integration-0.2.1

Percentage Accurate: 94.2% → 99.9%
Time: 5.6s
Alternatives: 6
Speedup: 0.6×

Specification

?
\[\begin{array}{l} \\ x \cdot \left(1 + y \cdot y\right) \end{array} \]
(FPCore (x y) :precision binary64 (* x (+ 1.0 (* y y))))
double code(double x, double y) {
	return x * (1.0 + (y * y));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x * (1.0d0 + (y * y))
end function
public static double code(double x, double y) {
	return x * (1.0 + (y * y));
}
def code(x, y):
	return x * (1.0 + (y * y))
function code(x, y)
	return Float64(x * Float64(1.0 + Float64(y * y)))
end
function tmp = code(x, y)
	tmp = x * (1.0 + (y * y));
end
code[x_, y_] := N[(x * N[(1.0 + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(1 + y \cdot y\right)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 94.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \left(1 + y \cdot y\right) \end{array} \]
(FPCore (x y) :precision binary64 (* x (+ 1.0 (* y y))))
double code(double x, double y) {
	return x * (1.0 + (y * y));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x * (1.0d0 + (y * y))
end function
public static double code(double x, double y) {
	return x * (1.0 + (y * y));
}
def code(x, y):
	return x * (1.0 + (y * y))
function code(x, y)
	return Float64(x * Float64(1.0 + Float64(y * y)))
end
function tmp = code(x, y)
	tmp = x * (1.0 + (y * y));
end
code[x_, y_] := N[(x * N[(1.0 + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(1 + y \cdot y\right)
\end{array}

Alternative 1: 99.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(x \cdot y, y, x\right) \end{array} \]
(FPCore (x y) :precision binary64 (fma (* x y) y x))
double code(double x, double y) {
	return fma((x * y), y, x);
}
function code(x, y)
	return fma(Float64(x * y), y, x)
end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] * y + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(x \cdot y, y, x\right)
\end{array}
Derivation
  1. Initial program 95.2%

    \[x \cdot \left(1 + y \cdot y\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto x \cdot \left(y \cdot y + \color{blue}{1}\right) \]
    2. distribute-lft-inN/A

      \[\leadsto x \cdot \left(y \cdot y\right) + \color{blue}{x \cdot 1} \]
    3. associate-*r*N/A

      \[\leadsto \left(x \cdot y\right) \cdot y + \color{blue}{x} \cdot 1 \]
    4. *-rgt-identityN/A

      \[\leadsto \left(x \cdot y\right) \cdot y + x \]
    5. fma-defineN/A

      \[\leadsto \mathsf{fma}\left(x \cdot y, \color{blue}{y}, x\right) \]
    6. fma-lowering-fma.f64N/A

      \[\leadsto \mathsf{fma.f64}\left(\left(x \cdot y\right), \color{blue}{y}, x\right) \]
    7. *-lowering-*.f6499.9%

      \[\leadsto \mathsf{fma.f64}\left(\mathsf{*.f64}\left(x, y\right), y, x\right) \]
  4. Applied egg-rr99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot y, y, x\right)} \]
  5. Add Preprocessing

Alternative 2: 99.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \cdot y \leq 5 \cdot 10^{+209}:\\ \;\;\;\;x \cdot \left(y \cdot y + 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{1}{x \cdot y}}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= (* y y) 5e+209) (* x (+ (* y y) 1.0)) (/ y (/ 1.0 (* x y)))))
double code(double x, double y) {
	double tmp;
	if ((y * y) <= 5e+209) {
		tmp = x * ((y * y) + 1.0);
	} else {
		tmp = y / (1.0 / (x * y));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y * y) <= 5d+209) then
        tmp = x * ((y * y) + 1.0d0)
    else
        tmp = y / (1.0d0 / (x * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y * y) <= 5e+209) {
		tmp = x * ((y * y) + 1.0);
	} else {
		tmp = y / (1.0 / (x * y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y * y) <= 5e+209:
		tmp = x * ((y * y) + 1.0)
	else:
		tmp = y / (1.0 / (x * y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (Float64(y * y) <= 5e+209)
		tmp = Float64(x * Float64(Float64(y * y) + 1.0));
	else
		tmp = Float64(y / Float64(1.0 / Float64(x * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y * y) <= 5e+209)
		tmp = x * ((y * y) + 1.0);
	else
		tmp = y / (1.0 / (x * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[N[(y * y), $MachinePrecision], 5e+209], N[(x * N[(N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(1.0 / N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \cdot y \leq 5 \cdot 10^{+209}:\\
\;\;\;\;x \cdot \left(y \cdot y + 1\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{1}{x \cdot y}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y y) < 4.99999999999999964e209

    1. Initial program 99.9%

      \[x \cdot \left(1 + y \cdot y\right) \]
    2. Add Preprocessing

    if 4.99999999999999964e209 < (*.f64 y y)

    1. Initial program 84.1%

      \[x \cdot \left(1 + y \cdot y\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{x \cdot {y}^{2}} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left({y}^{2}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(y \cdot \color{blue}{y}\right)\right) \]
      3. *-lowering-*.f6484.1%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right) \]
    5. Simplified84.1%

      \[\leadsto \color{blue}{x \cdot \left(y \cdot y\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(x \cdot y\right) \cdot \color{blue}{y} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(x \cdot y\right), \color{blue}{y}\right) \]
      3. *-lowering-*.f6499.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, y\right), y\right) \]
    7. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot y} \]
    8. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto y \cdot \color{blue}{\left(x \cdot y\right)} \]
      2. remove-double-divN/A

        \[\leadsto y \cdot \left(\frac{1}{\frac{1}{x}} \cdot y\right) \]
      3. associate-/r/N/A

        \[\leadsto y \cdot \frac{1}{\color{blue}{\frac{\frac{1}{x}}{y}}} \]
      4. un-div-invN/A

        \[\leadsto \frac{y}{\color{blue}{\frac{\frac{1}{x}}{y}}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(y, \color{blue}{\left(\frac{\frac{1}{x}}{y}\right)}\right) \]
      6. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(y, \left(\frac{1}{\color{blue}{\frac{y}{\frac{1}{x}}}}\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{y}{\frac{1}{x}}\right)}\right)\right) \]
      8. associate-/r/N/A

        \[\leadsto \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \left(\frac{y}{1} \cdot \color{blue}{x}\right)\right)\right) \]
      9. /-rgt-identityN/A

        \[\leadsto \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \left(y \cdot x\right)\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \left(x \cdot \color{blue}{y}\right)\right)\right) \]
      11. *-lowering-*.f6499.9%

        \[\leadsto \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    9. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{y}{\frac{1}{x \cdot y}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot y \leq 5 \cdot 10^{+209}:\\ \;\;\;\;x \cdot \left(y \cdot y + 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{1}{x \cdot y}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \cdot y \leq 2 \cdot 10^{+26}:\\ \;\;\;\;x \cdot \left(y \cdot y + 1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= (* y y) 2e+26) (* x (+ (* y y) 1.0)) (* y (* x y))))
double code(double x, double y) {
	double tmp;
	if ((y * y) <= 2e+26) {
		tmp = x * ((y * y) + 1.0);
	} else {
		tmp = y * (x * y);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y * y) <= 2d+26) then
        tmp = x * ((y * y) + 1.0d0)
    else
        tmp = y * (x * y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y * y) <= 2e+26) {
		tmp = x * ((y * y) + 1.0);
	} else {
		tmp = y * (x * y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y * y) <= 2e+26:
		tmp = x * ((y * y) + 1.0)
	else:
		tmp = y * (x * y)
	return tmp
function code(x, y)
	tmp = 0.0
	if (Float64(y * y) <= 2e+26)
		tmp = Float64(x * Float64(Float64(y * y) + 1.0));
	else
		tmp = Float64(y * Float64(x * y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y * y) <= 2e+26)
		tmp = x * ((y * y) + 1.0);
	else
		tmp = y * (x * y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[N[(y * y), $MachinePrecision], 2e+26], N[(x * N[(N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \cdot y \leq 2 \cdot 10^{+26}:\\
\;\;\;\;x \cdot \left(y \cdot y + 1\right)\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y y) < 2.0000000000000001e26

    1. Initial program 100.0%

      \[x \cdot \left(1 + y \cdot y\right) \]
    2. Add Preprocessing

    if 2.0000000000000001e26 < (*.f64 y y)

    1. Initial program 90.2%

      \[x \cdot \left(1 + y \cdot y\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{x \cdot {y}^{2}} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left({y}^{2}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(y \cdot \color{blue}{y}\right)\right) \]
      3. *-lowering-*.f6490.2%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right) \]
    5. Simplified90.2%

      \[\leadsto \color{blue}{x \cdot \left(y \cdot y\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(x \cdot y\right) \cdot \color{blue}{y} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(x \cdot y\right), \color{blue}{y}\right) \]
      3. *-lowering-*.f6499.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, y\right), y\right) \]
    7. Applied egg-rr99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot y \leq 2 \cdot 10^{+26}:\\ \;\;\;\;x \cdot \left(y \cdot y + 1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 99.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \cdot y \leq 0.04:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y) :precision binary64 (if (<= (* y y) 0.04) x (* y (* x y))))
double code(double x, double y) {
	double tmp;
	if ((y * y) <= 0.04) {
		tmp = x;
	} else {
		tmp = y * (x * y);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y * y) <= 0.04d0) then
        tmp = x
    else
        tmp = y * (x * y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y * y) <= 0.04) {
		tmp = x;
	} else {
		tmp = y * (x * y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y * y) <= 0.04:
		tmp = x
	else:
		tmp = y * (x * y)
	return tmp
function code(x, y)
	tmp = 0.0
	if (Float64(y * y) <= 0.04)
		tmp = x;
	else
		tmp = Float64(y * Float64(x * y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y * y) <= 0.04)
		tmp = x;
	else
		tmp = y * (x * y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[N[(y * y), $MachinePrecision], 0.04], x, N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \cdot y \leq 0.04:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y y) < 0.0400000000000000008

    1. Initial program 100.0%

      \[x \cdot \left(1 + y \cdot y\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{x} \]
    4. Step-by-step derivation
      1. Simplified98.8%

        \[\leadsto \color{blue}{x} \]

      if 0.0400000000000000008 < (*.f64 y y)

      1. Initial program 90.5%

        \[x \cdot \left(1 + y \cdot y\right) \]
      2. Add Preprocessing
      3. Taylor expanded in y around inf

        \[\leadsto \color{blue}{x \cdot {y}^{2}} \]
      4. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left({y}^{2}\right)}\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(y \cdot \color{blue}{y}\right)\right) \]
        3. *-lowering-*.f6489.8%

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right) \]
      5. Simplified89.8%

        \[\leadsto \color{blue}{x \cdot \left(y \cdot y\right)} \]
      6. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \left(x \cdot y\right) \cdot \color{blue}{y} \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\left(x \cdot y\right), \color{blue}{y}\right) \]
        3. *-lowering-*.f6499.0%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, y\right), y\right) \]
      7. Applied egg-rr99.0%

        \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot y} \]
    5. Recombined 2 regimes into one program.
    6. Final simplification98.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot y \leq 0.04:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot y\right)\\ \end{array} \]
    7. Add Preprocessing

    Alternative 5: 72.9% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot y\right)\\ \end{array} \end{array} \]
    (FPCore (x y) :precision binary64 (if (<= y 1.0) x (* x (* y y))))
    double code(double x, double y) {
    	double tmp;
    	if (y <= 1.0) {
    		tmp = x;
    	} else {
    		tmp = x * (y * y);
    	}
    	return tmp;
    }
    
    real(8) function code(x, y)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8) :: tmp
        if (y <= 1.0d0) then
            tmp = x
        else
            tmp = x * (y * y)
        end if
        code = tmp
    end function
    
    public static double code(double x, double y) {
    	double tmp;
    	if (y <= 1.0) {
    		tmp = x;
    	} else {
    		tmp = x * (y * y);
    	}
    	return tmp;
    }
    
    def code(x, y):
    	tmp = 0
    	if y <= 1.0:
    		tmp = x
    	else:
    		tmp = x * (y * y)
    	return tmp
    
    function code(x, y)
    	tmp = 0.0
    	if (y <= 1.0)
    		tmp = x;
    	else
    		tmp = Float64(x * Float64(y * y));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y)
    	tmp = 0.0;
    	if (y <= 1.0)
    		tmp = x;
    	else
    		tmp = x * (y * y);
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_] := If[LessEqual[y, 1.0], x, N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq 1:\\
    \;\;\;\;x\\
    
    \mathbf{else}:\\
    \;\;\;\;x \cdot \left(y \cdot y\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < 1

      1. Initial program 98.0%

        \[x \cdot \left(1 + y \cdot y\right) \]
      2. Add Preprocessing
      3. Taylor expanded in y around 0

        \[\leadsto \color{blue}{x} \]
      4. Step-by-step derivation
        1. Simplified67.5%

          \[\leadsto \color{blue}{x} \]

        if 1 < y

        1. Initial program 87.4%

          \[x \cdot \left(1 + y \cdot y\right) \]
        2. Add Preprocessing
        3. Taylor expanded in y around inf

          \[\leadsto \color{blue}{x \cdot {y}^{2}} \]
        4. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left({y}^{2}\right)}\right) \]
          2. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(x, \left(y \cdot \color{blue}{y}\right)\right) \]
          3. *-lowering-*.f6486.8%

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right) \]
        5. Simplified86.8%

          \[\leadsto \color{blue}{x \cdot \left(y \cdot y\right)} \]
      5. Recombined 2 regimes into one program.
      6. Add Preprocessing

      Alternative 6: 52.6% accurate, 7.0× speedup?

      \[\begin{array}{l} \\ x \end{array} \]
      (FPCore (x y) :precision binary64 x)
      double code(double x, double y) {
      	return x;
      }
      
      real(8) function code(x, y)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          code = x
      end function
      
      public static double code(double x, double y) {
      	return x;
      }
      
      def code(x, y):
      	return x
      
      function code(x, y)
      	return x
      end
      
      function tmp = code(x, y)
      	tmp = x;
      end
      
      code[x_, y_] := x
      
      \begin{array}{l}
      
      \\
      x
      \end{array}
      
      Derivation
      1. Initial program 95.2%

        \[x \cdot \left(1 + y \cdot y\right) \]
      2. Add Preprocessing
      3. Taylor expanded in y around 0

        \[\leadsto \color{blue}{x} \]
      4. Step-by-step derivation
        1. Simplified51.0%

          \[\leadsto \color{blue}{x} \]
        2. Add Preprocessing

        Developer Target 1: 99.9% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ x + \left(x \cdot y\right) \cdot y \end{array} \]
        (FPCore (x y) :precision binary64 (+ x (* (* x y) y)))
        double code(double x, double y) {
        	return x + ((x * y) * y);
        }
        
        real(8) function code(x, y)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            code = x + ((x * y) * y)
        end function
        
        public static double code(double x, double y) {
        	return x + ((x * y) * y);
        }
        
        def code(x, y):
        	return x + ((x * y) * y)
        
        function code(x, y)
        	return Float64(x + Float64(Float64(x * y) * y))
        end
        
        function tmp = code(x, y)
        	tmp = x + ((x * y) * y);
        end
        
        code[x_, y_] := N[(x + N[(N[(x * y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        x + \left(x \cdot y\right) \cdot y
        \end{array}
        

        Reproduce

        ?
        herbie shell --seed 2024150 
        (FPCore (x y)
          :name "Numeric.Integration.TanhSinh:everywhere from integration-0.2.1"
          :precision binary64
        
          :alt
          (! :herbie-platform default (+ x (* (* x y) y)))
        
          (* x (+ 1.0 (* y y))))