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

Percentage Accurate: 99.9% → 99.8%
Time: 10.2s
Alternatives: 10
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 10 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.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(-2 \cdot y + \left(y + \log y \cdot x\right)\right) - z\right) + \log t \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (- (+ (* -2.0 y) (+ y (* (log y) x))) z) (log t)))
double code(double x, double y, double z, double t) {
	return (((-2.0 * y) + (y + (log(y) * x))) - 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 = ((((-2.0d0) * y) + (y + (log(y) * x))) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
	return (((-2.0 * y) + (y + (Math.log(y) * x))) - z) + Math.log(t);
}
def code(x, y, z, t):
	return (((-2.0 * y) + (y + (math.log(y) * x))) - z) + math.log(t)
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(-2.0 * y) + Float64(y + Float64(log(y) * x))) - z) + log(t))
end
function tmp = code(x, y, z, t)
	tmp = (((-2.0 * y) + (y + (log(y) * x))) - z) + log(t);
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-2.0 * y), $MachinePrecision] + N[(y + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

      \[\leadsto \frac{\color{blue}{{\left(x \cdot \log y - y\right)}^{2}} - z \cdot z}{\left(x \cdot \log y - y\right) + z} + \log t \]
  3. Applied egg-rr44.3%

    \[\leadsto \color{blue}{\frac{{\left(x \cdot \log y - y\right)}^{2} - z \cdot z}{\left(x \cdot \log y - y\right) + z}} + \log t \]
  4. Taylor expanded in x around inf 99.9%

    \[\leadsto \color{blue}{\left(\left(-2 \cdot y + \left(y + \log y \cdot x\right)\right) - z\right)} + \log t \]
  5. Final simplification99.9%

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

Alternative 2: 89.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+29} \lor \neg \left(z \leq 7.4 \cdot 10^{+121}\right):\\
\;\;\;\;\left(-z\right) - y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.0500000000000001e29 or 7.40000000000000025e121 < z

    1. Initial program 100.0%

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

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

        \[\leadsto \log t - \color{blue}{\left(z + y\right)} \]
      2. associate--r+89.8%

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

      \[\leadsto \color{blue}{\left(\log t - z\right) - y} \]
    5. Taylor expanded in z around inf 89.8%

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

        \[\leadsto \color{blue}{\left(-z\right)} - y \]
    7. Simplified89.8%

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

    if -1.0500000000000001e29 < z < 7.40000000000000025e121

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{+29} \lor \neg \left(z \leq 7.4 \cdot 10^{+121}\right):\\ \;\;\;\;\left(-z\right) - y\\ \mathbf{else}:\\ \;\;\;\;\left(\log y \cdot x + \log t\right) - y\\ \end{array} \]

Alternative 3: 82.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+212} \lor \neg \left(x \leq 5 \cdot 10^{+142}\right):\\
\;\;\;\;\log y \cdot x + \log t\\

\mathbf{else}:\\
\;\;\;\;\left(\log t - z\right) - y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.09999999999999998e212 or 5.0000000000000001e142 < x

    1. Initial program 99.7%

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

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

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

    if -1.09999999999999998e212 < x < 5.0000000000000001e142

    1. Initial program 99.9%

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

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

        \[\leadsto \log t - \color{blue}{\left(z + y\right)} \]
      2. associate--r+89.0%

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

      \[\leadsto \color{blue}{\left(\log t - z\right) - y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.1%

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

Alternative 4: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 5: 69.4% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -17 \lor \neg \left(z \leq 1.15 \cdot 10^{-50}\right):\\ \;\;\;\;\left(-z\right) - y\\ \mathbf{else}:\\ \;\;\;\;\log t - y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= z -17.0) (not (<= z 1.15e-50))) (- (- z) y) (- (log t) y)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -17.0) || !(z <= 1.15e-50)) {
		tmp = -z - y;
	} else {
		tmp = log(t) - 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 ((z <= (-17.0d0)) .or. (.not. (z <= 1.15d-50))) then
        tmp = -z - y
    else
        tmp = log(t) - y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -17.0) || !(z <= 1.15e-50)) {
		tmp = -z - y;
	} else {
		tmp = Math.log(t) - y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -17.0) or not (z <= 1.15e-50):
		tmp = -z - y
	else:
		tmp = math.log(t) - y
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((z <= -17.0) || !(z <= 1.15e-50))
		tmp = Float64(Float64(-z) - y);
	else
		tmp = Float64(log(t) - y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z <= -17.0) || ~((z <= 1.15e-50)))
		tmp = -z - y;
	else
		tmp = log(t) - y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -17.0], N[Not[LessEqual[z, 1.15e-50]], $MachinePrecision]], N[((-z) - y), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -17 \lor \neg \left(z \leq 1.15 \cdot 10^{-50}\right):\\
\;\;\;\;\left(-z\right) - y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -17 or 1.1500000000000001e-50 < z

    1. Initial program 99.9%

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

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

        \[\leadsto \log t - \color{blue}{\left(z + y\right)} \]
      2. associate--r+81.5%

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

      \[\leadsto \color{blue}{\left(\log t - z\right) - y} \]
    5. Taylor expanded in z around inf 80.7%

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

        \[\leadsto \color{blue}{\left(-z\right)} - y \]
    7. Simplified80.7%

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

    if -17 < z < 1.1500000000000001e-50

    1. Initial program 99.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -17 \lor \neg \left(z \leq 1.15 \cdot 10^{-50}\right):\\ \;\;\;\;\left(-z\right) - y\\ \mathbf{else}:\\ \;\;\;\;\log t - y\\ \end{array} \]

