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

Percentage Accurate: 99.9% → 99.9%
Time: 11.4s
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(x, \log y, \left(-y\right) - z\right) + \log t \end{array} \]
(FPCore (x y z t) :precision binary64 (+ (fma x (log y) (- (- y) z)) (log t)))
double code(double x, double y, double z, double t) {
	return fma(x, log(y), (-y - z)) + log(t);
}
function code(x, y, z, t)
	return Float64(fma(x, log(y), Float64(Float64(-y) - z)) + log(t))
end
code[x_, y_, z_, t_] := N[(N[(x * N[Log[y], $MachinePrecision] + N[((-y) - z), $MachinePrecision]), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
  2. 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-def99.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. Final simplification99.9%

    \[\leadsto \mathsf{fma}\left(x, \log y, \left(-y\right) - z\right) + \log t \]
  6. Add Preprocessing

Alternative 2: 97.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \left(t\_1 - y\right) - z\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{+19} \lor \neg \left(t\_2 \leq 200000000\right):\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\log t + t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))) (t_2 (- (- t_1 y) z)))
   (if (or (<= t_2 -2e+19) (not (<= t_2 200000000.0))) t_2 (+ (log t) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double t_2 = (t_1 - y) - z;
	double tmp;
	if ((t_2 <= -2e+19) || !(t_2 <= 200000000.0)) {
		tmp = t_2;
	} else {
		tmp = log(t) + t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x * log(y)
    t_2 = (t_1 - y) - z
    if ((t_2 <= (-2d+19)) .or. (.not. (t_2 <= 200000000.0d0))) then
        tmp = t_2
    else
        tmp = log(t) + t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * Math.log(y);
	double t_2 = (t_1 - y) - z;
	double tmp;
	if ((t_2 <= -2e+19) || !(t_2 <= 200000000.0)) {
		tmp = t_2;
	} else {
		tmp = Math.log(t) + t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	t_2 = (t_1 - y) - z
	tmp = 0
	if (t_2 <= -2e+19) or not (t_2 <= 200000000.0):
		tmp = t_2
	else:
		tmp = math.log(t) + t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	t_2 = Float64(Float64(t_1 - y) - z)
	tmp = 0.0
	if ((t_2 <= -2e+19) || !(t_2 <= 200000000.0))
		tmp = t_2;
	else
		tmp = Float64(log(t) + t_1);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * log(y);
	t_2 = (t_1 - y) - z;
	tmp = 0.0;
	if ((t_2 <= -2e+19) || ~((t_2 <= 200000000.0)))
		tmp = t_2;
	else
		tmp = log(t) + t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 - y), $MachinePrecision] - z), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -2e+19], N[Not[LessEqual[t$95$2, 200000000.0]], $MachinePrecision]], t$95$2, N[(N[Log[t], $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \left(t\_1 - y\right) - z\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+19} \lor \neg \left(t\_2 \leq 200000000\right):\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) < -2e19 or 2e8 < (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z)

    1. Initial program 99.9%

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

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

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

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

    if -2e19 < (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) < 2e8

    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-def100.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 inf 94.2%

      \[\leadsto \color{blue}{x \cdot \log y} + \log t \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.0%

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

Alternative 3: 99.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
\mathbf{if}\;t\_1 \leq -500000 \lor \neg \left(t\_1 \leq 2 \cdot 10^{-18}\right):\\
\;\;\;\;t\_1 - z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 x (log.f64 y)) y) < -5e5 or 2.0000000000000001e-18 < (-.f64 (*.f64 x (log.f64 y)) 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)} \]
    3. Simplified99.9%

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

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

    if -5e5 < (-.f64 (*.f64 x (log.f64 y)) y) < 2.0000000000000001e-18

    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)} \]
    3. Simplified100.0%

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

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

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

Alternative 4: 87.8% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-18}:\\
\;\;\;\;\log t - \left(y + z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (*.f64 x (log.f64 y)) y) < -4.0000000000000002e251

    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)} \]
    3. Simplified99.9%

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

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

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

    if -4.0000000000000002e251 < (-.f64 (*.f64 x (log.f64 y)) y) < 2.0000000000000001e-18

    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)} \]
    3. Simplified100.0%

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

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

    if 2.0000000000000001e-18 < (-.f64 (*.f64 x (log.f64 y)) y)

    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)} \]
    3. Simplified99.7%

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

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

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

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

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

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

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

