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

Percentage Accurate: 99.9% → 99.8%
Time: 14.3s
Alternatives: 12
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 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.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, 0.5× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\log \left(\sqrt[3]{y}\right) \cdot x, 3, \left(\log t - z\right) - y\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma (* (log (cbrt y)) x) 3.0 (- (- (log t) z) y)))
double code(double x, double y, double z, double t) {
	return fma((log(cbrt(y)) * x), 3.0, ((log(t) - z) - y));
}
function code(x, y, z, t)
	return fma(Float64(log(cbrt(y)) * x), 3.0, Float64(Float64(log(t) - z) - y))
end
code[x_, y_, z_, t_] := N[(N[(N[Log[N[Power[y, 1/3], $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision] * 3.0 + N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\log \left(\sqrt[3]{y}\right) \cdot x, 3, \left(\log t - z\right) - y\right)
\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. add-cube-cbrt99.8%

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

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

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

    \[\leadsto x \cdot \color{blue}{\left(\log \left({\left(\sqrt[3]{y}\right)}^{2}\right) + \log \left(\sqrt[3]{y}\right)\right)} - \left(y + \left(z - \log t\right)\right) \]
  7. Step-by-step derivation
    1. distribute-rgt-in99.8%

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

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

    \[\leadsto \color{blue}{\left(\left(2 \cdot \log \left(\sqrt[3]{y}\right)\right) \cdot x + \log \left(\sqrt[3]{y}\right) \cdot x\right)} - \left(y + \left(z - \log t\right)\right) \]
  9. Step-by-step derivation
    1. associate-*l*99.8%

      \[\leadsto \left(\color{blue}{2 \cdot \left(\log \left(\sqrt[3]{y}\right) \cdot x\right)} + \log \left(\sqrt[3]{y}\right) \cdot x\right) - \left(y + \left(z - \log t\right)\right) \]
    2. *-un-lft-identity99.8%

      \[\leadsto \left(2 \cdot \left(\log \left(\sqrt[3]{y}\right) \cdot x\right) + \color{blue}{1 \cdot \left(\log \left(\sqrt[3]{y}\right) \cdot x\right)}\right) - \left(y + \left(z - \log t\right)\right) \]
    3. distribute-rgt-out99.8%

      \[\leadsto \color{blue}{\left(\log \left(\sqrt[3]{y}\right) \cdot x\right) \cdot \left(2 + 1\right)} - \left(y + \left(z - \log t\right)\right) \]
    4. metadata-eval99.8%

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

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

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

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

    \[\leadsto \mathsf{fma}\left(\log \left(\sqrt[3]{y}\right) \cdot x, 3, \left(\log t - z\right) - y\right) \]
  14. Add Preprocessing

Alternative 2: 89.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -2.3 \cdot 10^{+123}:\\
\;\;\;\;x \cdot \left(\log y - \frac{y - \log t}{x}\right)\\

\mathbf{elif}\;x \leq -2.05 \cdot 10^{+18}:\\
\;\;\;\;t\_1 - z\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -2.2999999999999999e123

    1. Initial program 99.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(\left(\log y + \frac{\log t}{x}\right) - \frac{y}{x}\right)} \]
    7. Step-by-step derivation
      1. associate--l+93.1%

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

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

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

    if -2.2999999999999999e123 < x < -2.05e18

    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 86.1%

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

    if -2.05e18 < x < 4.5999999999999996e35

    1. Initial program 100.0%

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

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

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

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

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

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

    if 4.5999999999999996e35 < x

    1. Initial program 99.5%

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

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

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

      \[\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 82.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{+123}:\\ \;\;\;\;x \cdot \left(\log y - \frac{y - \log t}{x}\right)\\ \mathbf{elif}\;x \leq -2.05 \cdot 10^{+18}:\\ \;\;\;\;x \cdot \log y - z\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{+35}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y - y\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 4: 89.7% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := t\_1 - y\\
\mathbf{if}\;x \leq -2.8 \cdot 10^{+123}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq -3.5 \cdot 10^{+18}:\\
\;\;\;\;t\_1 - z\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.80000000000000011e123 or 1.26e37 < 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 y around inf 87.4%

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

    if -2.80000000000000011e123 < x < -3.5e18

    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 86.1%

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

    if -3.5e18 < x < 1.26e37

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 60.5% accurate, 1.8× speedup?

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

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

\mathbf{elif}\;x \leq 3.6 \cdot 10^{-295}:\\
\;\;\;\;\log t - y\\

\mathbf{elif}\;x \leq 1.2 \cdot 10^{+37}:\\
\;\;\;\;\log t - z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.8e18 or 1.2e37 < 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 81.0%

      \[\leadsto x \cdot \log y - \color{blue}{z} \]
    6. Taylor expanded in x around inf 62.8%

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

    if -2.8e18 < x < 3.6000000000000001e-295

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot y} + \log t \]
    6. Step-by-step derivation
      1. mul-1-neg66.7%

        \[\leadsto \color{blue}{\left(-y\right)} + \log t \]
    7. Simplified66.7%

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

      \[\leadsto \color{blue}{\log t + -1 \cdot y} \]
    9. Step-by-step derivation
      1. mul-1-neg66.7%

        \[\leadsto \log t + \color{blue}{\left(-y\right)} \]
      2. sub-neg66.7%

        \[\leadsto \color{blue}{\log t - y} \]
    10. Simplified66.7%

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

    if 3.6000000000000001e-295 < x < 1.2e37

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\log t + -1 \cdot z} \]
    9. Step-by-step derivation
      1. mul-1-neg72.0%

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

        \[\leadsto \color{blue}{\log t - z} \]
    10. Simplified72.0%

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