Alternative 6: 69.5% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 7.2 \cdot 10^{-19}:\\ \;\;\;\;\log t - z\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) - y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y 7.2e-19) (- (log t) z) (- (- z) y)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 7.2e-19) {
		tmp = log(t) - z;
	} else {
		tmp = -z - 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 <= 7.2d-19) then
        tmp = log(t) - z
    else
        tmp = -z - y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 7.2e-19) {
		tmp = Math.log(t) - z;
	} else {
		tmp = -z - y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 7.2e-19:
		tmp = math.log(t) - z
	else:
		tmp = -z - y
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 7.2e-19)
		tmp = Float64(log(t) - z);
	else
		tmp = Float64(Float64(-z) - y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 7.2e-19)
		tmp = log(t) - z;
	else
		tmp = -z - y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 7.2e-19], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], N[((-z) - y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.2 \cdot 10^{-19}:\\
\;\;\;\;\log t - z\\

\mathbf{else}:\\
\;\;\;\;\left(-z\right) - y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 7.2000000000000002e-19

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{-1 \cdot z} + \log t \]
    3. Step-by-step derivation
      1. neg-mul-163.4%

        \[\leadsto \color{blue}{\left(-z\right)} + \log t \]
    4. Simplified63.4%

      \[\leadsto \color{blue}{\left(-z\right)} + \log t \]
    5. Taylor expanded in z around 0 63.4%

      \[\leadsto \color{blue}{-1 \cdot z + \log t} \]
    6. Step-by-step derivation
      1. mul-1-neg63.4%

        \[\leadsto \color{blue}{\left(-z\right)} + \log t \]
      2. +-commutative63.4%

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

        \[\leadsto \color{blue}{\log t - z} \]
    7. Simplified63.4%

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

    if 7.2000000000000002e-19 < y

    1. Initial program 99.9%

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

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

        \[\leadsto \log t - \color{blue}{\left(z + y\right)} \]
      2. associate--r+82.8%

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

      \[\leadsto \color{blue}{\left(\log t - z\right) - y} \]
    5. Taylor expanded in z around inf 82.7%

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

        \[\leadsto \color{blue}{\left(-z\right)} - y \]
    7. Simplified82.7%

      \[\leadsto \color{blue}{\left(-z\right)} - y \]
  3. Recombined 2 regimes into one program.
  4. Final simplification73.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 7.2 \cdot 10^{-19}:\\ \;\;\;\;\log t - z\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) - y\\ \end{array} \]

Alternative 7: 70.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \left(\log t - z\right) - y \end{array} \]
(FPCore (x y z t) :precision binary64 (- (- (log t) z) y))
double code(double x, double y, double z, double t) {
	return (log(t) - z) - 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 = (log(t) - z) - y
end function
public static double code(double x, double y, double z, double t) {
	return (Math.log(t) - z) - y;
}
def code(x, y, z, t):
	return (math.log(t) - z) - y
function code(x, y, z, t)
	return Float64(Float64(log(t) - z) - y)
end
function tmp = code(x, y, z, t)
	tmp = (log(t) - z) - y;
end
code[x_, y_, z_, t_] := N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]
\begin{array}{l}

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

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

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

      \[\leadsto \log t - \color{blue}{\left(z + y\right)} \]
    2. associate--r+73.9%

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

    \[\leadsto \color{blue}{\left(\log t - z\right) - y} \]
  5. Final simplification73.9%

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