Alternative 6: 69.1% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \left(-y\right) - z\\ \mathbf{if}\;x \leq -1.02 \cdot 10^{+133}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -6.6 \cdot 10^{-106}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq -6.8 \cdot 10^{-153}:\\ \;\;\;\;\log t\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-218}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 10^{-191}:\\ \;\;\;\;\log t\\ \mathbf{elif}\;x \leq 2.05 \cdot 10^{+165}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))) (t_2 (- (- y) z)))
   (if (<= x -1.02e+133)
     t_1
     (if (<= x -6.6e-106)
       t_2
       (if (<= x -6.8e-153)
         (log t)
         (if (<= x 3e-218)
           t_2
           (if (<= x 1e-191) (log t) (if (<= x 2.05e+165) t_2 t_1))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double t_2 = -y - z;
	double tmp;
	if (x <= -1.02e+133) {
		tmp = t_1;
	} else if (x <= -6.6e-106) {
		tmp = t_2;
	} else if (x <= -6.8e-153) {
		tmp = log(t);
	} else if (x <= 3e-218) {
		tmp = t_2;
	} else if (x <= 1e-191) {
		tmp = log(t);
	} else if (x <= 2.05e+165) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x * log(y)
    t_2 = -y - z
    if (x <= (-1.02d+133)) then
        tmp = t_1
    else if (x <= (-6.6d-106)) then
        tmp = t_2
    else if (x <= (-6.8d-153)) then
        tmp = log(t)
    else if (x <= 3d-218) then
        tmp = t_2
    else if (x <= 1d-191) then
        tmp = log(t)
    else if (x <= 2.05d+165) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * Math.log(y);
	double t_2 = -y - z;
	double tmp;
	if (x <= -1.02e+133) {
		tmp = t_1;
	} else if (x <= -6.6e-106) {
		tmp = t_2;
	} else if (x <= -6.8e-153) {
		tmp = Math.log(t);
	} else if (x <= 3e-218) {
		tmp = t_2;
	} else if (x <= 1e-191) {
		tmp = Math.log(t);
	} else if (x <= 2.05e+165) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	t_2 = -y - z
	tmp = 0
	if x <= -1.02e+133:
		tmp = t_1
	elif x <= -6.6e-106:
		tmp = t_2
	elif x <= -6.8e-153:
		tmp = math.log(t)
	elif x <= 3e-218:
		tmp = t_2
	elif x <= 1e-191:
		tmp = math.log(t)
	elif x <= 2.05e+165:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	t_2 = Float64(Float64(-y) - z)
	tmp = 0.0
	if (x <= -1.02e+133)
		tmp = t_1;
	elseif (x <= -6.6e-106)
		tmp = t_2;
	elseif (x <= -6.8e-153)
		tmp = log(t);
	elseif (x <= 3e-218)
		tmp = t_2;
	elseif (x <= 1e-191)
		tmp = log(t);
	elseif (x <= 2.05e+165)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * log(y);
	t_2 = -y - z;
	tmp = 0.0;
	if (x <= -1.02e+133)
		tmp = t_1;
	elseif (x <= -6.6e-106)
		tmp = t_2;
	elseif (x <= -6.8e-153)
		tmp = log(t);
	elseif (x <= 3e-218)
		tmp = t_2;
	elseif (x <= 1e-191)
		tmp = log(t);
	elseif (x <= 2.05e+165)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-y) - z), $MachinePrecision]}, If[LessEqual[x, -1.02e+133], t$95$1, If[LessEqual[x, -6.6e-106], t$95$2, If[LessEqual[x, -6.8e-153], N[Log[t], $MachinePrecision], If[LessEqual[x, 3e-218], t$95$2, If[LessEqual[x, 1e-191], N[Log[t], $MachinePrecision], If[LessEqual[x, 2.05e+165], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -6.6 \cdot 10^{-106}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq -6.8 \cdot 10^{-153}:\\
\;\;\;\;\log t\\

\mathbf{elif}\;x \leq 3 \cdot 10^{-218}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 10^{-191}:\\
\;\;\;\;\log t\\

\mathbf{elif}\;x \leq 2.05 \cdot 10^{+165}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.02e133 or 2.0500000000000001e165 < 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)} \]
    3. Simplified99.7%

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

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

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

    if -1.02e133 < x < -6.60000000000000031e-106 or -6.7999999999999997e-153 < x < 2.9999999999999998e-218 or 1e-191 < x < 2.0500000000000001e165

    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)} \]
    3. Simplified99.9%

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

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

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

        \[\leadsto \color{blue}{-\left(y + z\right)} \]
      2. distribute-neg-in73.8%

        \[\leadsto \color{blue}{\left(-y\right) + \left(-z\right)} \]
      3. sub-neg73.8%

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

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

    if -6.60000000000000031e-106 < x < -6.7999999999999997e-153 or 2.9999999999999998e-218 < x < 1e-191

    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-def100.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 84.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.02 \cdot 10^{+133}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;x \leq -6.6 \cdot 10^{-106}:\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{elif}\;x \leq -6.8 \cdot 10^{-153}:\\ \;\;\;\;\log t\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-218}:\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{elif}\;x \leq 10^{-191}:\\ \;\;\;\;\log t\\ \mathbf{elif}\;x \leq 2.05 \cdot 10^{+165}:\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 67.1% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log t - y\\ t_2 := \left(-y\right) - z\\ t_3 := x \cdot \log y\\ \mathbf{if}\;z \leq -1.55 \cdot 10^{+31}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq -4.8 \cdot 10^{-69}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;z \leq -3.2 \cdot 10^{-231}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-269}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;z \leq 10^{-15}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 0.0035:\\ \;\;\;\;t\_3\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (log t) y)) (t_2 (- (- y) z)) (t_3 (* x (log y))))
   (if (<= z -1.55e+31)
     t_2
     (if (<= z -4.8e-69)
       t_3
       (if (<= z -3.2e-231)
         t_1
         (if (<= z -2.6e-269)
           t_3
           (if (<= z 1e-15) t_1 (if (<= z 0.0035) t_3 t_2))))))))