Alternative 6: 89.6% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{+48} \lor \neg \left(x \leq 5.4 \cdot 10^{+37}\right):\\
\;\;\;\;x \cdot \log y - y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.65000000000000011e48 or 5.39999999999999973e37 < 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 y around inf 83.9%

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

    if -1.65000000000000011e48 < x < 5.39999999999999973e37

    1. Initial program 100.0%

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

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

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

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

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

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

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

Alternative 7: 83.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{+185} \lor \neg \left(x \leq 3.8 \cdot 10^{+76}\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 -5.5e+185) (not (<= x 3.8e+76)))
   (* x (log y))
   (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -5.5e+185) || !(x <= 3.8e+76)) {
		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 <= (-5.5d+185)) .or. (.not. (x <= 3.8d+76))) 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 <= -5.5e+185) || !(x <= 3.8e+76)) {
		tmp = x * Math.log(y);
	} else {
		tmp = Math.log(t) - (y + z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -5.5e+185) or not (x <= 3.8e+76):
		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 <= -5.5e+185) || !(x <= 3.8e+76))
		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 <= -5.5e+185) || ~((x <= 3.8e+76)))
		tmp = x * log(y);
	else
		tmp = log(t) - (y + z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.5e+185], N[Not[LessEqual[x, 3.8e+76]], $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 -5.5 \cdot 10^{+185} \lor \neg \left(x \leq 3.8 \cdot 10^{+76}\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 < -5.4999999999999996e185 or 3.80000000000000024e76 < 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 87.3%

      \[\leadsto x \cdot \log y - \color{blue}{z} \]
    6. Taylor expanded in x around inf 78.4%

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

    if -5.4999999999999996e185 < x < 3.80000000000000024e76

    1. Initial program 99.9%

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

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

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

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

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

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

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

Alternative 8: 60.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+18} \lor \neg \left(x \leq 1.3 \cdot 10^{-13}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.1e18 or 1.3e-13 < 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 81.6%

      \[\leadsto x \cdot \log y - \color{blue}{z} \]
    6. Taylor expanded in x around inf 61.5%

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

    if -3.1e18 < x < 1.3e-13

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot y} + \log t \]
    6. Step-by-step derivation
      1. mul-1-neg60.8%

        \[\leadsto \color{blue}{\left(-y\right)} + \log t \]
    7. Simplified60.8%

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

      \[\leadsto \color{blue}{\log t + -1 \cdot y} \]
    9. Step-by-step derivation
      1. mul-1-neg60.8%

        \[\leadsto \log t + \color{blue}{\left(-y\right)} \]
      2. sub-neg60.8%

        \[\leadsto \color{blue}{\log t - y} \]
    10. Simplified60.8%

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

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

