Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, B

Percentage Accurate: 99.4% → 99.4%
Time: 1.5s
Alternatives: 12
Speedup: 1.0×

Specification

?
\[\mathsf{TRUE}\left(\right)\]
\[\begin{array}{l} \\ \left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \end{array} \]
(FPCore (x y)
 :precision binary64
 (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))
double code(double x, double y) {
	return (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (3.0d0 * sqrt(x)) * ((y + (1.0d0 / (x * 9.0d0))) - 1.0d0)
end function
public static double code(double x, double y) {
	return (3.0 * Math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
def code(x, y):
	return (3.0 * math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0)
function code(x, y)
	return Float64(Float64(3.0 * sqrt(x)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) - 1.0))
end
function tmp = code(x, y)
	tmp = (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
end
code[x_, y_] := N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\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 12 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: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \end{array} \]
(FPCore (x y)
 :precision binary64
 (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))
double code(double x, double y) {
	return (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (3.0d0 * sqrt(x)) * ((y + (1.0d0 / (x * 9.0d0))) - 1.0d0)
end function
public static double code(double x, double y) {
	return (3.0 * Math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
def code(x, y):
	return (3.0 * math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0)
function code(x, y)
	return Float64(Float64(3.0 * sqrt(x)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) - 1.0))
end
function tmp = code(x, y)
	tmp = (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
end
code[x_, y_] := N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)
\end{array}

Alternative 1: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \end{array} \]
(FPCore (x y)
 :precision binary64
 (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))
double code(double x, double y) {
	return (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (3.0d0 * sqrt(x)) * ((y + (1.0d0 / (x * 9.0d0))) - 1.0d0)
end function
public static double code(double x, double y) {
	return (3.0 * Math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
def code(x, y):
	return (3.0 * math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0)
function code(x, y)
	return Float64(Float64(3.0 * sqrt(x)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) - 1.0))
end
function tmp = code(x, y)
	tmp = (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
end
code[x_, y_] := N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)
\end{array}
Derivation
  1. Initial program 99.4%

    \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 51.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{x \cdot 9}\\ \mathbf{if}\;x \leq 0.00122:\\ \;\;\;\;\left(3 \cdot \sqrt{x}\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x} \cdot \left(\left(y + t\_0\right) - 1\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* x 9.0))))
   (if (<= x 0.00122)
     (* (* 3.0 (sqrt x)) t_0)
     (* (sqrt x) (- (+ y t_0) 1.0)))))
double code(double x, double y) {
	double t_0 = 1.0 / (x * 9.0);
	double tmp;
	if (x <= 0.00122) {
		tmp = (3.0 * sqrt(x)) * t_0;
	} else {
		tmp = sqrt(x) * ((y + t_0) - 1.0);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 / (x * 9.0d0)
    if (x <= 0.00122d0) then
        tmp = (3.0d0 * sqrt(x)) * t_0
    else
        tmp = sqrt(x) * ((y + t_0) - 1.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 1.0 / (x * 9.0);
	double tmp;
	if (x <= 0.00122) {
		tmp = (3.0 * Math.sqrt(x)) * t_0;
	} else {
		tmp = Math.sqrt(x) * ((y + t_0) - 1.0);
	}
	return tmp;
}
def code(x, y):
	t_0 = 1.0 / (x * 9.0)
	tmp = 0
	if x <= 0.00122:
		tmp = (3.0 * math.sqrt(x)) * t_0
	else:
		tmp = math.sqrt(x) * ((y + t_0) - 1.0)
	return tmp
function code(x, y)
	t_0 = Float64(1.0 / Float64(x * 9.0))
	tmp = 0.0
	if (x <= 0.00122)
		tmp = Float64(Float64(3.0 * sqrt(x)) * t_0);
	else
		tmp = Float64(sqrt(x) * Float64(Float64(y + t_0) - 1.0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 1.0 / (x * 9.0);
	tmp = 0.0;
	if (x <= 0.00122)
		tmp = (3.0 * sqrt(x)) * t_0;
	else
		tmp = sqrt(x) * ((y + t_0) - 1.0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.00122], N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(N[(y + t$95$0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{x \cdot 9}\\
\mathbf{if}\;x \leq 0.00122:\\
\;\;\;\;\left(3 \cdot \sqrt{x}\right) \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(\left(y + t\_0\right) - 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.00121999999999999995

    1. Initial program 99.3%

      \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \left(3 \cdot \sqrt{x}\right) \cdot \color{blue}{\frac{\frac{1}{9}}{x}} \]
    4. Applied rewrites73.7%

      \[\leadsto \left(3 \cdot \sqrt{x}\right) \cdot \color{blue}{\frac{1}{x \cdot 9}} \]

    if 0.00121999999999999995 < x

    1. Initial program 99.6%

      \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(3 \cdot \sqrt{x}\right)} \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
    4. Applied rewrites27.6%

      \[\leadsto \color{blue}{\sqrt{x}} \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 47.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{x \cdot 9}\\ \mathbf{if}\;x \leq 0.00122:\\ \;\;\;\;\left(3 \cdot \sqrt{x}\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x} \cdot \left(y + t\_0\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* x 9.0))))
   (if (<= x 0.00122) (* (* 3.0 (sqrt x)) t_0) (* (sqrt x) (+ y t_0)))))
double code(double x, double y) {
	double t_0 = 1.0 / (x * 9.0);
	double tmp;
	if (x <= 0.00122) {
		tmp = (3.0 * sqrt(x)) * t_0;
	} else {
		tmp = sqrt(x) * (y + t_0);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 / (x * 9.0d0)
    if (x <= 0.00122d0) then
        tmp = (3.0d0 * sqrt(x)) * t_0
    else
        tmp = sqrt(x) * (y + t_0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 1.0 / (x * 9.0);
	double tmp;
	if (x <= 0.00122) {
		tmp = (3.0 * Math.sqrt(x)) * t_0;
	} else {
		tmp = Math.sqrt(x) * (y + t_0);
	}
	return tmp;
}
def code(x, y):
	t_0 = 1.0 / (x * 9.0)
	tmp = 0
	if x <= 0.00122:
		tmp = (3.0 * math.sqrt(x)) * t_0
	else:
		tmp = math.sqrt(x) * (y + t_0)
	return tmp
function code(x, y)
	t_0 = Float64(1.0 / Float64(x * 9.0))
	tmp = 0.0
	if (x <= 0.00122)
		tmp = Float64(Float64(3.0 * sqrt(x)) * t_0);
	else
		tmp = Float64(sqrt(x) * Float64(y + t_0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 1.0 / (x * 9.0);
	tmp = 0.0;
	if (x <= 0.00122)
		tmp = (3.0 * sqrt(x)) * t_0;
	else
		tmp = sqrt(x) * (y + t_0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.00122], N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(y + t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{x \cdot 9}\\
\mathbf{if}\;x \leq 0.00122:\\
\;\;\;\;\left(3 \cdot \sqrt{x}\right) \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(y + t\_0\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.00121999999999999995

    1. Initial program 99.3%

      \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \left(3 \cdot \sqrt{x}\right) \cdot \color{blue}{\frac{\frac{1}{9}}{x}} \]
    4. Applied rewrites73.7%

      \[\leadsto \left(3 \cdot \sqrt{x}\right) \cdot \color{blue}{\frac{1}{x \cdot 9}} \]

    if 0.00121999999999999995 < x

    1. Initial program 99.6%

      \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \left(3 \cdot \sqrt{x}\right) \cdot \color{blue}{\frac{\frac{1}{9} + x \cdot \left(y - 1\right)}{x}} \]
    4. Applied rewrites53.3%

      \[\leadsto \left(3 \cdot \sqrt{x}\right) \cdot \color{blue}{\left(y + \frac{1}{x \cdot 9}\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(3 \cdot \sqrt{x}\right)} \cdot \left(y + \frac{1}{x \cdot 9}\right) \]
    6. Applied rewrites20.4%

      \[\leadsto \color{blue}{\sqrt{x}} \cdot \left(y + \frac{1}{x \cdot 9}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ 3 \cdot \left(\sqrt{x} \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)\right) \end{array} \]
(FPCore (x y)
 :precision binary64
 (* 3.0 (* (sqrt x) (- (+ y (/ 1.0 (* x 9.0))) 1.0))))
double code(double x, double y) {
	return 3.0 * (sqrt(x) * ((y + (1.0 / (x * 9.0))) - 1.0));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 3.0d0 * (sqrt(x) * ((y + (1.0d0 / (x * 9.0d0))) - 1.0d0))
end function
public static double code(double x, double y) {
	return 3.0 * (Math.sqrt(x) * ((y + (1.0 / (x * 9.0))) - 1.0));
}
def code(x, y):
	return 3.0 * (math.sqrt(x) * ((y + (1.0 / (x * 9.0))) - 1.0))
function code(x, y)
	return Float64(3.0 * Float64(sqrt(x) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) - 1.0)))
end
function tmp = code(x, y)
	tmp = 3.0 * (sqrt(x) * ((y + (1.0 / (x * 9.0))) - 1.0));
end
code[x_, y_] := N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
3 \cdot \left(\sqrt{x} \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)\right)
\end{array}
Derivation
  1. Initial program 99.4%

    \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{\frac{1}{3} \cdot \sqrt{x} + 3 \cdot \left(\sqrt{{x}^{3}} \cdot \left(y - 1\right)\right)}{x}} \]
  4. Applied rewrites3.4%

    \[\leadsto \color{blue}{3 \cdot \sqrt{x}} \]
  5. Taylor expanded in x around 0

    \[\leadsto 3 \cdot \sqrt{x} \]
  6. Applied rewrites99.3%

    \[\leadsto 3 \cdot \left(\sqrt{x} \cdot \color{blue}{\left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)}\right) \]
  7. Add Preprocessing

Alternative 5: 74.5% accurate, 1.1× speedup?

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

\\
\left(3 \cdot \sqrt{x}\right) \cdot \left(y + \frac{1}{x \cdot 9}\right)
\end{array}
Derivation
  1. Initial program 99.4%

    \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \left(3 \cdot \sqrt{x}\right) \cdot \color{blue}{\frac{\frac{1}{9} + x \cdot \left(y - 1\right)}{x}} \]
  4. Applied rewrites76.0%

    \[\leadsto \left(3 \cdot \sqrt{x}\right) \cdot \color{blue}{\left(y + \frac{1}{x \cdot 9}\right)} \]
  5. Add Preprocessing

Alternative 6: 19.0% accurate, 1.2× speedup?

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

\\
\sqrt{x} \cdot \left(y + \frac{1}{x \cdot 9}\right)
\end{array}
Derivation
  1. Initial program 99.4%

    \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \left(3 \cdot \sqrt{x}\right) \cdot \color{blue}{\frac{\frac{1}{9} + x \cdot \left(y - 1\right)}{x}} \]
  4. Applied rewrites76.0%

    \[\leadsto \left(3 \cdot \sqrt{x}\right) \cdot \color{blue}{\left(y + \frac{1}{x \cdot 9}\right)} \]
  5. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\left(3 \cdot \sqrt{x}\right)} \cdot \left(y + \frac{1}{x \cdot 9}\right) \]
  6. Applied rewrites19.0%

    \[\leadsto \color{blue}{\sqrt{x}} \cdot \left(y + \frac{1}{x \cdot 9}\right) \]
  7. Add Preprocessing

Alternative 7: 8.1% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \sqrt{x} \cdot \frac{1}{x \cdot 9} \end{array} \]
(FPCore (x y) :precision binary64 (* (sqrt x) (/ 1.0 (* x 9.0))))
double code(double x, double y) {
	return sqrt(x) * (1.0 / (x * 9.0));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = sqrt(x) * (1.0d0 / (x * 9.0d0))
end function
public static double code(double x, double y) {
	return Math.sqrt(x) * (1.0 / (x * 9.0));
}
def code(x, y):
	return math.sqrt(x) * (1.0 / (x * 9.0))
function code(x, y)
	return Float64(sqrt(x) * Float64(1.0 / Float64(x * 9.0)))
end
function tmp = code(x, y)
	tmp = sqrt(x) * (1.0 / (x * 9.0));
end
code[x_, y_] := N[(N[Sqrt[x], $MachinePrecision] * N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt{x} \cdot \frac{1}{x \cdot 9}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \left(3 \cdot \sqrt{x}\right) \cdot \color{blue}{\frac{\frac{1}{9}}{x}} \]
  4. Applied rewrites38.7%

    \[\leadsto \left(3 \cdot \sqrt{x}\right) \cdot \color{blue}{\frac{1}{x \cdot 9}} \]
  5. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\left(3 \cdot \sqrt{x}\right)} \cdot \frac{1}{x \cdot 9} \]
  6. Applied rewrites8.5%

    \[\leadsto \color{blue}{\sqrt{x}} \cdot \frac{1}{x \cdot 9} \]
  7. Add Preprocessing