Alternative 8: 47.4% accurate, 25.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 90000000000:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+70}:\\ \;\;\;\;-y\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{+112}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y 90000000000.0)
   (- z)
   (if (<= y 4.8e+70) (- y) (if (<= y 6.2e+112) (- z) (- y)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 90000000000.0) {
		tmp = -z;
	} else if (y <= 4.8e+70) {
		tmp = -y;
	} else if (y <= 6.2e+112) {
		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 <= 90000000000.0d0) then
        tmp = -z
    else if (y <= 4.8d+70) then
        tmp = -y
    else if (y <= 6.2d+112) 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 <= 90000000000.0) {
		tmp = -z;
	} else if (y <= 4.8e+70) {
		tmp = -y;
	} else if (y <= 6.2e+112) {
		tmp = -z;
	} else {
		tmp = -y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 90000000000.0:
		tmp = -z
	elif y <= 4.8e+70:
		tmp = -y
	elif y <= 6.2e+112:
		tmp = -z
	else:
		tmp = -y
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 90000000000.0)
		tmp = Float64(-z);
	elseif (y <= 4.8e+70)
		tmp = Float64(-y);
	elseif (y <= 6.2e+112)
		tmp = Float64(-z);
	else
		tmp = Float64(-y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 90000000000.0)
		tmp = -z;
	elseif (y <= 4.8e+70)
		tmp = -y;
	elseif (y <= 6.2e+112)
		tmp = -z;
	else
		tmp = -y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 90000000000.0], (-z), If[LessEqual[y, 4.8e+70], (-y), If[LessEqual[y, 6.2e+112], (-z), (-y)]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 90000000000:\\
\;\;\;\;-z\\

\mathbf{elif}\;y \leq 4.8 \cdot 10^{+70}:\\
\;\;\;\;-y\\

\mathbf{elif}\;y \leq 6.2 \cdot 10^{+112}:\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 9e10 or 4.79999999999999974e70 < y < 6.19999999999999965e112

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{-1 \cdot z} + \log t \]
    3. Step-by-step derivation
      1. neg-mul-164.0%

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

      \[\leadsto \color{blue}{\left(-z\right)} + \log t \]
    5. Taylor expanded in z around inf 42.2%

      \[\leadsto \color{blue}{-1 \cdot z} \]
    6. Step-by-step derivation
      1. mul-1-neg42.2%

        \[\leadsto \color{blue}{-z} \]
    7. Simplified42.2%

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

    if 9e10 < y < 4.79999999999999974e70 or 6.19999999999999965e112 < y

    1. Initial program 99.9%

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

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

        \[\leadsto \log t - \color{blue}{\left(z + y\right)} \]
      2. associate--r+82.4%

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

      \[\leadsto \color{blue}{\left(\log t - z\right) - y} \]
    5. Taylor expanded in y around inf 69.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 90000000000:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+70}:\\ \;\;\;\;-y\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{+112}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \]

Alternative 9: 57.7% accurate, 52.3× speedup?

\[\begin{array}{l} \\ \left(-z\right) - y \end{array} \]
(FPCore (x y z t) :precision binary64 (- (- z) y))
double code(double x, double y, double z, double t) {
	return -z - 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 = -z - y
end function
public static double code(double x, double y, double z, double t) {
	return -z - y;
}
def code(x, y, z, t):
	return -z - y
function code(x, y, z, t)
	return Float64(Float64(-z) - y)
end
function tmp = code(x, y, z, t)
	tmp = -z - y;
end
code[x_, y_, z_, t_] := N[((-z) - y), $MachinePrecision]
\begin{array}{l}

\\
\left(-z\right) - y
\end{array}
Derivation
  1. Initial program 99.9%

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

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

      \[\leadsto \log t - \color{blue}{\left(z + y\right)} \]
    2. associate--r+73.9%

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

    \[\leadsto \color{blue}{\left(\log t - z\right) - y} \]
  5. Taylor expanded in z around inf 62.1%

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

      \[\leadsto \color{blue}{\left(-z\right)} - y \]
  7. Simplified62.1%

    \[\leadsto \color{blue}{\left(-z\right)} - y \]
  8. Final simplification62.1%

    \[\leadsto \left(-z\right) - y \]

Alternative 10: 29.9% 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.9%

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

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

      \[\leadsto \log t - \color{blue}{\left(z + y\right)} \]
    2. associate--r+73.9%

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

    \[\leadsto \color{blue}{\left(\log t - z\right) - y} \]
  5. Taylor expanded in y around inf 34.6%

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

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

    \[\leadsto \color{blue}{-y} \]
  8. Final simplification34.6%

    \[\leadsto -y \]

Reproduce

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