Alternative 9: 48.3% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4 \cdot 10^{-247}:\\
\;\;\;\;-z\\

\mathbf{elif}\;y \leq 6 \cdot 10^{+75}:\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 2.40000000000000011e-247

    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 80.0%

      \[\leadsto x \cdot \log y - \color{blue}{z} \]
    6. Taylor expanded in x around 0 50.0%

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

        \[\leadsto \color{blue}{-z} \]
    8. Simplified50.0%

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

    if 2.40000000000000011e-247 < y < 6e75

    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 74.9%

      \[\leadsto x \cdot \log y - \color{blue}{z} \]
    6. Taylor expanded in x around inf 47.1%

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

    if 6e75 < y

    1. Initial program 99.9%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot y} + \log t \]
    6. Step-by-step derivation
      1. mul-1-neg60.8%

        \[\leadsto \color{blue}{\left(-y\right)} + \log t \]
    7. Simplified60.8%

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

      \[\leadsto \color{blue}{-1 \cdot y} \]
    9. Step-by-step derivation
      1. mul-1-neg60.8%

        \[\leadsto \color{blue}{-y} \]
    10. Simplified60.8%

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

Alternative 10: 48.3% accurate, 29.8× speedup?

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

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

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


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

    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 77.5%

      \[\leadsto x \cdot \log y - \color{blue}{z} \]
    6. Taylor expanded in x around 0 36.0%

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

        \[\leadsto \color{blue}{-z} \]
    8. Simplified36.0%

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

    if 2.70000000000000019e53 < y

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-y} \]
    10. Simplified59.3%

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

Alternative 11: 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. sub-neg99.8%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-y\right)} + \log t \]
  7. Simplified40.1%

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

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

      \[\leadsto \color{blue}{-y} \]
  10. Simplified28.6%

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

Alternative 12: 2.3% 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. sub-neg99.8%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-y\right)} + \log t \]
  7. Simplified40.1%

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

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

      \[\leadsto \color{blue}{-y} \]
  10. Simplified28.6%

    \[\leadsto \color{blue}{-y} \]
  11. Step-by-step derivation
    1. neg-sub028.6%

      \[\leadsto \color{blue}{0 - y} \]
    2. sub-neg28.6%

      \[\leadsto \color{blue}{0 + \left(-y\right)} \]
    3. add-sqr-sqrt0.0%

      \[\leadsto 0 + \color{blue}{\sqrt{-y} \cdot \sqrt{-y}} \]
    4. sqrt-unprod2.0%

      \[\leadsto 0 + \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}} \]
    5. sqr-neg2.0%

      \[\leadsto 0 + \sqrt{\color{blue}{y \cdot y}} \]
    6. sqrt-unprod2.1%

      \[\leadsto 0 + \color{blue}{\sqrt{y} \cdot \sqrt{y}} \]
    7. add-sqr-sqrt2.1%

      \[\leadsto 0 + \color{blue}{y} \]
  12. Applied egg-rr2.1%

    \[\leadsto \color{blue}{0 + y} \]
  13. Step-by-step derivation
    1. +-lft-identity2.1%

      \[\leadsto \color{blue}{y} \]
  14. Simplified2.1%

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

Reproduce

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