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

Percentage Accurate: 99.9% → 99.9%
Time: 12.3s
Alternatives: 9
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(\left(x \cdot \log y - y\right) - z\right) + \log t \end{array} \]
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
	return (((x * log(y)) - y) - z) + log(t);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((x * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
	return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t):
	return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t))
end
function tmp = code(x, y, z, t)
	tmp = (((x * log(y)) - y) - z) + log(t);
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\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 9 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.9% accurate, 1.0× speedup?

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

\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}

Alternative 1: 99.9% accurate, 1.0× speedup?

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

\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
  2. Final simplification99.8%

    \[\leadsto \left(\left(x \cdot \log y - y\right) - z\right) + \log t \]

Alternative 2: 58.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \log t - y\\ \mathbf{if}\;x \leq -4.7 \cdot 10^{+67}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{-188}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.45 \cdot 10^{-256}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-255}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{-177}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 9.4 \cdot 10^{+21}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))) (t_2 (- (log t) y)))
   (if (<= x -4.7e+67)
     t_1
     (if (<= x -1.7e-188)
       t_2
       (if (<= x -2.45e-256)
         (- z)
         (if (<= x 4e-255)
           t_2
           (if (<= x 2.1e-177) (- z) (if (<= x 9.4e+21) t_2 t_1))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double t_2 = log(t) - y;
	double tmp;
	if (x <= -4.7e+67) {
		tmp = t_1;
	} else if (x <= -1.7e-188) {
		tmp = t_2;
	} else if (x <= -2.45e-256) {
		tmp = -z;
	} else if (x <= 4e-255) {
		tmp = t_2;
	} else if (x <= 2.1e-177) {
		tmp = -z;
	} else if (x <= 9.4e+21) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x * log(y)
    t_2 = log(t) - y
    if (x <= (-4.7d+67)) then
        tmp = t_1
    else if (x <= (-1.7d-188)) then
        tmp = t_2
    else if (x <= (-2.45d-256)) then
        tmp = -z
    else if (x <= 4d-255) then
        tmp = t_2
    else if (x <= 2.1d-177) then
        tmp = -z
    else if (x <= 9.4d+21) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * Math.log(y);
	double t_2 = Math.log(t) - y;
	double tmp;
	if (x <= -4.7e+67) {
		tmp = t_1;
	} else if (x <= -1.7e-188) {
		tmp = t_2;
	} else if (x <= -2.45e-256) {
		tmp = -z;
	} else if (x <= 4e-255) {
		tmp = t_2;
	} else if (x <= 2.1e-177) {
		tmp = -z;
	} else if (x <= 9.4e+21) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	t_2 = math.log(t) - y
	tmp = 0
	if x <= -4.7e+67:
		tmp = t_1
	elif x <= -1.7e-188:
		tmp = t_2
	elif x <= -2.45e-256:
		tmp = -z
	elif x <= 4e-255:
		tmp = t_2
	elif x <= 2.1e-177:
		tmp = -z
	elif x <= 9.4e+21:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	t_2 = Float64(log(t) - y)
	tmp = 0.0
	if (x <= -4.7e+67)
		tmp = t_1;
	elseif (x <= -1.7e-188)
		tmp = t_2;
	elseif (x <= -2.45e-256)
		tmp = Float64(-z);
	elseif (x <= 4e-255)
		tmp = t_2;
	elseif (x <= 2.1e-177)
		tmp = Float64(-z);
	elseif (x <= 9.4e+21)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * log(y);
	t_2 = log(t) - y;
	tmp = 0.0;
	if (x <= -4.7e+67)
		tmp = t_1;
	elseif (x <= -1.7e-188)
		tmp = t_2;
	elseif (x <= -2.45e-256)
		tmp = -z;
	elseif (x <= 4e-255)
		tmp = t_2;
	elseif (x <= 2.1e-177)
		tmp = -z;
	elseif (x <= 9.4e+21)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[x, -4.7e+67], t$95$1, If[LessEqual[x, -1.7e-188], t$95$2, If[LessEqual[x, -2.45e-256], (-z), If[LessEqual[x, 4e-255], t$95$2, If[LessEqual[x, 2.1e-177], (-z), If[LessEqual[x, 9.4e+21], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \log t - y\\
\mathbf{if}\;x \leq -4.7 \cdot 10^{+67}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -1.7 \cdot 10^{-188}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq -2.45 \cdot 10^{-256}:\\
\;\;\;\;-z\\

\mathbf{elif}\;x \leq 4 \cdot 10^{-255}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq 2.1 \cdot 10^{-177}:\\
\;\;\;\;-z\\

\mathbf{elif}\;x \leq 9.4 \cdot 10^{+21}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.70000000000000017e67 or 9.4e21 < x

    1. Initial program 99.5%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Step-by-step derivation
      1. associate--l-99.5%

        \[\leadsto \color{blue}{\left(x \cdot \log y - \left(y + z\right)\right)} + \log t \]
      2. associate-+l-99.5%

        \[\leadsto \color{blue}{x \cdot \log y - \left(\left(y + z\right) - \log t\right)} \]
      3. *-commutative99.5%

        \[\leadsto \color{blue}{\log y \cdot x} - \left(\left(y + z\right) - \log t\right) \]
      4. add-cube-cbrt98.3%

        \[\leadsto \color{blue}{\left(\left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}\right) \cdot \sqrt[3]{\log y}\right)} \cdot x - \left(\left(y + z\right) - \log t\right) \]
      5. associate-*l*98.4%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}\right) \cdot \left(\sqrt[3]{\log y} \cdot x\right)} - \left(\left(y + z\right) - \log t\right) \]
      6. fma-neg98.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}, \sqrt[3]{\log y} \cdot x, -\left(\left(y + z\right) - \log t\right)\right)} \]
      7. pow298.3%

        \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\sqrt[3]{\log y}\right)}^{2}}, \sqrt[3]{\log y} \cdot x, -\left(\left(y + z\right) - \log t\right)\right) \]
    3. Applied egg-rr98.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{\log y}\right)}^{2}, \sqrt[3]{\log y} \cdot x, -\left(\left(y + z\right) - \log t\right)\right)} \]
    4. Taylor expanded in x around inf 71.6%

      \[\leadsto \color{blue}{{1}^{0.3333333333333333} \cdot \left(\log y \cdot x\right)} \]
    5. Step-by-step derivation
      1. pow-base-171.6%

        \[\leadsto \color{blue}{1} \cdot \left(\log y \cdot x\right) \]
      2. associate-*r*71.6%

        \[\leadsto \color{blue}{\left(1 \cdot \log y\right) \cdot x} \]
      3. *-lft-identity71.6%

        \[\leadsto \color{blue}{\log y} \cdot x \]
    6. Simplified71.6%

      \[\leadsto \color{blue}{\log y \cdot x} \]

    if -4.70000000000000017e67 < x < -1.70000000000000014e-188 or -2.44999999999999998e-256 < x < 4e-255 or 2.10000000000000001e-177 < x < 9.4e21

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Taylor expanded in z around 0 67.7%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \log t\right) - y} \]
    3. Taylor expanded in x around 0 65.5%

      \[\leadsto \color{blue}{\log t} - y \]

    if -1.70000000000000014e-188 < x < -2.44999999999999998e-256 or 4e-255 < x < 2.10000000000000001e-177

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Step-by-step derivation
      1. associate--l-100.0%

        \[\leadsto \color{blue}{\left(x \cdot \log y - \left(y + z\right)\right)} + \log t \]
      2. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \log y - \left(\left(y + z\right) - \log t\right)} \]
      3. add-cube-cbrt100.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} \cdot \log y - \left(\left(y + z\right) - \log t\right) \]
      4. associate-*l*100.0%

        \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \log y\right)} - \left(\left(y + z\right) - \log t\right) \]
      5. fma-neg100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right)} \]
      6. pow2100.0%

        \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\sqrt[3]{x}\right)}^{2}}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right) \]
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{2}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right)} \]
    4. Taylor expanded in z around inf 71.6%

      \[\leadsto \color{blue}{-1 \cdot z} \]
    5. Step-by-step derivation
      1. neg-mul-171.6%

        \[\leadsto \color{blue}{-z} \]
    6. Simplified71.6%

      \[\leadsto \color{blue}{-z} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.7 \cdot 10^{+67}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{-188}:\\ \;\;\;\;\log t - y\\ \mathbf{elif}\;x \leq -2.45 \cdot 10^{-256}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-255}:\\ \;\;\;\;\log t - y\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{-177}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 9.4 \cdot 10^{+21}:\\ \;\;\;\;\log t - y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y\\ \end{array} \]

