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

Percentage Accurate: 99.9% → 99.9%
Time: 10.4s
Alternatives: 11
Speedup: 1.0×

Specification

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

\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}

Alternative 1: 99.9% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 84.0% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+35}:\\
\;\;\;\;\log t - z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (*.f64 x (log.f64 y)) y) < -9.99999999999999952e73 or 1.9999999999999999e35 < (-.f64 (*.f64 x (log.f64 y)) y)

    1. Initial program 99.8%

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

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

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

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

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

    if -9.99999999999999952e73 < (-.f64 (*.f64 x (log.f64 y)) y) < -1.9999999999999998e23

    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. +-commutative100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-z\right)} - y \]
    7. Simplified87.2%

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

    if -1.9999999999999998e23 < (-.f64 (*.f64 x (log.f64 y)) y) < 1.9999999999999999e35

    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. +-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    6. Step-by-step derivation
      1. +-commutative93.9%

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

        \[\leadsto \color{blue}{\left(\log t - z\right) - y} \]
    7. Simplified93.9%

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

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

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

Alternative 3: 98.2% 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 -2000000000 \lor \neg \left(t\_2 \leq 10^{-55}\right):\\ \;\;\;\;t\_1 - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\log t - z\right) - y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))) (t_2 (- t_1 y)))
   (if (or (<= t_2 -2000000000.0) (not (<= t_2 1e-55)))
     (- t_1 (+ y z))
     (- (- (log t) z) y))))
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 <= -2000000000.0) || !(t_2 <= 1e-55)) {
		tmp = t_1 - (y + z);
	} else {
		tmp = (log(t) - z) - 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) :: t_2
    real(8) :: tmp
    t_1 = x * log(y)
    t_2 = t_1 - y
    if ((t_2 <= (-2000000000.0d0)) .or. (.not. (t_2 <= 1d-55))) then
        tmp = t_1 - (y + z)
    else
        tmp = (log(t) - z) - y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * Math.log(y);
	double t_2 = t_1 - y;
	double tmp;
	if ((t_2 <= -2000000000.0) || !(t_2 <= 1e-55)) {
		tmp = t_1 - (y + z);
	} else {
		tmp = (Math.log(t) - z) - y;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	t_2 = t_1 - y
	tmp = 0
	if (t_2 <= -2000000000.0) or not (t_2 <= 1e-55):
		tmp = t_1 - (y + z)
	else:
		tmp = (math.log(t) - z) - y
	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 <= -2000000000.0) || !(t_2 <= 1e-55))
		tmp = Float64(t_1 - Float64(y + z));
	else
		tmp = Float64(Float64(log(t) - z) - y);
	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 <= -2000000000.0) || ~((t_2 <= 1e-55)))
		tmp = t_1 - (y + z);
	else
		tmp = (log(t) - z) - y;
	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[Or[LessEqual[t$95$2, -2000000000.0], N[Not[LessEqual[t$95$2, 1e-55]], $MachinePrecision]], N[(t$95$1 - N[(y + z), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]]]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 x (log.f64 y)) y) < -2e9 or 9.99999999999999995e-56 < (-.f64 (*.f64 x (log.f64 y)) y)

    1. Initial program 99.8%

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

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

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

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

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

    if -2e9 < (-.f64 (*.f64 x (log.f64 y)) y) < 9.99999999999999995e-56

    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. +-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    6. Step-by-step derivation
      1. +-commutative98.9%

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

        \[\leadsto \color{blue}{\left(\log t - z\right) - y} \]
    7. Simplified98.9%

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

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

