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

Percentage Accurate: 99.9% → 99.9%
Time: 9.7s
Alternatives: 15
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 15 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, 0.7× speedup?

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

\\
\mathsf{fma}\left(\log y, x, \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. sub-neg99.8%

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(\log y, x, \left(\log t - z\right) - y\right) \]

Alternative 2: 99.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.55:\\ \;\;\;\;\left(\log y \cdot x - y\right) - z\\ \mathbf{elif}\;x \leq 1.55:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, \left(-y\right) - z\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= x -1.55)
   (- (- (* (log y) x) y) z)
   (if (<= x 1.55) (- (log t) (+ y z)) (fma (log y) x (- (- y) z)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -1.55) {
		tmp = ((log(y) * x) - y) - z;
	} else if (x <= 1.55) {
		tmp = log(t) - (y + z);
	} else {
		tmp = fma(log(y), x, (-y - z));
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (x <= -1.55)
		tmp = Float64(Float64(Float64(log(y) * x) - y) - z);
	elseif (x <= 1.55)
		tmp = Float64(log(t) - Float64(y + z));
	else
		tmp = fma(log(y), x, Float64(Float64(-y) - z));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.55], N[(N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 1.55], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x + N[((-y) - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \left(-y\right) - z\right)\\


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

    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. sub-neg99.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot y - \log \left(\frac{1}{y}\right) \cdot x\right)} - z \]
      3. mul-1-neg98.1%

        \[\leadsto \left(\color{blue}{\left(-y\right)} - \log \left(\frac{1}{y}\right) \cdot x\right) - z \]
      4. log-rec99.6%

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

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

    if -1.55000000000000004 < x < 1.55000000000000004

    1. Initial program 100.0%

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

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

    if 1.55000000000000004 < 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. sub-neg99.6%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.55:\\ \;\;\;\;\left(\log y \cdot x - y\right) - z\\ \mathbf{elif}\;x \leq 1.55:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, \left(-y\right) - z\right)\\ \end{array} \]

Alternative 3: 99.1% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.8%

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

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

    if 1.9e-6 < 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. sub-neg99.9%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot y - \log \left(\frac{1}{y}\right) \cdot x\right)} - z \]
      3. mul-1-neg99.5%

        \[\leadsto \left(\color{blue}{\left(-y\right)} - \log \left(\frac{1}{y}\right) \cdot x\right) - z \]
      4. log-rec99.5%

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

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

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

Alternative 4: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 5: 69.9% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log y \cdot x\\ t_2 := \left(-y\right) - z\\ \mathbf{if}\;x \leq -1.16 \cdot 10^{+218}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{+177}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.7 \cdot 10^{-101}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-74}:\\ \;\;\;\;\log t - y\\ \mathbf{elif}\;x \leq 8.6 \cdot 10^{+133}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (log y) x)) (t_2 (- (- y) z)))
   (if (<= x -1.16e+218)
     t_1
     (if (<= x -2.4e+177)
       t_2
       (if (<= x -6e+87)
         t_1
         (if (<= x 4.7e-101)
           t_2
           (if (<= x 3.8e-74) (- (log t) y) (if (<= x 8.6e+133) t_2 t_1))))))))