double code(double x, double y, double z, double t) {
	double t_1 = log(t) - y;
	double t_2 = -y - z;
	double t_3 = x * log(y);
	double tmp;
	if (z <= -1.55e+31) {
		tmp = t_2;
	} else if (z <= -4.8e-69) {
		tmp = t_3;
	} else if (z <= -3.2e-231) {
		tmp = t_1;
	} else if (z <= -2.6e-269) {
		tmp = t_3;
	} else if (z <= 1e-15) {
		tmp = t_1;
	} else if (z <= 0.0035) {
		tmp = t_3;
	} 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) :: t_3
    real(8) :: tmp
    t_1 = log(t) - y
    t_2 = -y - z
    t_3 = x * log(y)
    if (z <= (-1.55d+31)) then
        tmp = t_2
    else if (z <= (-4.8d-69)) then
        tmp = t_3
    else if (z <= (-3.2d-231)) then
        tmp = t_1
    else if (z <= (-2.6d-269)) then
        tmp = t_3
    else if (z <= 1d-15) then
        tmp = t_1
    else if (z <= 0.0035d0) then
        tmp = t_3
    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 = Math.log(t) - y;
	double t_2 = -y - z;
	double t_3 = x * Math.log(y);
	double tmp;
	if (z <= -1.55e+31) {
		tmp = t_2;
	} else if (z <= -4.8e-69) {
		tmp = t_3;
	} else if (z <= -3.2e-231) {
		tmp = t_1;
	} else if (z <= -2.6e-269) {
		tmp = t_3;
	} else if (z <= 1e-15) {
		tmp = t_1;
	} else if (z <= 0.0035) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.log(t) - y
	t_2 = -y - z
	t_3 = x * math.log(y)
	tmp = 0
	if z <= -1.55e+31:
		tmp = t_2
	elif z <= -4.8e-69:
		tmp = t_3
	elif z <= -3.2e-231:
		tmp = t_1
	elif z <= -2.6e-269:
		tmp = t_3
	elif z <= 1e-15:
		tmp = t_1
	elif z <= 0.0035:
		tmp = t_3
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(log(t) - y)
	t_2 = Float64(Float64(-y) - z)
	t_3 = Float64(x * log(y))
	tmp = 0.0
	if (z <= -1.55e+31)
		tmp = t_2;
	elseif (z <= -4.8e-69)
		tmp = t_3;
	elseif (z <= -3.2e-231)
		tmp = t_1;
	elseif (z <= -2.6e-269)
		tmp = t_3;
	elseif (z <= 1e-15)
		tmp = t_1;
	elseif (z <= 0.0035)
		tmp = t_3;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = log(t) - y;
	t_2 = -y - z;
	t_3 = x * log(y);
	tmp = 0.0;
	if (z <= -1.55e+31)
		tmp = t_2;
	elseif (z <= -4.8e-69)
		tmp = t_3;
	elseif (z <= -3.2e-231)
		tmp = t_1;
	elseif (z <= -2.6e-269)
		tmp = t_3;
	elseif (z <= 1e-15)
		tmp = t_1;
	elseif (z <= 0.0035)
		tmp = t_3;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[((-y) - z), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.55e+31], t$95$2, If[LessEqual[z, -4.8e-69], t$95$3, If[LessEqual[z, -3.2e-231], t$95$1, If[LessEqual[z, -2.6e-269], t$95$3, If[LessEqual[z, 1e-15], t$95$1, If[LessEqual[z, 0.0035], t$95$3, t$95$2]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log t - y\\
t_2 := \left(-y\right) - z\\
t_3 := x \cdot \log y\\
\mathbf{if}\;z \leq -1.55 \cdot 10^{+31}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq -4.8 \cdot 10^{-69}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;z \leq -3.2 \cdot 10^{-231}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -2.6 \cdot 10^{-269}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;z \leq 10^{-15}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 0.0035:\\
\;\;\;\;t\_3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.5500000000000001e31 or 0.00350000000000000007 < z

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto \color{blue}{-\left(y + z\right)} \]
      2. distribute-neg-in85.8%

        \[\leadsto \color{blue}{\left(-y\right) + \left(-z\right)} \]
      3. sub-neg85.8%

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

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

    if -1.5500000000000001e31 < z < -4.8000000000000002e-69 or -3.20000000000000008e-231 < z < -2.6e-269 or 1.0000000000000001e-15 < z < 0.00350000000000000007

    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)} \]
    3. Simplified99.7%

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

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

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

    if -4.8000000000000002e-69 < z < -3.20000000000000008e-231 or -2.6e-269 < z < 1.0000000000000001e-15

    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-def99.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 72.7%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.55 \cdot 10^{+31}:\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{elif}\;z \leq -4.8 \cdot 10^{-69}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;z \leq -3.2 \cdot 10^{-231}:\\ \;\;\;\;\log t - y\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-269}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;z \leq 10^{-15}:\\ \;\;\;\;\log t - y\\ \mathbf{elif}\;z \leq 0.0035:\\ \;\;\;\;x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;\left(-y\right) - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 67.8% accurate, 1.8× speedup?

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

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