Alternative 3: 47.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -3.7 \cdot 10^{+67}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-176}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 2.85 \cdot 10^{+22}:\\ \;\;\;\;-y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))))
   (if (<= x -3.7e+67)
     t_1
     (if (<= x 2.7e-176) (- z) (if (<= x 2.85e+22) (- y) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double tmp;
	if (x <= -3.7e+67) {
		tmp = t_1;
	} else if (x <= 2.7e-176) {
		tmp = -z;
	} else if (x <= 2.85e+22) {
		tmp = -y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * log(y)
    if (x <= (-3.7d+67)) then
        tmp = t_1
    else if (x <= 2.7d-176) then
        tmp = -z
    else if (x <= 2.85d+22) then
        tmp = -y
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * Math.log(y);
	double tmp;
	if (x <= -3.7e+67) {
		tmp = t_1;
	} else if (x <= 2.7e-176) {
		tmp = -z;
	} else if (x <= 2.85e+22) {
		tmp = -y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	tmp = 0
	if x <= -3.7e+67:
		tmp = t_1
	elif x <= 2.7e-176:
		tmp = -z
	elif x <= 2.85e+22:
		tmp = -y
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	tmp = 0.0
	if (x <= -3.7e+67)
		tmp = t_1;
	elseif (x <= 2.7e-176)
		tmp = Float64(-z);
	elseif (x <= 2.85e+22)
		tmp = Float64(-y);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * log(y);
	tmp = 0.0;
	if (x <= -3.7e+67)
		tmp = t_1;
	elseif (x <= 2.7e-176)
		tmp = -z;
	elseif (x <= 2.85e+22)
		tmp = -y;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.7e+67], t$95$1, If[LessEqual[x, 2.7e-176], (-z), If[LessEqual[x, 2.85e+22], (-y), t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -3.7 \cdot 10^{+67}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 2.7 \cdot 10^{-176}:\\
\;\;\;\;-z\\

\mathbf{elif}\;x \leq 2.85 \cdot 10^{+22}:\\
\;\;\;\;-y\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.6999999999999997e67 or 2.8499999999999999e22 < x

    1. Initial program 99.5%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Step-by-step derivation
      1. associate--l-99.5%

        \[\leadsto \color{blue}{\left(x \cdot \log y - \left(y + z\right)\right)} + \log t \]
      2. associate-+l-99.5%

        \[\leadsto \color{blue}{x \cdot \log y - \left(\left(y + z\right) - \log t\right)} \]
      3. *-commutative99.5%

        \[\leadsto \color{blue}{\log y \cdot x} - \left(\left(y + z\right) - \log t\right) \]
      4. add-cube-cbrt98.3%

        \[\leadsto \color{blue}{\left(\left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}\right) \cdot \sqrt[3]{\log y}\right)} \cdot x - \left(\left(y + z\right) - \log t\right) \]
      5. associate-*l*98.4%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}\right) \cdot \left(\sqrt[3]{\log y} \cdot x\right)} - \left(\left(y + z\right) - \log t\right) \]
      6. fma-neg98.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}, \sqrt[3]{\log y} \cdot x, -\left(\left(y + z\right) - \log t\right)\right)} \]
      7. pow298.3%

        \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\sqrt[3]{\log y}\right)}^{2}}, \sqrt[3]{\log y} \cdot x, -\left(\left(y + z\right) - \log t\right)\right) \]
    3. Applied egg-rr98.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{\log y}\right)}^{2}, \sqrt[3]{\log y} \cdot x, -\left(\left(y + z\right) - \log t\right)\right)} \]
    4. Taylor expanded in x around inf 71.6%

      \[\leadsto \color{blue}{{1}^{0.3333333333333333} \cdot \left(\log y \cdot x\right)} \]
    5. Step-by-step derivation
      1. pow-base-171.6%

        \[\leadsto \color{blue}{1} \cdot \left(\log y \cdot x\right) \]
      2. associate-*r*71.6%

        \[\leadsto \color{blue}{\left(1 \cdot \log y\right) \cdot x} \]
      3. *-lft-identity71.6%

        \[\leadsto \color{blue}{\log y} \cdot x \]
    6. Simplified71.6%

      \[\leadsto \color{blue}{\log y \cdot x} \]

    if -3.6999999999999997e67 < x < 2.6999999999999998e-176

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Step-by-step derivation
      1. associate--l-100.0%

        \[\leadsto \color{blue}{\left(x \cdot \log y - \left(y + z\right)\right)} + \log t \]
      2. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \log y - \left(\left(y + z\right) - \log t\right)} \]
      3. add-cube-cbrt99.9%

        \[\leadsto \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} \cdot \log y - \left(\left(y + z\right) - \log t\right) \]
      4. associate-*l*100.0%

        \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \log y\right)} - \left(\left(y + z\right) - \log t\right) \]
      5. fma-neg100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right)} \]
      6. pow2100.0%

        \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\sqrt[3]{x}\right)}^{2}}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right) \]
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{2}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right)} \]
    4. Taylor expanded in z around inf 46.4%

      \[\leadsto \color{blue}{-1 \cdot z} \]
    5. Step-by-step derivation
      1. neg-mul-146.4%

        \[\leadsto \color{blue}{-z} \]
    6. Simplified46.4%

      \[\leadsto \color{blue}{-z} \]

    if 2.6999999999999998e-176 < x < 2.8499999999999999e22

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Step-by-step derivation
      1. associate--l-100.0%

        \[\leadsto \color{blue}{\left(x \cdot \log y - \left(y + z\right)\right)} + \log t \]
      2. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \log y - \left(\left(y + z\right) - \log t\right)} \]
      3. add-cube-cbrt100.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} \cdot \log y - \left(\left(y + z\right) - \log t\right) \]
      4. associate-*l*100.0%

        \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \log y\right)} - \left(\left(y + z\right) - \log t\right) \]
      5. fma-neg100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right)} \]
      6. pow2100.0%

        \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\sqrt[3]{x}\right)}^{2}}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right) \]
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{2}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right)} \]
    4. Taylor expanded in y around inf 52.0%

      \[\leadsto \color{blue}{-1 \cdot y} \]
    5. Step-by-step derivation
      1. neg-mul-152.0%

        \[\leadsto \color{blue}{-y} \]
    6. Simplified52.0%

      \[\leadsto \color{blue}{-y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification58.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.7 \cdot 10^{+67}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-176}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 2.85 \cdot 10^{+22}:\\ \;\;\;\;-y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y\\ \end{array} \]