double code(double x, double y, double z, double t) {
	double t_1 = log(y) * x;
	double t_2 = -y - z;
	double tmp;
	if (x <= -1.16e+218) {
		tmp = t_1;
	} else if (x <= -2.4e+177) {
		tmp = t_2;
	} else if (x <= -6e+87) {
		tmp = t_1;
	} else if (x <= 4.7e-101) {
		tmp = t_2;
	} else if (x <= 3.8e-74) {
		tmp = log(t) - y;
	} else if (x <= 8.6e+133) {
		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 = log(y) * x
    t_2 = -y - z
    if (x <= (-1.16d+218)) then
        tmp = t_1
    else if (x <= (-2.4d+177)) then
        tmp = t_2
    else if (x <= (-6d+87)) then
        tmp = t_1
    else if (x <= 4.7d-101) then
        tmp = t_2
    else if (x <= 3.8d-74) then
        tmp = log(t) - y
    else if (x <= 8.6d+133) 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 = Math.log(y) * x;
	double t_2 = -y - z;
	double tmp;
	if (x <= -1.16e+218) {
		tmp = t_1;
	} else if (x <= -2.4e+177) {
		tmp = t_2;
	} else if (x <= -6e+87) {
		tmp = t_1;
	} else if (x <= 4.7e-101) {
		tmp = t_2;
	} else if (x <= 3.8e-74) {
		tmp = Math.log(t) - y;
	} else if (x <= 8.6e+133) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.log(y) * x
	t_2 = -y - z
	tmp = 0
	if x <= -1.16e+218:
		tmp = t_1
	elif x <= -2.4e+177:
		tmp = t_2
	elif x <= -6e+87:
		tmp = t_1
	elif x <= 4.7e-101:
		tmp = t_2
	elif x <= 3.8e-74:
		tmp = math.log(t) - y
	elif x <= 8.6e+133:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(log(y) * x)
	t_2 = Float64(Float64(-y) - z)
	tmp = 0.0
	if (x <= -1.16e+218)
		tmp = t_1;
	elseif (x <= -2.4e+177)
		tmp = t_2;
	elseif (x <= -6e+87)
		tmp = t_1;
	elseif (x <= 4.7e-101)
		tmp = t_2;
	elseif (x <= 3.8e-74)
		tmp = Float64(log(t) - y);
	elseif (x <= 8.6e+133)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = log(y) * x;
	t_2 = -y - z;
	tmp = 0.0;
	if (x <= -1.16e+218)
		tmp = t_1;
	elseif (x <= -2.4e+177)
		tmp = t_2;
	elseif (x <= -6e+87)
		tmp = t_1;
	elseif (x <= 4.7e-101)
		tmp = t_2;
	elseif (x <= 3.8e-74)
		tmp = log(t) - y;
	elseif (x <= 8.6e+133)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[((-y) - z), $MachinePrecision]}, If[LessEqual[x, -1.16e+218], t$95$1, If[LessEqual[x, -2.4e+177], t$95$2, If[LessEqual[x, -6e+87], t$95$1, If[LessEqual[x, 4.7e-101], t$95$2, If[LessEqual[x, 3.8e-74], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, 8.6e+133], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log y \cdot x\\
t_2 := \left(-y\right) - z\\
\mathbf{if}\;x \leq -1.16 \cdot 10^{+218}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -2.4 \cdot 10^{+177}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq -6 \cdot 10^{+87}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 4.7 \cdot 10^{-101}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;x \leq 8.6 \cdot 10^{+133}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.15999999999999994e218 or -2.4e177 < x < -5.9999999999999998e87 or 8.59999999999999989e133 < 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. sub-neg99.5%

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

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

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

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

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

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

    if -1.15999999999999994e218 < x < -2.4e177 or -5.9999999999999998e87 < x < 4.6999999999999999e-101 or 3.7999999999999996e-74 < x < 8.59999999999999989e133

    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. sub-neg99.9%

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

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

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

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

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

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

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

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

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

    if 4.6999999999999999e-101 < x < 3.7999999999999996e-74

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.16 \cdot 10^{+218}:\\ \;\;\;\;\log y \cdot x\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{+177}:\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+87}:\\ \;\;\;\;\log y \cdot x\\ \mathbf{elif}\;x \leq 4.7 \cdot 10^{-101}:\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-74}:\\ \;\;\;\;\log t - y\\ \mathbf{elif}\;x \leq 8.6 \cdot 10^{+133}:\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{else}:\\ \;\;\;\;\log y \cdot x\\ \end{array} \]

Alternative 6: 68.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log y \cdot x\\ t_2 := \left(-y\right) - z\\ \mathbf{if}\;x \leq -1.2 \cdot 10^{+218}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{+177}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{+88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{-301}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.3 \cdot 10^{-81}:\\ \;\;\;\;\log t - z\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{+137}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (log y) x)) (t_2 (- (- y) z)))
   (if (<= x -1.2e+218)
     t_1
     (if (<= x -2.4e+177)
       t_2
       (if (<= x -7.2e+88)
         t_1
         (if (<= x -2.8e-301)
           t_2
           (if (<= x 4.3e-81) (- (log t) z) (if (<= x 8.5e+137) t_2 t_1))))))))