Alternative 8: 5.9% accurate, 2.2× speedup?

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

\\
y + \frac{1}{x \cdot 9}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{\frac{1}{3} \cdot \sqrt{x} + 3 \cdot \left(\sqrt{{x}^{3}} \cdot \left(y - 1\right)\right)}{x}} \]
  4. Applied rewrites3.4%

    \[\leadsto \color{blue}{3 \cdot \sqrt{x}} \]
  5. Taylor expanded in x around inf

    \[\leadsto \color{blue}{3 \cdot \left(\sqrt{x} \cdot \left(y - 1\right)\right)} \]
  6. Applied rewrites5.9%

    \[\leadsto \color{blue}{y + \frac{1}{x \cdot 9}} \]
  7. Add Preprocessing

Alternative 9: 4.0% accurate, 2.5× speedup?

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

\\
\frac{1}{x \cdot 9}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{\frac{1}{3} \cdot \sqrt{x} + 3 \cdot \left(\sqrt{{x}^{3}} \cdot \left(y - 1\right)\right)}{x}} \]
  4. Applied rewrites3.4%

    \[\leadsto \color{blue}{3 \cdot \sqrt{x}} \]
  5. Taylor expanded in x around inf

    \[\leadsto \color{blue}{3 \cdot \left(\sqrt{x} \cdot \left(y - 1\right)\right)} \]
  6. Applied rewrites5.9%

    \[\leadsto \color{blue}{y + \frac{1}{x \cdot 9}} \]
  7. Taylor expanded in x around inf

    \[\leadsto \left(y + \frac{1}{9} \cdot \frac{1}{x}\right) - \color{blue}{1} \]
  8. Applied rewrites4.1%

    \[\leadsto \frac{1}{\color{blue}{x \cdot 9}} \]
  9. Add Preprocessing