Alternative 4: 60.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -2.3 \cdot 10^{+64}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{-174}:\\ \;\;\;\;\log t - z\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{+22}:\\ \;\;\;\;\log t - y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))))
   (if (<= x -2.3e+64)
     t_1
     (if (<= x 2.1e-174)
       (- (log t) z)
       (if (<= x 2.2e+22) (- (log t) y) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double tmp;
	if (x <= -2.3e+64) {
		tmp = t_1;
	} else if (x <= 2.1e-174) {
		tmp = log(t) - z;
	} else if (x <= 2.2e+22) {
		tmp = log(t) - y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * log(y)
    if (x <= (-2.3d+64)) then
        tmp = t_1
    else if (x <= 2.1d-174) then
        tmp = log(t) - z
    else if (x <= 2.2d+22) then
        tmp = log(t) - y
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * Math.log(y);
	double tmp;
	if (x <= -2.3e+64) {
		tmp = t_1;
	} else if (x <= 2.1e-174) {
		tmp = Math.log(t) - z;
	} else if (x <= 2.2e+22) {
		tmp = Math.log(t) - y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	tmp = 0
	if x <= -2.3e+64:
		tmp = t_1
	elif x <= 2.1e-174:
		tmp = math.log(t) - z
	elif x <= 2.2e+22:
		tmp = math.log(t) - y
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	tmp = 0.0
	if (x <= -2.3e+64)
		tmp = t_1;
	elseif (x <= 2.1e-174)
		tmp = Float64(log(t) - z);
	elseif (x <= 2.2e+22)
		tmp = Float64(log(t) - y);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * log(y);
	tmp = 0.0;
	if (x <= -2.3e+64)
		tmp = t_1;
	elseif (x <= 2.1e-174)
		tmp = log(t) - z;
	elseif (x <= 2.2e+22)
		tmp = log(t) - y;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.3e+64], t$95$1, If[LessEqual[x, 2.1e-174], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 2.2e+22], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -2.3 \cdot 10^{+64}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 2.1 \cdot 10^{-174}:\\
\;\;\;\;\log t - z\\

\mathbf{elif}\;x \leq 2.2 \cdot 10^{+22}:\\
\;\;\;\;\log t - y\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.3e64 or 2.2e22 < x

    1. Initial program 99.5%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Step-by-step derivation
      1. associate--l-99.5%

        \[\leadsto \color{blue}{\left(x \cdot \log y - \left(y + z\right)\right)} + \log t \]
      2. associate-+l-99.5%

        \[\leadsto \color{blue}{x \cdot \log y - \left(\left(y + z\right) - \log t\right)} \]
      3. *-commutative99.5%

        \[\leadsto \color{blue}{\log y \cdot x} - \left(\left(y + z\right) - \log t\right) \]
      4. add-cube-cbrt98.3%

        \[\leadsto \color{blue}{\left(\left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}\right) \cdot \sqrt[3]{\log y}\right)} \cdot x - \left(\left(y + z\right) - \log t\right) \]
      5. associate-*l*98.4%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}\right) \cdot \left(\sqrt[3]{\log y} \cdot x\right)} - \left(\left(y + z\right) - \log t\right) \]
      6. fma-neg98.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}, \sqrt[3]{\log y} \cdot x, -\left(\left(y + z\right) - \log t\right)\right)} \]
      7. pow298.3%

        \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\sqrt[3]{\log y}\right)}^{2}}, \sqrt[3]{\log y} \cdot x, -\left(\left(y + z\right) - \log t\right)\right) \]
    3. Applied egg-rr98.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{\log y}\right)}^{2}, \sqrt[3]{\log y} \cdot x, -\left(\left(y + z\right) - \log t\right)\right)} \]
    4. Taylor expanded in x around inf 71.6%

      \[\leadsto \color{blue}{{1}^{0.3333333333333333} \cdot \left(\log y \cdot x\right)} \]
    5. Step-by-step derivation
      1. pow-base-171.6%

        \[\leadsto \color{blue}{1} \cdot \left(\log y \cdot x\right) \]
      2. associate-*r*71.6%

        \[\leadsto \color{blue}{\left(1 \cdot \log y\right) \cdot x} \]
      3. *-lft-identity71.6%

        \[\leadsto \color{blue}{\log y} \cdot x \]
    6. Simplified71.6%

      \[\leadsto \color{blue}{\log y \cdot x} \]

    if -2.3e64 < x < 2.1000000000000001e-174

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Taylor expanded in y around 0 68.6%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \log t\right) - z} \]
    3. Step-by-step derivation
      1. +-commutative68.6%

        \[\leadsto \color{blue}{\left(\log t + \log y \cdot x\right)} - z \]
      2. *-commutative68.6%

        \[\leadsto \left(\log t + \color{blue}{x \cdot \log y}\right) - z \]
      3. log-pow60.3%

        \[\leadsto \left(\log t + \color{blue}{\log \left({y}^{x}\right)}\right) - z \]
      4. log-prod60.3%

        \[\leadsto \color{blue}{\log \left(t \cdot {y}^{x}\right)} - z \]
    4. Simplified60.3%

      \[\leadsto \color{blue}{\log \left(t \cdot {y}^{x}\right) - z} \]
    5. Taylor expanded in x around 0 66.4%

      \[\leadsto \color{blue}{\log t} - z \]

    if 2.1000000000000001e-174 < x < 2.2e22

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Taylor expanded in z around 0 71.5%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \log t\right) - y} \]
    3. Taylor expanded in x around 0 71.5%

      \[\leadsto \color{blue}{\log t} - y \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{+64}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{-174}:\\ \;\;\;\;\log t - z\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{+22}:\\ \;\;\;\;\log t - y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y\\ \end{array} \]