double code(double x, double y, double z, double t) {
	double t_1 = log(y) * x;
	double t_2 = -y - z;
	double tmp;
	if (x <= -1.2e+218) {
		tmp = t_1;
	} else if (x <= -2.4e+177) {
		tmp = t_2;
	} else if (x <= -7.2e+88) {
		tmp = t_1;
	} else if (x <= -2.8e-301) {
		tmp = t_2;
	} else if (x <= 4.3e-81) {
		tmp = log(t) - z;
	} else if (x <= 8.5e+137) {
		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 = log(y) * x
    t_2 = -y - z
    if (x <= (-1.2d+218)) then
        tmp = t_1
    else if (x <= (-2.4d+177)) then
        tmp = t_2
    else if (x <= (-7.2d+88)) then
        tmp = t_1
    else if (x <= (-2.8d-301)) then
        tmp = t_2
    else if (x <= 4.3d-81) then
        tmp = log(t) - z
    else if (x <= 8.5d+137) 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 = Math.log(y) * x;
	double t_2 = -y - z;
	double tmp;
	if (x <= -1.2e+218) {
		tmp = t_1;
	} else if (x <= -2.4e+177) {
		tmp = t_2;
	} else if (x <= -7.2e+88) {
		tmp = t_1;
	} else if (x <= -2.8e-301) {
		tmp = t_2;
	} else if (x <= 4.3e-81) {
		tmp = Math.log(t) - z;
	} else if (x <= 8.5e+137) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.log(y) * x
	t_2 = -y - z
	tmp = 0
	if x <= -1.2e+218:
		tmp = t_1
	elif x <= -2.4e+177:
		tmp = t_2
	elif x <= -7.2e+88:
		tmp = t_1
	elif x <= -2.8e-301:
		tmp = t_2
	elif x <= 4.3e-81:
		tmp = math.log(t) - z
	elif x <= 8.5e+137:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(log(y) * x)
	t_2 = Float64(Float64(-y) - z)
	tmp = 0.0
	if (x <= -1.2e+218)
		tmp = t_1;
	elseif (x <= -2.4e+177)
		tmp = t_2;
	elseif (x <= -7.2e+88)
		tmp = t_1;
	elseif (x <= -2.8e-301)
		tmp = t_2;
	elseif (x <= 4.3e-81)
		tmp = Float64(log(t) - z);
	elseif (x <= 8.5e+137)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = log(y) * x;
	t_2 = -y - z;
	tmp = 0.0;
	if (x <= -1.2e+218)
		tmp = t_1;
	elseif (x <= -2.4e+177)
		tmp = t_2;
	elseif (x <= -7.2e+88)
		tmp = t_1;
	elseif (x <= -2.8e-301)
		tmp = t_2;
	elseif (x <= 4.3e-81)
		tmp = log(t) - z;
	elseif (x <= 8.5e+137)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[((-y) - z), $MachinePrecision]}, If[LessEqual[x, -1.2e+218], t$95$1, If[LessEqual[x, -2.4e+177], t$95$2, If[LessEqual[x, -7.2e+88], t$95$1, If[LessEqual[x, -2.8e-301], t$95$2, If[LessEqual[x, 4.3e-81], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 8.5e+137], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log y \cdot x\\
t_2 := \left(-y\right) - z\\
\mathbf{if}\;x \leq -1.2 \cdot 10^{+218}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -2.4 \cdot 10^{+177}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq -7.2 \cdot 10^{+88}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -2.8 \cdot 10^{-301}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;x \leq 8.5 \cdot 10^{+137}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.1999999999999999e218 or -2.4e177 < x < -7.2000000000000004e88 or 8.50000000000000028e137 < 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. sub-neg99.5%

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

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

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

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

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

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

    if -1.1999999999999999e218 < x < -2.4e177 or -7.2000000000000004e88 < x < -2.8000000000000001e-301 or 4.3000000000000003e-81 < x < 8.50000000000000028e137

    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. sub-neg99.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(y + z\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg79.4%

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

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

    if -2.8000000000000001e-301 < x < 4.3000000000000003e-81

    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. sub-neg100.0%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \left(-y\right) - \left(z - \log t\right)\right)} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\sqrt{\mathsf{fma}\left(\log y, x, y - z\right) + \log t}\right)}^{2}} \]
    6. Taylor expanded in x around 0 89.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.2 \cdot 10^{+218}:\\ \;\;\;\;\log y \cdot x\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{+177}:\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{+88}:\\ \;\;\;\;\log y \cdot x\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{-301}:\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{elif}\;x \leq 4.3 \cdot 10^{-81}:\\ \;\;\;\;\log t - z\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{+137}:\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{else}:\\ \;\;\;\;\log y \cdot x\\ \end{array} \]

