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

Percentage Accurate: 99.9% → 99.9%
Time: 15.7s
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.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.9%

    \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 89.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log t - \left(y + z\right)\\ \mathbf{if}\;z \leq -8.2 \cdot 10^{+86}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{+22}:\\ \;\;\;\;\left(x \cdot \log y - y\right) + \log t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (log t) (+ y z))))
   (if (<= z -8.2e+86)
     t_1
     (if (<= z 1.25e+22) (+ (- (* x (log y)) y) (log t)) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = log(t) - (y + z);
	double tmp;
	if (z <= -8.2e+86) {
		tmp = t_1;
	} else if (z <= 1.25e+22) {
		tmp = ((x * log(y)) - y) + log(t);
	} 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 = log(t) - (y + z)
    if (z <= (-8.2d+86)) then
        tmp = t_1
    else if (z <= 1.25d+22) then
        tmp = ((x * log(y)) - y) + log(t)
    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 = Math.log(t) - (y + z);
	double tmp;
	if (z <= -8.2e+86) {
		tmp = t_1;
	} else if (z <= 1.25e+22) {
		tmp = ((x * Math.log(y)) - y) + Math.log(t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.log(t) - (y + z)
	tmp = 0
	if z <= -8.2e+86:
		tmp = t_1
	elif z <= 1.25e+22:
		tmp = ((x * math.log(y)) - y) + math.log(t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(log(t) - Float64(y + z))
	tmp = 0.0
	if (z <= -8.2e+86)
		tmp = t_1;
	elseif (z <= 1.25e+22)
		tmp = Float64(Float64(Float64(x * log(y)) - y) + log(t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = log(t) - (y + z);
	tmp = 0.0;
	if (z <= -8.2e+86)
		tmp = t_1;
	elseif (z <= 1.25e+22)
		tmp = ((x * log(y)) - y) + log(t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.2e+86], t$95$1, If[LessEqual[z, 1.25e+22], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log t - \left(y + z\right)\\
\mathbf{if}\;z \leq -8.2 \cdot 10^{+86}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1.25 \cdot 10^{+22}:\\
\;\;\;\;\left(x \cdot \log y - y\right) + \log t\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -8.1999999999999998e86 or 1.2499999999999999e22 < z

    1. Initial program 100.0%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if -8.1999999999999998e86 < z < 1.2499999999999999e22

    1. Initial program 99.9%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 99.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.105:\\
\;\;\;\;\left(x \cdot \log y - z\right) + \log t\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(\left(-1 - \frac{z}{y}\right) - \left(0 - \log y \cdot \frac{x}{y}\right)\right)\\


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

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if 0.104999999999999996 < y

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 86.3% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -6.4 \cdot 10^{+140}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.38 \cdot 10^{+23}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+199}:\\ \;\;\;\;y \cdot \left(\left(-1 - \frac{z}{y}\right) - \left(0 - \log y \cdot \frac{x}{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))))
   (if (<= x -6.4e+140)
     t_1
     (if (<= x 1.38e+23)
       (- (log t) (+ y z))
       (if (<= x 3.3e+199)
         (* y (- (- -1.0 (/ z y)) (- 0.0 (* (log y) (/ x y)))))
         t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double tmp;
	if (x <= -6.4e+140) {
		tmp = t_1;
	} else if (x <= 1.38e+23) {
		tmp = log(t) - (y + z);
	} else if (x <= 3.3e+199) {
		tmp = y * ((-1.0 - (z / y)) - (0.0 - (log(y) * (x / 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 <= (-6.4d+140)) then
        tmp = t_1
    else if (x <= 1.38d+23) then
        tmp = log(t) - (y + z)
    else if (x <= 3.3d+199) then
        tmp = y * (((-1.0d0) - (z / y)) - (0.0d0 - (log(y) * (x / 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 <= -6.4e+140) {
		tmp = t_1;
	} else if (x <= 1.38e+23) {
		tmp = Math.log(t) - (y + z);
	} else if (x <= 3.3e+199) {
		tmp = y * ((-1.0 - (z / y)) - (0.0 - (Math.log(y) * (x / y))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	tmp = 0
	if x <= -6.4e+140:
		tmp = t_1
	elif x <= 1.38e+23:
		tmp = math.log(t) - (y + z)
	elif x <= 3.3e+199:
		tmp = y * ((-1.0 - (z / y)) - (0.0 - (math.log(y) * (x / y))))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	tmp = 0.0
	if (x <= -6.4e+140)
		tmp = t_1;
	elseif (x <= 1.38e+23)
		tmp = Float64(log(t) - Float64(y + z));
	elseif (x <= 3.3e+199)
		tmp = Float64(y * Float64(Float64(-1.0 - Float64(z / y)) - Float64(0.0 - Float64(log(y) * Float64(x / 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 <= -6.4e+140)
		tmp = t_1;
	elseif (x <= 1.38e+23)
		tmp = log(t) - (y + z);
	elseif (x <= 3.3e+199)
		tmp = y * ((-1.0 - (z / y)) - (0.0 - (log(y) * (x / 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, -6.4e+140], t$95$1, If[LessEqual[x, 1.38e+23], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.3e+199], N[(y * N[(N[(-1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision] - N[(0.0 - N[(N[Log[y], $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -6.4 \cdot 10^{+140}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 1.38 \cdot 10^{+23}:\\
\;\;\;\;\log t - \left(y + z\right)\\

\mathbf{elif}\;x \leq 3.3 \cdot 10^{+199}:\\
\;\;\;\;y \cdot \left(\left(-1 - \frac{z}{y}\right) - \left(0 - \log y \cdot \frac{x}{y}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.40000000000000021e140 or 3.2999999999999998e199 < x

    1. Initial program 99.8%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if -6.40000000000000021e140 < x < 1.38e23

    1. Initial program 100.0%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if 1.38e23 < x < 3.2999999999999998e199

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 59.1% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log t - y\\ \mathbf{if}\;z \leq -4.4 \cdot 10^{+88}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{-158}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 10^{-123}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{+66}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (log t) y)))
   (if (<= z -4.4e+88)
     (- z)
     (if (<= z 3.3e-158)
       t_1
       (if (<= z 1e-123) (* x (log y)) (if (<= z 1.55e+66) t_1 (- z)))))))
double code(double x, double y, double z, double t) {
	double t_1 = log(t) - y;
	double tmp;
	if (z <= -4.4e+88) {
		tmp = -z;
	} else if (z <= 3.3e-158) {
		tmp = t_1;
	} else if (z <= 1e-123) {
		tmp = x * log(y);
	} else if (z <= 1.55e+66) {
		tmp = t_1;
	} else {
		tmp = -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) :: t_1
    real(8) :: tmp
    t_1 = log(t) - y
    if (z <= (-4.4d+88)) then
        tmp = -z
    else if (z <= 3.3d-158) then
        tmp = t_1
    else if (z <= 1d-123) then
        tmp = x * log(y)
    else if (z <= 1.55d+66) then
        tmp = t_1
    else
        tmp = -z
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.log(t) - y;
	double tmp;
	if (z <= -4.4e+88) {
		tmp = -z;
	} else if (z <= 3.3e-158) {
		tmp = t_1;
	} else if (z <= 1e-123) {
		tmp = x * Math.log(y);
	} else if (z <= 1.55e+66) {
		tmp = t_1;
	} else {
		tmp = -z;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.log(t) - y
	tmp = 0
	if z <= -4.4e+88:
		tmp = -z
	elif z <= 3.3e-158:
		tmp = t_1
	elif z <= 1e-123:
		tmp = x * math.log(y)
	elif z <= 1.55e+66:
		tmp = t_1
	else:
		tmp = -z
	return tmp
function code(x, y, z, t)
	t_1 = Float64(log(t) - y)
	tmp = 0.0
	if (z <= -4.4e+88)
		tmp = Float64(-z);
	elseif (z <= 3.3e-158)
		tmp = t_1;
	elseif (z <= 1e-123)
		tmp = Float64(x * log(y));
	elseif (z <= 1.55e+66)
		tmp = t_1;
	else
		tmp = Float64(-z);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = log(t) - y;
	tmp = 0.0;
	if (z <= -4.4e+88)
		tmp = -z;
	elseif (z <= 3.3e-158)
		tmp = t_1;
	elseif (z <= 1e-123)
		tmp = x * log(y);
	elseif (z <= 1.55e+66)
		tmp = t_1;
	else
		tmp = -z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[z, -4.4e+88], (-z), If[LessEqual[z, 3.3e-158], t$95$1, If[LessEqual[z, 1e-123], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e+66], t$95$1, (-z)]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log t - y\\
\mathbf{if}\;z \leq -4.4 \cdot 10^{+88}:\\
\;\;\;\;-z\\

\mathbf{elif}\;z \leq 3.3 \cdot 10^{-158}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 10^{-123}:\\
\;\;\;\;x \cdot \log y\\

\mathbf{elif}\;z \leq 1.55 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.40000000000000017e88 or 1.55000000000000009e66 < z

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]

    if -4.40000000000000017e88 < z < 3.3000000000000002e-158 or 1.0000000000000001e-123 < z < 1.55000000000000009e66

    1. Initial program 99.9%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if 3.3000000000000002e-158 < z < 1.0000000000000001e-123

    1. Initial program 99.5%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 47.6% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+89}:\\
\;\;\;\;-z\\

\mathbf{elif}\;z \leq 2 \cdot 10^{-234}:\\
\;\;\;\;-y\\

\mathbf{elif}\;z \leq 10^{-123}:\\
\;\;\;\;x \cdot \log y\\

\mathbf{elif}\;z \leq 1.9 \cdot 10^{+55}:\\
\;\;\;\;-y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.99999999999999995e88 or 1.9e55 < z

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]

    if -9.99999999999999995e88 < z < 1.9999999999999999e-234 or 1.0000000000000001e-123 < z < 1.9e55

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]

    if 1.9999999999999999e-234 < z < 1.0000000000000001e-123

    1. Initial program 99.8%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 7: 46.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+87}:\\
\;\;\;\;-z\\

\mathbf{elif}\;z \leq 1.02 \cdot 10^{-230}:\\
\;\;\;\;-y\\

\mathbf{elif}\;z \leq 3.9 \cdot 10^{-160}:\\
\;\;\;\;\log t\\

\mathbf{elif}\;z \leq 4.5 \cdot 10^{+55}:\\
\;\;\;\;-y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.79999999999999963e87 or 4.49999999999999998e55 < z

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]

    if -4.79999999999999963e87 < z < 1.02e-230 or 3.89999999999999989e-160 < z < 4.49999999999999998e55

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]

    if 1.02e-230 < z < 3.89999999999999989e-160

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 8: 83.7% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -1.3 \cdot 10^{+141}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 2.95 \cdot 10^{+172}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))))
   (if (<= x -1.3e+141) t_1 (if (<= x 2.95e+172) (- (log t) (+ y z)) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double tmp;
	if (x <= -1.3e+141) {
		tmp = t_1;
	} else if (x <= 2.95e+172) {
		tmp = log(t) - (y + z);
	} 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 <= (-1.3d+141)) then
        tmp = t_1
    else if (x <= 2.95d+172) then
        tmp = log(t) - (y + z)
    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 <= -1.3e+141) {
		tmp = t_1;
	} else if (x <= 2.95e+172) {
		tmp = Math.log(t) - (y + z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	tmp = 0
	if x <= -1.3e+141:
		tmp = t_1
	elif x <= 2.95e+172:
		tmp = math.log(t) - (y + z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	tmp = 0.0
	if (x <= -1.3e+141)
		tmp = t_1;
	elseif (x <= 2.95e+172)
		tmp = Float64(log(t) - Float64(y + z));
	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 <= -1.3e+141)
		tmp = t_1;
	elseif (x <= 2.95e+172)
		tmp = log(t) - (y + z);
	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, -1.3e+141], t$95$1, If[LessEqual[x, 2.95e+172], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{+141}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 2.95 \cdot 10^{+172}:\\
\;\;\;\;\log t - \left(y + z\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.3e141 or 2.9499999999999999e172 < x

    1. Initial program 99.7%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if -1.3e141 < x < 2.9499999999999999e172

    1. Initial program 100.0%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 47.5% accurate, 17.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+88}:\\
\;\;\;\;-z\\

\mathbf{elif}\;z \leq 7.2 \cdot 10^{+53}:\\
\;\;\;\;-y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.99999999999999984e88 or 7.2e53 < z

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]

    if -3.99999999999999984e88 < z < 7.2e53

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 30.2% 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. Add Preprocessing
  3. Taylor expanded in y around inf 0

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Applied egg-rr0

    \[\leadsto expr\]
  6. Add Preprocessing

Reproduce

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