\mathbf{elif}\;y \leq 1.02 \cdot 10^{-22}:\\
\;\;\;\;\log t - z\\

\mathbf{elif}\;y \leq 410000000:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.40000000000000004e-278 or 1.02000000000000002e-22 < y < 4.1e8

    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)} \]
    3. Simplified99.6%

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

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

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

    if 1.40000000000000004e-278 < y < 1.02000000000000002e-22

    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)} \]
    3. Simplified99.9%

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

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

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

    if 4.1e8 < 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)} \]
    3. Simplified99.9%

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

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

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

        \[\leadsto \color{blue}{-\left(y + z\right)} \]
      2. distribute-neg-in81.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.4 \cdot 10^{-278}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{-22}:\\ \;\;\;\;\log t - z\\ \mathbf{elif}\;y \leq 410000000:\\ \;\;\;\;x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;\left(-y\right) - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 84.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+133} \lor \neg \left(x \leq 1.9 \cdot 10^{+165}\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 -1.4e+133) (not (<= x 1.9e+165)))
   (* x (log y))
   (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -1.4e+133) || !(x <= 1.9e+165)) {
		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 <= (-1.4d+133)) .or. (.not. (x <= 1.9d+165))) 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 <= -1.4e+133) || !(x <= 1.9e+165)) {
		tmp = x * Math.log(y);
	} else {
		tmp = Math.log(t) - (y + z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -1.4e+133) or not (x <= 1.9e+165):
		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 <= -1.4e+133) || !(x <= 1.9e+165))
		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 <= -1.4e+133) || ~((x <= 1.9e+165)))
		tmp = x * log(y);
	else
		tmp = log(t) - (y + z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.4e+133], N[Not[LessEqual[x, 1.9e+165]], $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 -1.4 \cdot 10^{+133} \lor \neg \left(x \leq 1.9 \cdot 10^{+165}\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 < -1.40000000000000008e133 or 1.89999999999999995e165 < 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)} \]
    3. Simplified99.7%

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

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

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

    if -1.40000000000000008e133 < x < 1.89999999999999995e165

    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)} \]
    3. Simplified99.9%

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

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

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