Alternative 7: 83.0% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{+218} \lor \neg \left(x \leq -1.8 \cdot 10^{+175} \lor \neg \left(x \leq -9.6 \cdot 10^{+88}\right) \land x \leq 5.5 \cdot 10^{+138}\right):\\
\;\;\;\;\log y \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.1999999999999999e218 or -1.80000000000000017e175 < x < -9.5999999999999996e88 or 5.4999999999999999e138 < 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. sub-neg99.5%

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

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

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

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

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

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

    if -1.1999999999999999e218 < x < -1.80000000000000017e175 or -9.5999999999999996e88 < x < 5.4999999999999999e138

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.2 \cdot 10^{+218} \lor \neg \left(x \leq -1.8 \cdot 10^{+175} \lor \neg \left(x \leq -9.6 \cdot 10^{+88}\right) \land x \leq 5.5 \cdot 10^{+138}\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \end{array} \]

Alternative 8: 70.2% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.16 \cdot 10^{+218} \lor \neg \left(x \leq -2.4 \cdot 10^{+177}\right) \land \left(x \leq -7.4 \cdot 10^{+87} \lor \neg \left(x \leq 6.3 \cdot 10^{+128}\right)\right):\\
\;\;\;\;\log y \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.15999999999999994e218 or -2.4e177 < x < -7.40000000000000005e87 or 6.2999999999999999e128 < 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. sub-neg99.5%

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

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

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

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

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

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

    if -1.15999999999999994e218 < x < -2.4e177 or -7.40000000000000005e87 < x < 6.2999999999999999e128

    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. sub-neg99.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(y + z\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg77.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.16 \cdot 10^{+218} \lor \neg \left(x \leq -2.4 \cdot 10^{+177}\right) \land \left(x \leq -7.4 \cdot 10^{+87} \lor \neg \left(x \leq 6.3 \cdot 10^{+128}\right)\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(-y\right) - z\\ \end{array} \]

Alternative 9: 99.2% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.12 \lor \neg \left(x \leq 1.05\right):\\
\;\;\;\;\left(\log y \cdot x - y\right) - z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.1200000000000001 or 1.05000000000000004 < 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. sub-neg99.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot y - \log \left(\frac{1}{y}\right) \cdot x\right)} - z \]
      3. mul-1-neg98.7%

        \[\leadsto \left(\color{blue}{\left(-y\right)} - \log \left(\frac{1}{y}\right) \cdot x\right) - z \]
      4. log-rec99.5%

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

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

    if -1.1200000000000001 < x < 1.05000000000000004

    1. Initial program 100.0%

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

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

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