Alternative 10: 3.3% accurate, 2.7× speedup?

\[\begin{array}{l} \\ 3 \cdot \sqrt{x} \end{array} \]
(FPCore (x y) :precision binary64 (* 3.0 (sqrt x)))
double code(double x, double y) {
	return 3.0 * sqrt(x);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 3.0d0 * sqrt(x)
end function
public static double code(double x, double y) {
	return 3.0 * Math.sqrt(x);
}
def code(x, y):
	return 3.0 * math.sqrt(x)
function code(x, y)
	return Float64(3.0 * sqrt(x))
end
function tmp = code(x, y)
	tmp = 3.0 * sqrt(x);
end
code[x_, y_] := N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
3 \cdot \sqrt{x}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{\frac{1}{3} \cdot \sqrt{x} + 3 \cdot \left(\sqrt{{x}^{3}} \cdot \left(y - 1\right)\right)}{x}} \]
  4. Applied rewrites3.4%

    \[\leadsto \color{blue}{3 \cdot \sqrt{x}} \]
  5. Add Preprocessing

Alternative 11: 3.3% accurate, 3.9× speedup?

\[\begin{array}{l} \\ \sqrt{x} \end{array} \]
(FPCore (x y) :precision binary64 (sqrt x))
double code(double x, double y) {
	return sqrt(x);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = sqrt(x)
end function
public static double code(double x, double y) {
	return Math.sqrt(x);
}
def code(x, y):
	return math.sqrt(x)
function code(x, y)
	return sqrt(x)
end
function tmp = code(x, y)
	tmp = sqrt(x);
end
code[x_, y_] := N[Sqrt[x], $MachinePrecision]
\begin{array}{l}

\\
\sqrt{x}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{\frac{1}{3} \cdot \sqrt{x} + 3 \cdot \left(\sqrt{{x}^{3}} \cdot \left(y - 1\right)\right)}{x}} \]
  4. Applied rewrites3.4%

    \[\leadsto \color{blue}{3 \cdot \sqrt{x}} \]
  5. Taylor expanded in x around 0

    \[\leadsto 3 \cdot \color{blue}{\sqrt{x}} \]
  6. Applied rewrites3.4%

    \[\leadsto \sqrt{x} \]
  7. Add Preprocessing