Alternative 10: 89.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+105} \lor \neg \left(x \leq 3 \cdot 10^{+80}\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 -4.5e+105) (not (<= x 3e+80)))
   (- (* x (log y)) y)
   (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -4.5e+105) || !(x <= 3e+80)) {
		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 <= (-4.5d+105)) .or. (.not. (x <= 3d+80))) 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 <= -4.5e+105) || !(x <= 3e+80)) {
		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 <= -4.5e+105) or not (x <= 3e+80):
		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 <= -4.5e+105) || !(x <= 3e+80))
		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 <= -4.5e+105) || ~((x <= 3e+80)))
		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, -4.5e+105], N[Not[LessEqual[x, 3e+80]], $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 -4.5 \cdot 10^{+105} \lor \neg \left(x \leq 3 \cdot 10^{+80}\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 < -4.5000000000000001e105 or 2.99999999999999987e80 < 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)} \]
    3. Simplified99.7%

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

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

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

    if -4.5000000000000001e105 < x < 2.99999999999999987e80

    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)} \]
    3. Simplified100.0%

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

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

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

Alternative 11: 56.2% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{-280} \lor \neg \left(z \leq 2.8 \cdot 10^{-124}\right):\\
\;\;\;\;\left(-y\right) - z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 7.0000000000000002e-280 or 2.79999999999999998e-124 < z

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto \color{blue}{-\left(y + z\right)} \]
      2. distribute-neg-in63.6%

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

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

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

    if 7.0000000000000002e-280 < z < 2.79999999999999998e-124

    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-def99.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 64.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 7 \cdot 10^{-280} \lor \neg \left(z \leq 2.8 \cdot 10^{-124}\right):\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{else}:\\ \;\;\;\;\log t\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 48.5% accurate, 29.8× speedup?

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

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

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


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

    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)} \]
    3. Simplified99.9%

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

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

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

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

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

    if 2.1999999999999999e79 < 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)} \]
    3. Simplified99.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.2 \cdot 10^{+79}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 58.0% 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.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)} \]
  3. Simplified99.9%

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

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

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

      \[\leadsto \color{blue}{-\left(y + z\right)} \]
    2. distribute-neg-in59.1%

      \[\leadsto \color{blue}{\left(-y\right) + \left(-z\right)} \]
    3. sub-neg59.1%

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

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

    \[\leadsto \left(-y\right) - z \]
  10. Add Preprocessing

Alternative 14: 30.3% accurate, 104.5× speedup?