Alternative 5: 68.4% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{-61} \lor \neg \left(x \leq 5 \cdot 10^{-68}\right):\\ \;\;\;\;x \cdot \log y - y\\ \mathbf{else}:\\ \;\;\;\;\log t - z\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -1.9e-61) (not (<= x 5e-68)))
   (- (* x (log y)) y)
   (- (log t) z)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -1.9e-61) || !(x <= 5e-68)) {
		tmp = (x * log(y)) - y;
	} else {
		tmp = log(t) - z;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((x <= (-1.9d-61)) .or. (.not. (x <= 5d-68))) then
        tmp = (x * log(y)) - y
    else
        tmp = log(t) - z
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -1.9e-61) || !(x <= 5e-68)) {
		tmp = (x * Math.log(y)) - y;
	} else {
		tmp = Math.log(t) - z;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -1.9e-61) or not (x <= 5e-68):
		tmp = (x * math.log(y)) - y
	else:
		tmp = math.log(t) - z
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -1.9e-61) || !(x <= 5e-68))
		tmp = Float64(Float64(x * log(y)) - y);
	else
		tmp = Float64(log(t) - z);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x <= -1.9e-61) || ~((x <= 5e-68)))
		tmp = (x * log(y)) - y;
	else
		tmp = log(t) - z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.9e-61], N[Not[LessEqual[x, 5e-68]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{-61} \lor \neg \left(x \leq 5 \cdot 10^{-68}\right):\\
\;\;\;\;x \cdot \log y - y\\

\mathbf{else}:\\
\;\;\;\;\log t - z\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.8999999999999999e-61 or 4.99999999999999971e-68 < x

    1. Initial program 99.6%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Taylor expanded in z around 0 79.6%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \log t\right) - y} \]
    3. Taylor expanded in x around inf 78.4%

      \[\leadsto \color{blue}{\log y \cdot x} - y \]

    if -1.8999999999999999e-61 < x < 4.99999999999999971e-68

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Taylor expanded in y around 0 72.0%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \log t\right) - z} \]
    3. Step-by-step derivation
      1. +-commutative72.0%

        \[\leadsto \color{blue}{\left(\log t + \log y \cdot x\right)} - z \]
      2. *-commutative72.0%

        \[\leadsto \left(\log t + \color{blue}{x \cdot \log y}\right) - z \]
      3. log-pow72.0%

        \[\leadsto \left(\log t + \color{blue}{\log \left({y}^{x}\right)}\right) - z \]
      4. log-prod72.0%

        \[\leadsto \color{blue}{\log \left(t \cdot {y}^{x}\right)} - z \]
    4. Simplified72.0%

      \[\leadsto \color{blue}{\log \left(t \cdot {y}^{x}\right) - z} \]
    5. Taylor expanded in x around 0 72.0%

      \[\leadsto \color{blue}{\log t} - z \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{-61} \lor \neg \left(x \leq 5 \cdot 10^{-68}\right):\\ \;\;\;\;x \cdot \log y - y\\ \mathbf{else}:\\ \;\;\;\;\log t - z\\ \end{array} \]