Alternative 12: 3.0% accurate, 7.2× speedup?

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

\\
x \cdot 9
\end{array}
Derivation
  1. Initial program 99.4%

    \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{\frac{1}{3} \cdot \sqrt{x} + 3 \cdot \left(\sqrt{{x}^{3}} \cdot \left(y - 1\right)\right)}{x}} \]
  4. Applied rewrites3.4%

    \[\leadsto \color{blue}{3 \cdot \sqrt{x}} \]
  5. Taylor expanded in x around inf

    \[\leadsto \color{blue}{3 \cdot \left(\sqrt{x} \cdot \left(y - 1\right)\right)} \]
  6. Applied rewrites5.9%

    \[\leadsto \color{blue}{y + \frac{1}{x \cdot 9}} \]
  7. Taylor expanded in x around inf

    \[\leadsto \left(y + \frac{1}{9} \cdot \frac{1}{x}\right) - \color{blue}{1} \]
  8. Applied rewrites4.1%

    \[\leadsto \frac{1}{\color{blue}{x \cdot 9}} \]
  9. Taylor expanded in x around 0

    \[\leadsto \frac{\frac{1}{9} + x \cdot \left(y - 1\right)}{\color{blue}{x}} \]
  10. Applied rewrites3.1%

    \[\leadsto x \cdot \color{blue}{9} \]
  11. Add Preprocessing

