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

Percentage Accurate: 99.9% → 99.9%
Time: 9.5s
Alternatives: 11
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 11 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. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 99.3% accurate, 1.0× speedup?

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

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

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


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

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-99.8%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 99.1%

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

    if 210 < 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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-99.9%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 99.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 210:\\ \;\;\;\;\left(x \cdot \log y + \log t\right) - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y - \left(y + z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 60.2% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \log t - y\\ \mathbf{if}\;x \leq -300000000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{-301}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-217}:\\ \;\;\;\;\log t - z\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{+61}:\\ \;\;\;\;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 -300000000000.0)
     t_1
     (if (<= x -1.7e-301)
       t_2
       (if (<= x 9e-217) (- (log t) z) (if (<= x 1.9e+61) 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 <= -300000000000.0) {
		tmp = t_1;
	} else if (x <= -1.7e-301) {
		tmp = t_2;
	} else if (x <= 9e-217) {
		tmp = log(t) - z;
	} else if (x <= 1.9e+61) {
		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 <= (-300000000000.0d0)) then
        tmp = t_1
    else if (x <= (-1.7d-301)) then
        tmp = t_2
    else if (x <= 9d-217) then
        tmp = log(t) - z
    else if (x <= 1.9d+61) 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 <= -300000000000.0) {
		tmp = t_1;
	} else if (x <= -1.7e-301) {
		tmp = t_2;
	} else if (x <= 9e-217) {
		tmp = Math.log(t) - z;
	} else if (x <= 1.9e+61) {
		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 <= -300000000000.0:
		tmp = t_1
	elif x <= -1.7e-301:
		tmp = t_2
	elif x <= 9e-217:
		tmp = math.log(t) - z
	elif x <= 1.9e+61:
		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 <= -300000000000.0)
		tmp = t_1;
	elseif (x <= -1.7e-301)
		tmp = t_2;
	elseif (x <= 9e-217)
		tmp = Float64(log(t) - z);
	elseif (x <= 1.9e+61)
		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 <= -300000000000.0)
		tmp = t_1;
	elseif (x <= -1.7e-301)
		tmp = t_2;
	elseif (x <= 9e-217)
		tmp = log(t) - z;
	elseif (x <= 1.9e+61)
		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, -300000000000.0], t$95$1, If[LessEqual[x, -1.7e-301], t$95$2, If[LessEqual[x, 9e-217], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 1.9e+61], 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 -300000000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -1.7 \cdot 10^{-301}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;x \leq 1.9 \cdot 10^{+61}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3e11 or 1.89999999999999998e61 < x

    1. Initial program 99.6%

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

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

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 99.6%

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

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

        \[\leadsto x \cdot \log y - \left(y + z \cdot \color{blue}{\left(1 - \frac{\log t}{z}\right)}\right) \]
    7. Simplified99.6%

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

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

    if -3e11 < x < -1.7000000000000001e-301 or 8.9999999999999997e-217 < x < 1.89999999999999998e61

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-100.0%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 98.3%

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

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

    if -1.7000000000000001e-301 < x < 8.9999999999999997e-217

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-100.0%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 100.0%

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

      \[\leadsto \color{blue}{\log t - z} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 58.8% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \log t - y\\ \mathbf{if}\;x \leq -2.5 \cdot 10^{+14}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -1.08 \cdot 10^{-301}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 4.3 \cdot 10^{-257}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{+61}:\\ \;\;\;\;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 -2.5e+14)
     t_1
     (if (<= x -1.08e-301)
       t_2
       (if (<= x 4.3e-257) (- z) (if (<= x 4.2e+61) 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 <= -2.5e+14) {
		tmp = t_1;
	} else if (x <= -1.08e-301) {
		tmp = t_2;
	} else if (x <= 4.3e-257) {
		tmp = -z;
	} else if (x <= 4.2e+61) {
		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 <= (-2.5d+14)) then
        tmp = t_1
    else if (x <= (-1.08d-301)) then
        tmp = t_2
    else if (x <= 4.3d-257) then
        tmp = -z
    else if (x <= 4.2d+61) 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 <= -2.5e+14) {
		tmp = t_1;
	} else if (x <= -1.08e-301) {
		tmp = t_2;
	} else if (x <= 4.3e-257) {
		tmp = -z;
	} else if (x <= 4.2e+61) {
		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 <= -2.5e+14:
		tmp = t_1
	elif x <= -1.08e-301:
		tmp = t_2
	elif x <= 4.3e-257:
		tmp = -z
	elif x <= 4.2e+61:
		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 <= -2.5e+14)
		tmp = t_1;
	elseif (x <= -1.08e-301)
		tmp = t_2;
	elseif (x <= 4.3e-257)
		tmp = Float64(-z);
	elseif (x <= 4.2e+61)
		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 <= -2.5e+14)
		tmp = t_1;
	elseif (x <= -1.08e-301)
		tmp = t_2;
	elseif (x <= 4.3e-257)
		tmp = -z;
	elseif (x <= 4.2e+61)
		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, -2.5e+14], t$95$1, If[LessEqual[x, -1.08e-301], t$95$2, If[LessEqual[x, 4.3e-257], (-z), If[LessEqual[x, 4.2e+61], 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 -2.5 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -1.08 \cdot 10^{-301}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 4.3 \cdot 10^{-257}:\\
\;\;\;\;-z\\

\mathbf{elif}\;x \leq 4.2 \cdot 10^{+61}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.5e14 or 4.2000000000000002e61 < x

    1. Initial program 99.6%

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

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

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 99.6%

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

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

        \[\leadsto x \cdot \log y - \left(y + z \cdot \color{blue}{\left(1 - \frac{\log t}{z}\right)}\right) \]
    7. Simplified99.6%

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

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

    if -2.5e14 < x < -1.08000000000000002e-301 or 4.29999999999999998e-257 < x < 4.2000000000000002e61

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-100.0%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 98.4%

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

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

    if -1.08000000000000002e-301 < x < 4.29999999999999998e-257

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-100.0%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 73.5%

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

        \[\leadsto \color{blue}{-z} \]
    7. Simplified73.5%

      \[\leadsto \color{blue}{-z} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 48.8% accurate, 1.7× speedup?

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

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

\mathbf{elif}\;z \leq -1.56 \cdot 10^{-155}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -5.4 \cdot 10^{-183}:\\
\;\;\;\;-y\\

\mathbf{elif}\;z \leq -2.2 \cdot 10^{-299}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.0000000000000002e68 or 2e120 < z

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-99.9%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 79.2%

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

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

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

    if -3.0000000000000002e68 < z < -1.56e-155 or -5.40000000000000016e-183 < z < -2.2e-299

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-99.8%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 99.8%

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

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

        \[\leadsto x \cdot \log y - \left(y + z \cdot \color{blue}{\left(1 - \frac{\log t}{z}\right)}\right) \]
    7. Simplified99.8%

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

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

    if -1.56e-155 < z < -5.40000000000000016e-183 or -2.2e-299 < z < 2e120

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-99.8%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 47.3%

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

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

      \[\leadsto \color{blue}{-y} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 99.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -15000000 \lor \neg \left(x \leq 2.6 \cdot 10^{-21}\right):\\
\;\;\;\;x \cdot \log y - \left(y + z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.5e7 or 2.60000000000000017e-21 < x

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-99.7%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 99.7%

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

    if -1.5e7 < x < 2.60000000000000017e-21

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-100.0%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -15000000 \lor \neg \left(x \leq 2.6 \cdot 10^{-21}\right):\\ \;\;\;\;x \cdot \log y - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 82.6% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{+65} \lor \neg \left(x \leq 8.2 \cdot 10^{+60}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.9999999999999999e65 or 8.2e60 < x

    1. Initial program 99.6%

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

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

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 99.6%

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

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

        \[\leadsto x \cdot \log y - \left(y + z \cdot \color{blue}{\left(1 - \frac{\log t}{z}\right)}\right) \]
    7. Simplified99.6%

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

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

    if -7.9999999999999999e65 < x < 8.2e60

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-100.0%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 96.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8 \cdot 10^{+65} \lor \neg \left(x \leq 8.2 \cdot 10^{+60}\right):\\ \;\;\;\;x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 47.2% accurate, 1.9× speedup?

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

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

\mathbf{elif}\;z \leq -4.5 \cdot 10^{-66}:\\
\;\;\;\;\log t\\

\mathbf{elif}\;z \leq 1.6 \cdot 10^{+118}:\\
\;\;\;\;-y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.023 or 1.60000000000000008e118 < z

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-99.9%

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

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

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

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

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

    if -0.023 < z < -4.4999999999999998e-66

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-99.8%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 56.7%

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

      \[\leadsto \color{blue}{\log t - z} \]
    7. Taylor expanded in z around 0 44.6%

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

    if -4.4999999999999998e-66 < z < 1.60000000000000008e118

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-99.8%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 42.3%

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

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

      \[\leadsto \color{blue}{-y} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 9: 48.3% accurate, 17.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+30} \lor \neg \left(z \leq 2.15 \cdot 10^{+120}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.95000000000000005e30 or 2.1500000000000001e120 < z

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-99.9%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 73.6%

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

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

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

    if -1.95000000000000005e30 < z < 2.1500000000000001e120

    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 - y\right) - \left(z - \log t\right)} \]
      2. associate--l-99.8%

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

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 38.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.95 \cdot 10^{+30} \lor \neg \left(z \leq 2.15 \cdot 10^{+120}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 29.8% 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 - y\right) - \left(z - \log t\right)} \]
    2. associate--l-99.8%

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

    \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in y around inf 30.0%

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

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

    \[\leadsto \color{blue}{-y} \]
  8. Add Preprocessing

Alternative 11: 2.2% accurate, 209.0× 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 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 - y\right) - \left(z - \log t\right)} \]
    2. associate--l-99.8%

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

    \[\leadsto \color{blue}{x \cdot \log y - \left(y + \left(z - \log t\right)\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. *-commutative99.8%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\log y \cdot {\left(\sqrt[3]{x}\right)}^{2}, \sqrt[3]{x}, -\left(\left(y + z\right) - \log t\right)\right)} \]
  7. Step-by-step derivation
    1. add-sqr-sqrt38.5%

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

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

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

    \[\leadsto \color{blue}{y} \]
  10. Add Preprocessing

Reproduce

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