Alternative 4: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 5: 69.9% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \left(-z\right) - y\\ \mathbf{if}\;x \leq -7.2 \cdot 10^{+121}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{-276}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{-180}:\\ \;\;\;\;\log t - y\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{+69}:\\ \;\;\;\;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 (- (- z) y)))
   (if (<= x -7.2e+121)
     t_1
     (if (<= x 1.45e-276)
       t_2
       (if (<= x 1.1e-180) (- (log t) y) (if (<= x 1.35e+69) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double t_2 = -z - y;
	double tmp;
	if (x <= -7.2e+121) {
		tmp = t_1;
	} else if (x <= 1.45e-276) {
		tmp = t_2;
	} else if (x <= 1.1e-180) {
		tmp = log(t) - y;
	} else if (x <= 1.35e+69) {
		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 = -z - y
    if (x <= (-7.2d+121)) then
        tmp = t_1
    else if (x <= 1.45d-276) then
        tmp = t_2
    else if (x <= 1.1d-180) then
        tmp = log(t) - y
    else if (x <= 1.35d+69) 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 = -z - y;
	double tmp;
	if (x <= -7.2e+121) {
		tmp = t_1;
	} else if (x <= 1.45e-276) {
		tmp = t_2;
	} else if (x <= 1.1e-180) {
		tmp = Math.log(t) - y;
	} else if (x <= 1.35e+69) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	t_2 = -z - y
	tmp = 0
	if x <= -7.2e+121:
		tmp = t_1
	elif x <= 1.45e-276:
		tmp = t_2
	elif x <= 1.1e-180:
		tmp = math.log(t) - y
	elif x <= 1.35e+69:
		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(-z) - y)
	tmp = 0.0
	if (x <= -7.2e+121)
		tmp = t_1;
	elseif (x <= 1.45e-276)
		tmp = t_2;
	elseif (x <= 1.1e-180)
		tmp = Float64(log(t) - y);
	elseif (x <= 1.35e+69)
		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 = -z - y;
	tmp = 0.0;
	if (x <= -7.2e+121)
		tmp = t_1;
	elseif (x <= 1.45e-276)
		tmp = t_2;
	elseif (x <= 1.1e-180)
		tmp = log(t) - y;
	elseif (x <= 1.35e+69)
		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[((-z) - y), $MachinePrecision]}, If[LessEqual[x, -7.2e+121], t$95$1, If[LessEqual[x, 1.45e-276], t$95$2, If[LessEqual[x, 1.1e-180], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, 1.35e+69], t$95$2, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.45 \cdot 10^{-276}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;x \leq 1.35 \cdot 10^{+69}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -7.19999999999999963e121 or 1.3499999999999999e69 < x

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
      13. unsub-neg99.7%

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

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

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

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(-1 + \left(-1 \cdot \frac{x \cdot \log \left(\frac{1}{y}\right)}{y} + \frac{\log t}{y}\right)\right)} \]
      4. associate-*r/62.0%

        \[\leadsto y \cdot \left(-1 + \left(\color{blue}{\frac{-1 \cdot \left(x \cdot \log \left(\frac{1}{y}\right)\right)}{y}} + \frac{\log t}{y}\right)\right) \]
      5. mul-1-neg62.0%

        \[\leadsto y \cdot \left(-1 + \left(\frac{\color{blue}{-x \cdot \log \left(\frac{1}{y}\right)}}{y} + \frac{\log t}{y}\right)\right) \]
      6. distribute-rgt-neg-in62.0%

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

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

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

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

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

    if -7.19999999999999963e121 < x < 1.44999999999999994e-276 or 1.10000000000000007e-180 < x < 1.3499999999999999e69

    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. +-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-z\right)} - y \]
    7. Simplified75.9%

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

    if 1.44999999999999994e-276 < x < 1.10000000000000007e-180

    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. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.2 \cdot 10^{+121}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{-276}:\\ \;\;\;\;\left(-z\right) - y\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{-180}:\\ \;\;\;\;\log t - y\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{+69}:\\ \;\;\;\;\left(-z\right) - y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 89.3% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+36} \lor \neg \left(x \leq 6 \cdot 10^{+67}\right):\\
\;\;\;\;x \cdot \log y - y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.8000000000000001e36 or 6.0000000000000002e67 < x

    1. Initial program 99.7%

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

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

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

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

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

    if -2.8000000000000001e36 < x < 6.0000000000000002e67

    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. +-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    6. Step-by-step derivation
      1. +-commutative95.2%

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

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

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

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

Alternative 7: 70.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{+119} \lor \neg \left(x \leq 4.2 \cdot 10^{+69}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.0000000000000001e119 or 4.2000000000000003e69 < x

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
      13. unsub-neg99.7%

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

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

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

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(-1 + \left(-1 \cdot \frac{x \cdot \log \left(\frac{1}{y}\right)}{y} + \frac{\log t}{y}\right)\right)} \]
      4. associate-*r/62.0%

        \[\leadsto y \cdot \left(-1 + \left(\color{blue}{\frac{-1 \cdot \left(x \cdot \log \left(\frac{1}{y}\right)\right)}{y}} + \frac{\log t}{y}\right)\right) \]
      5. mul-1-neg62.0%

        \[\leadsto y \cdot \left(-1 + \left(\frac{\color{blue}{-x \cdot \log \left(\frac{1}{y}\right)}}{y} + \frac{\log t}{y}\right)\right) \]
      6. distribute-rgt-neg-in62.0%

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

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

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

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

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

    if -7.0000000000000001e119 < x < 4.2000000000000003e69

    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. +-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 69.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.3 \cdot 10^{+19}:\\
\;\;\;\;\log t - z\\

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


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

    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. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.3e19 < 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. +-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 48.9% accurate, 29.8× speedup?

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

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

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


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

    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. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    6. Step-by-step derivation
      1. +-commutative67.3%

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

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

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

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

        \[\leadsto \color{blue}{-z} \]
    10. Simplified42.6%

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

    if 3.1000000000000001e60 < 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. +-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-y} \]
    7. Simplified63.8%

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

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

Alternative 10: 58.0% accurate, 52.3× speedup?

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

\\
\left(-z\right) - y
\end{array}
Derivation
  1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 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.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. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-y} \]
  7. Simplified28.5%

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

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

Reproduce

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