Developer Target 1: 99.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ 3 \cdot \left(y \cdot \sqrt{x} + \left(\frac{1}{x \cdot 9} - 1\right) \cdot \sqrt{x}\right) \end{array} \]
(FPCore (x y)
 :precision binary64
 (* 3.0 (+ (* y (sqrt x)) (* (- (/ 1.0 (* x 9.0)) 1.0) (sqrt x)))))
double code(double x, double y) {
	return 3.0 * ((y * sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * sqrt(x)));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 3.0d0 * ((y * sqrt(x)) + (((1.0d0 / (x * 9.0d0)) - 1.0d0) * sqrt(x)))
end function
public static double code(double x, double y) {
	return 3.0 * ((y * Math.sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * Math.sqrt(x)));
}
def code(x, y):
	return 3.0 * ((y * math.sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * math.sqrt(x)))
function code(x, y)
	return Float64(3.0 * Float64(Float64(y * sqrt(x)) + Float64(Float64(Float64(1.0 / Float64(x * 9.0)) - 1.0) * sqrt(x))))
end
function tmp = code(x, y)
	tmp = 3.0 * ((y * sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * sqrt(x)));
end
code[x_, y_] := N[(3.0 * N[(N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
3 \cdot \left(y \cdot \sqrt{x} + \left(\frac{1}{x \cdot 9} - 1\right) \cdot \sqrt{x}\right)
\end{array}

Reproduce

?
herbie shell --seed 2024321 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, B"
  :precision binary64
  :pre (TRUE)

  :alt
  (! :herbie-platform default (* 3 (+ (* y (sqrt x)) (* (- (/ 1 (* x 9)) 1) (sqrt x)))))

  (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))