Alternative 6: 89.4% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -1.7 \cdot 10^{+67}:\\ \;\;\;\;t_1 - z\\ \mathbf{elif}\;x \leq 1960:\\ \;\;\;\;\left(\log t - y\right) - z\\ \mathbf{else}:\\ \;\;\;\;t_1 - y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))))
   (if (<= x -1.7e+67)
     (- t_1 z)
     (if (<= x 1960.0) (- (- (log t) y) z) (- t_1 y)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double tmp;
	if (x <= -1.7e+67) {
		tmp = t_1 - z;
	} else if (x <= 1960.0) {
		tmp = (log(t) - y) - z;
	} else {
		tmp = t_1 - y;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * log(y)
    if (x <= (-1.7d+67)) then
        tmp = t_1 - z
    else if (x <= 1960.0d0) then
        tmp = (log(t) - y) - z
    else
        tmp = t_1 - y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * Math.log(y);
	double tmp;
	if (x <= -1.7e+67) {
		tmp = t_1 - z;
	} else if (x <= 1960.0) {
		tmp = (Math.log(t) - y) - z;
	} else {
		tmp = t_1 - y;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	tmp = 0
	if x <= -1.7e+67:
		tmp = t_1 - z
	elif x <= 1960.0:
		tmp = (math.log(t) - y) - z
	else:
		tmp = t_1 - y
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	tmp = 0.0
	if (x <= -1.7e+67)
		tmp = Float64(t_1 - z);
	elseif (x <= 1960.0)
		tmp = Float64(Float64(log(t) - y) - z);
	else
		tmp = Float64(t_1 - y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * log(y);
	tmp = 0.0;
	if (x <= -1.7e+67)
		tmp = t_1 - z;
	elseif (x <= 1960.0)
		tmp = (log(t) - y) - z;
	else
		tmp = t_1 - y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.7e+67], N[(t$95$1 - z), $MachinePrecision], If[LessEqual[x, 1960.0], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], N[(t$95$1 - y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{+67}:\\
\;\;\;\;t_1 - z\\

\mathbf{elif}\;x \leq 1960:\\
\;\;\;\;\left(\log t - y\right) - z\\

\mathbf{else}:\\
\;\;\;\;t_1 - y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.7000000000000001e67

    1. Initial program 99.5%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Taylor expanded in y around 0 89.6%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \log t\right) - z} \]
    3. Taylor expanded in x around inf 89.6%

      \[\leadsto \color{blue}{\log y \cdot x} - z \]

    if -1.7000000000000001e67 < x < 1960

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Taylor expanded in x around 0 98.3%

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    3. Step-by-step derivation
      1. associate--r+98.3%

        \[\leadsto \color{blue}{\left(\log t - y\right) - z} \]
    4. Simplified98.3%

      \[\leadsto \color{blue}{\left(\log t - y\right) - z} \]

    if 1960 < x

    1. Initial program 99.5%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Taylor expanded in z around 0 88.3%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \log t\right) - y} \]
    3. Taylor expanded in x around inf 88.3%

      \[\leadsto \color{blue}{\log y \cdot x} - y \]
  3. Recombined 3 regimes into one program.
  4. Final simplification94.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+67}:\\ \;\;\;\;x \cdot \log y - z\\ \mathbf{elif}\;x \leq 1960:\\ \;\;\;\;\left(\log t - y\right) - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y - y\\ \end{array} \]