\[\begin{array}{l} \\ -y \end{array} \]
(FPCore (x y z t) :precision binary64 (- y))
double code(double x, double y, double z, double t) {
	return -y;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = -y
end function
public static double code(double x, double y, double z, double t) {
	return -y;
}
def code(x, y, z, t):
	return -y
function code(x, y, z, t)
	return Float64(-y)
end
function tmp = code(x, y, z, t)
	tmp = -y;
end
code[x_, y_, z_, t_] := (-y)
\begin{array}{l}

\\
-y
\end{array}
Derivation
  1. Initial program 99.9%

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

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

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

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

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

      \[\leadsto \color{blue}{-y} \]
  8. Simplified31.3%

    \[\leadsto \color{blue}{-y} \]
  9. Final simplification31.3%

    \[\leadsto -y \]
  10. Add Preprocessing

Alternative 15: 2.2% accurate, 209.0× speedup?

\[\begin{array}{l} \\ y \end{array} \]
(FPCore (x y z t) :precision binary64 y)
double code(double x, double y, double z, double t) {
	return y;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = y
end function
public static double code(double x, double y, double z, double t) {
	return y;
}
def code(x, y, z, t):
	return y
function code(x, y, z, t)
	return y
end
function tmp = code(x, y, z, t)
	tmp = y;
end
code[x_, y_, z_, t_] := y
\begin{array}{l}

\\
y
\end{array}
Derivation
  1. Initial program 99.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)} \]
  3. Simplified99.9%

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

    \[\leadsto \left(x \cdot \log y - y\right) - \color{blue}{z} \]
  6. Step-by-step derivation
    1. associate--l-85.7%

      \[\leadsto \color{blue}{x \cdot \log y - \left(y + z\right)} \]
    2. sub-neg85.7%

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

      \[\leadsto x \cdot \log y + \color{blue}{\left(\left(-y\right) + \left(-z\right)\right)} \]
    4. add-sqr-sqrt0.0%

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

      \[\leadsto x \cdot \log y + \left(\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}} + \left(-z\right)\right) \]
    6. sqr-neg49.6%

      \[\leadsto x \cdot \log y + \left(\sqrt{\color{blue}{y \cdot y}} + \left(-z\right)\right) \]
    7. sqrt-unprod55.1%

      \[\leadsto x \cdot \log y + \left(\color{blue}{\sqrt{y} \cdot \sqrt{y}} + \left(-z\right)\right) \]
    8. add-sqr-sqrt55.1%

      \[\leadsto x \cdot \log y + \left(\color{blue}{y} + \left(-z\right)\right) \]
    9. sub-neg55.1%

      \[\leadsto x \cdot \log y + \color{blue}{\left(y - z\right)} \]
    10. flip-+19.7%

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

      \[\leadsto \frac{\color{blue}{{\left(x \cdot \log y\right)}^{2}} - \left(y - z\right) \cdot \left(y - z\right)}{x \cdot \log y - \left(y - z\right)} \]
    12. unpow219.7%

      \[\leadsto \frac{{\left(x \cdot \log y\right)}^{2} - \color{blue}{{\left(y - z\right)}^{2}}}{x \cdot \log y - \left(y - z\right)} \]
    13. add-sqr-sqrt11.0%

      \[\leadsto \color{blue}{\sqrt{\frac{{\left(x \cdot \log y\right)}^{2} - {\left(y - z\right)}^{2}}{x \cdot \log y - \left(y - z\right)}} \cdot \sqrt{\frac{{\left(x \cdot \log y\right)}^{2} - {\left(y - z\right)}^{2}}{x \cdot \log y - \left(y - z\right)}}} \]
    14. pow211.0%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{{\left(x \cdot \log y\right)}^{2} - {\left(y - z\right)}^{2}}{x \cdot \log y - \left(y - z\right)}}\right)}^{2}} \]
  7. Applied egg-rr30.1%

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

      \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(x, \log y, y - z\right)} \cdot \sqrt{\mathsf{fma}\left(x, \log y, y - z\right)}} \]
    2. add-sqr-sqrt55.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \log y, y - z\right)} \]
    3. fma-udef55.1%

      \[\leadsto \color{blue}{x \cdot \log y + \left(y - z\right)} \]
    4. add-sqr-sqrt21.1%

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

      \[\leadsto \color{blue}{\left(x \cdot \sqrt{\log y}\right) \cdot \sqrt{\log y}} + \left(y - z\right) \]
    6. fma-def21.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot \sqrt{\log y}, \sqrt{\log y}, y - z\right)} \]
  9. Applied egg-rr21.1%

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

    \[\leadsto \color{blue}{y} \]
  11. Final simplification2.2%

    \[\leadsto y \]
  12. Add Preprocessing

Reproduce

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