Alternative 10: 89.2% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+68} \lor \neg \left(x \leq 2.5 \cdot 10^{+128}\right):\\
\;\;\;\;\log y \cdot x - y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.10000000000000001e68 or 2.5e128 < 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. sub-neg99.5%

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

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

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

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

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

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

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

    if -2.10000000000000001e68 < x < 2.5e128

    1. Initial program 99.9%

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

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

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

Alternative 11: 88.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log y \cdot x\\ \mathbf{if}\;x \leq -6.2 \cdot 10^{+48}:\\ \;\;\;\;t_1 - z\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{+127}:\\ \;\;\;\;\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 (* (log y) x)))
   (if (<= x -6.2e+48)
     (- t_1 z)
     (if (<= x 4.6e+127) (- (log t) (+ y z)) (- t_1 y)))))
double code(double x, double y, double z, double t) {
	double t_1 = log(y) * x;
	double tmp;
	if (x <= -6.2e+48) {
		tmp = t_1 - z;
	} else if (x <= 4.6e+127) {
		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 = log(y) * x
    if (x <= (-6.2d+48)) then
        tmp = t_1 - z
    else if (x <= 4.6d+127) 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 = Math.log(y) * x;
	double tmp;
	if (x <= -6.2e+48) {
		tmp = t_1 - z;
	} else if (x <= 4.6e+127) {
		tmp = Math.log(t) - (y + z);
	} else {
		tmp = t_1 - y;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.log(y) * x
	tmp = 0
	if x <= -6.2e+48:
		tmp = t_1 - z
	elif x <= 4.6e+127:
		tmp = math.log(t) - (y + z)
	else:
		tmp = t_1 - y
	return tmp
function code(x, y, z, t)
	t_1 = Float64(log(y) * x)
	tmp = 0.0
	if (x <= -6.2e+48)
		tmp = Float64(t_1 - z);
	elseif (x <= 4.6e+127)
		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 = log(y) * x;
	tmp = 0.0;
	if (x <= -6.2e+48)
		tmp = t_1 - z;
	elseif (x <= 4.6e+127)
		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[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -6.2e+48], N[(t$95$1 - z), $MachinePrecision], If[LessEqual[x, 4.6e+127], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - y), $MachinePrecision]]]]
\begin{array}{l}

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

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

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


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

    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. sub-neg99.6%

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

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

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

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

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

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

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

    if -6.20000000000000011e48 < x < 4.6000000000000003e127

    1. Initial program 100.0%

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

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

    if 4.6000000000000003e127 < x

    1. Initial program 99.4%

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

        \[\leadsto \color{blue}{\left(x \cdot \log y - y\right) - \left(z - \log t\right)} \]
      2. sub-neg99.4%

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

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

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

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

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

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

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

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

Alternative 12: 44.8% accurate, 41.3× speedup?

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

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

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


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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \left(-y\right) - \left(z - \log t\right)\right)} \]
    4. Step-by-step derivation
      1. fma-udef99.8%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\sqrt{\mathsf{fma}\left(\log y, x, y - z\right) + \log t}\right)}^{2}} \]
    6. Taylor expanded in x around 0 59.1%

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

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

    if 2.6000000000000001e152 < y

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{-y} \]
    4. Simplified82.2%

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

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

Alternative 13: 44.9% accurate, 51.4× speedup?

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

    if 2.8999999999999998e152 < y

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{-y} \]
    4. Simplified82.2%

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

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

Alternative 14: 57.8% accurate, 52.3× speedup?

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

\\
\left(-y\right) - z
\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. sub-neg99.8%

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

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

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

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

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

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

    \[\leadsto \color{blue}{-1 \cdot \left(y + z\right)} \]
  6. Step-by-step derivation
    1. mul-1-neg62.5%

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

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

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

Alternative 15: 30.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. Taylor expanded in y around inf 28.0%

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

      \[\leadsto \color{blue}{-y} \]
  4. Simplified28.0%

    \[\leadsto \color{blue}{-y} \]
  5. Final simplification28.0%

    \[\leadsto -y \]

Reproduce

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