Alternative 7: 75.1% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;y \leq 1.04 \cdot 10^{+127}:\\ \;\;\;\;t_1 - z\\ \mathbf{else}:\\ \;\;\;\;t_1 - y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y)))) (if (<= y 1.04e+127) (- t_1 z) (- t_1 y))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double tmp;
	if (y <= 1.04e+127) {
		tmp = t_1 - z;
	} else {
		tmp = t_1 - y;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * log(y)
    if (y <= 1.04d+127) then
        tmp = t_1 - z
    else
        tmp = t_1 - y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * Math.log(y);
	double tmp;
	if (y <= 1.04e+127) {
		tmp = t_1 - z;
	} else {
		tmp = t_1 - y;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	tmp = 0
	if y <= 1.04e+127:
		tmp = t_1 - z
	else:
		tmp = t_1 - y
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	tmp = 0.0
	if (y <= 1.04e+127)
		tmp = Float64(t_1 - z);
	else
		tmp = Float64(t_1 - y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * log(y);
	tmp = 0.0;
	if (y <= 1.04e+127)
		tmp = t_1 - z;
	else
		tmp = t_1 - y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.04e+127], N[(t$95$1 - z), $MachinePrecision], N[(t$95$1 - y), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;y \leq 1.04 \cdot 10^{+127}:\\
\;\;\;\;t_1 - z\\

\mathbf{else}:\\
\;\;\;\;t_1 - y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.04e127

    1. Initial program 99.7%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Taylor expanded in y around 0 91.4%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \log t\right) - z} \]
    3. Taylor expanded in x around inf 75.7%

      \[\leadsto \color{blue}{\log y \cdot x} - z \]

    if 1.04e127 < y

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Taylor expanded in z around 0 89.3%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \log t\right) - y} \]
    3. Taylor expanded in x around inf 89.3%

      \[\leadsto \color{blue}{\log y \cdot x} - y \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.04 \cdot 10^{+127}:\\ \;\;\;\;x \cdot \log y - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y - y\\ \end{array} \]

Alternative 8: 46.4% accurate, 51.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.15 \cdot 10^{+133}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \end{array} \]
(FPCore (x y z t) :precision binary64 (if (<= y 1.15e+133) (- z) (- y)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 1.15e+133) {
		tmp = -z;
	} else {
		tmp = -y;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= 1.15d+133) then
        tmp = -z
    else
        tmp = -y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 1.15e+133) {
		tmp = -z;
	} else {
		tmp = -y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 1.15e+133:
		tmp = -z
	else:
		tmp = -y
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 1.15e+133)
		tmp = Float64(-z);
	else
		tmp = Float64(-y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 1.15e+133)
		tmp = -z;
	else
		tmp = -y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.15e+133], (-z), (-y)]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.15 \cdot 10^{+133}:\\
\;\;\;\;-z\\

\mathbf{else}:\\
\;\;\;\;-y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.14999999999999995e133

    1. Initial program 99.7%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Step-by-step derivation
      1. associate--l-99.7%

        \[\leadsto \color{blue}{\left(x \cdot \log y - \left(y + z\right)\right)} + \log t \]
      2. associate-+l-99.7%

        \[\leadsto \color{blue}{x \cdot \log y - \left(\left(y + z\right) - \log t\right)} \]
      3. add-cube-cbrt99.2%

        \[\leadsto \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} \cdot \log y - \left(\left(y + z\right) - \log t\right) \]
      4. associate-*l*99.2%

        \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \log y\right)} - \left(\left(y + z\right) - \log t\right) \]
      5. fma-neg99.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right)} \]
      6. pow299.2%

        \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\sqrt[3]{x}\right)}^{2}}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right) \]
    3. Applied egg-rr99.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{2}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right)} \]
    4. Taylor expanded in z around inf 37.3%

      \[\leadsto \color{blue}{-1 \cdot z} \]
    5. Step-by-step derivation
      1. neg-mul-137.3%

        \[\leadsto \color{blue}{-z} \]
    6. Simplified37.3%

      \[\leadsto \color{blue}{-z} \]

    if 1.14999999999999995e133 < y

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Step-by-step derivation
      1. associate--l-99.9%

        \[\leadsto \color{blue}{\left(x \cdot \log y - \left(y + z\right)\right)} + \log t \]
      2. associate-+l-99.9%

        \[\leadsto \color{blue}{x \cdot \log y - \left(\left(y + z\right) - \log t\right)} \]
      3. add-cube-cbrt99.6%

        \[\leadsto \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} \cdot \log y - \left(\left(y + z\right) - \log t\right) \]
      4. associate-*l*99.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \log y\right)} - \left(\left(y + z\right) - \log t\right) \]
      5. fma-neg99.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right)} \]
      6. pow299.6%

        \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\sqrt[3]{x}\right)}^{2}}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right) \]
    3. Applied egg-rr99.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{2}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right)} \]
    4. Taylor expanded in y around inf 75.4%

      \[\leadsto \color{blue}{-1 \cdot y} \]
    5. Step-by-step derivation
      1. neg-mul-175.4%

        \[\leadsto \color{blue}{-y} \]
    6. Simplified75.4%

      \[\leadsto \color{blue}{-y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification47.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.15 \cdot 10^{+133}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \]

Alternative 9: 30.5% accurate, 104.5× speedup?

\[\begin{array}{l} \\ -y \end{array} \]
(FPCore (x y z t) :precision binary64 (- y))
double code(double x, double y, double z, double t) {
	return -y;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = -y
end function
public static double code(double x, double y, double z, double t) {
	return -y;
}
def code(x, y, z, t):
	return -y
function code(x, y, z, t)
	return Float64(-y)
end
function tmp = code(x, y, z, t)
	tmp = -y;
end
code[x_, y_, z_, t_] := (-y)
\begin{array}{l}

\\
-y
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
  2. Step-by-step derivation
    1. associate--l-99.8%

      \[\leadsto \color{blue}{\left(x \cdot \log y - \left(y + z\right)\right)} + \log t \]
    2. associate-+l-99.8%

      \[\leadsto \color{blue}{x \cdot \log y - \left(\left(y + z\right) - \log t\right)} \]
    3. add-cube-cbrt99.3%

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} \cdot \log y - \left(\left(y + z\right) - \log t\right) \]
    4. associate-*l*99.3%

      \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \log y\right)} - \left(\left(y + z\right) - \log t\right) \]
    5. fma-neg99.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right)} \]
    6. pow299.3%

      \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\sqrt[3]{x}\right)}^{2}}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right) \]
  3. Applied egg-rr99.3%

    \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{2}, \sqrt[3]{x} \cdot \log y, -\left(\left(y + z\right) - \log t\right)\right)} \]
  4. Taylor expanded in y around inf 26.7%

    \[\leadsto \color{blue}{-1 \cdot y} \]
  5. Step-by-step derivation
    1. neg-mul-126.7%

      \[\leadsto \color{blue}{-y} \]
  6. Simplified26.7%

    \[\leadsto \color{blue}{-y} \]
  7. Final simplification26.7%

    \[\leadsto -y \]

Reproduce

?
herbie shell --seed 2023199 
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, A"
  :precision binary64
  (+ (- (- (* x (log y)) y) z) (log t)))