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

Percentage Accurate: 99.9% → 99.9%
Time: 7.4s
Alternatives: 8
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 8 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 2: 89.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{+18} \lor \neg \left(z \leq 3.7 \cdot 10^{+39}\right):\\
\;\;\;\;\left(-z\right) - y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.12e18 or 3.70000000000000012e39 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
      10. 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. Taylor expanded in z around inf 84.4%

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

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

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

    if -1.12e18 < z < 3.70000000000000012e39

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
      10. 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. Taylor expanded in z around 0 99.2%

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

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

Alternative 3: 89.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+16}:\\
\;\;\;\;0.3333333333333333 \cdot \left(\left(x \cdot \log y\right) \cdot 3\right) - y\\

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

\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \left(\left(x \cdot -3\right) \cdot \left(-\log y\right)\right) - y\\


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
      10. 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. Taylor expanded in z around 0 87.6%

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

        \[\leadsto \left(\log t + \color{blue}{\log \left({y}^{x}\right)}\right) - y \]
      2. log-prod9.0%

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

      \[\leadsto \color{blue}{\log \left(t \cdot {y}^{x}\right)} - y \]
    7. Step-by-step derivation
      1. add-cbrt-cube9.0%

        \[\leadsto \log \color{blue}{\left(\sqrt[3]{\left(\left(t \cdot {y}^{x}\right) \cdot \left(t \cdot {y}^{x}\right)\right) \cdot \left(t \cdot {y}^{x}\right)}\right)} - y \]
      2. pow1/39.0%

        \[\leadsto \log \color{blue}{\left({\left(\left(\left(t \cdot {y}^{x}\right) \cdot \left(t \cdot {y}^{x}\right)\right) \cdot \left(t \cdot {y}^{x}\right)\right)}^{0.3333333333333333}\right)} - y \]
      3. log-pow9.0%

        \[\leadsto \color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(t \cdot {y}^{x}\right) \cdot \left(t \cdot {y}^{x}\right)\right) \cdot \left(t \cdot {y}^{x}\right)\right)} - y \]
      4. pow39.0%

        \[\leadsto 0.3333333333333333 \cdot \log \color{blue}{\left({\left(t \cdot {y}^{x}\right)}^{3}\right)} - y \]
      5. log-pow9.0%

        \[\leadsto 0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(t \cdot {y}^{x}\right)\right)} - y \]
      6. log-prod9.0%

        \[\leadsto 0.3333333333333333 \cdot \left(3 \cdot \color{blue}{\left(\log t + \log \left({y}^{x}\right)\right)}\right) - y \]
      7. log-pow87.4%

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

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

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

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \left(3 \cdot \mathsf{fma}\left(x, \log y, \log t\right)\right)} - y \]
    9. Taylor expanded in x around inf 87.4%

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

    if -1.4e16 < x < 1.40000000000000006e75

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
      10. 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. Taylor expanded in x around 0 96.1%

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

    if 1.40000000000000006e75 < x

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
      10. 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. Taylor expanded in z around 0 81.5%

      \[\leadsto \color{blue}{\left(\log t + x \cdot \log y\right)} - y \]
    5. Step-by-step derivation
      1. log-pow10.5%

        \[\leadsto \left(\log t + \color{blue}{\log \left({y}^{x}\right)}\right) - y \]
      2. log-prod10.5%

        \[\leadsto \color{blue}{\log \left(t \cdot {y}^{x}\right)} - y \]
    6. Simplified10.5%

      \[\leadsto \color{blue}{\log \left(t \cdot {y}^{x}\right)} - y \]
    7. Step-by-step derivation
      1. add-cbrt-cube10.5%

        \[\leadsto \log \color{blue}{\left(\sqrt[3]{\left(\left(t \cdot {y}^{x}\right) \cdot \left(t \cdot {y}^{x}\right)\right) \cdot \left(t \cdot {y}^{x}\right)}\right)} - y \]
      2. pow1/310.5%

        \[\leadsto \log \color{blue}{\left({\left(\left(\left(t \cdot {y}^{x}\right) \cdot \left(t \cdot {y}^{x}\right)\right) \cdot \left(t \cdot {y}^{x}\right)\right)}^{0.3333333333333333}\right)} - y \]
      3. log-pow10.5%

        \[\leadsto \color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(t \cdot {y}^{x}\right) \cdot \left(t \cdot {y}^{x}\right)\right) \cdot \left(t \cdot {y}^{x}\right)\right)} - y \]
      4. pow310.5%

        \[\leadsto 0.3333333333333333 \cdot \log \color{blue}{\left({\left(t \cdot {y}^{x}\right)}^{3}\right)} - y \]
      5. log-pow10.5%

        \[\leadsto 0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(t \cdot {y}^{x}\right)\right)} - y \]
      6. log-prod10.5%

        \[\leadsto 0.3333333333333333 \cdot \left(3 \cdot \color{blue}{\left(\log t + \log \left({y}^{x}\right)\right)}\right) - y \]
      7. log-pow81.4%

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

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

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

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \left(3 \cdot \mathsf{fma}\left(x, \log y, \log t\right)\right)} - y \]
    9. Taylor expanded in x around inf 81.4%

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

      \[\leadsto 0.3333333333333333 \cdot \color{blue}{\left(-3 \cdot \left(x \cdot \log \left(\frac{1}{y}\right)\right)\right)} - y \]
    11. Step-by-step derivation
      1. associate-*r*81.4%

        \[\leadsto 0.3333333333333333 \cdot \color{blue}{\left(\left(-3 \cdot x\right) \cdot \log \left(\frac{1}{y}\right)\right)} - y \]
      2. log-rec81.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\left(-3 \cdot x\right) \cdot \color{blue}{\left(-\log y\right)}\right) - y \]
    12. Simplified81.4%

      \[\leadsto 0.3333333333333333 \cdot \color{blue}{\left(\left(-3 \cdot x\right) \cdot \left(-\log y\right)\right)} - y \]
  3. Recombined 3 regimes into one program.
  4. Final simplification91.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+16}:\\ \;\;\;\;0.3333333333333333 \cdot \left(\left(x \cdot \log y\right) \cdot 3\right) - y\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+75}:\\ \;\;\;\;\left(\log t - z\right) - y\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \left(\left(x \cdot -3\right) \cdot \left(-\log y\right)\right) - y\\ \end{array} \]

Alternative 4: 89.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+17} \lor \neg \left(x \leq 1.2 \cdot 10^{+74}\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(\left(x \cdot \log y\right) \cdot 3\right) - y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.2e17 or 1.20000000000000004e74 < x

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
      10. 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. Taylor expanded in z around 0 85.6%

      \[\leadsto \color{blue}{\left(\log t + x \cdot \log y\right)} - y \]
    5. Step-by-step derivation
      1. log-pow9.5%

        \[\leadsto \left(\log t + \color{blue}{\log \left({y}^{x}\right)}\right) - y \]
      2. log-prod9.5%

        \[\leadsto \color{blue}{\log \left(t \cdot {y}^{x}\right)} - y \]
    6. Simplified9.5%

      \[\leadsto \color{blue}{\log \left(t \cdot {y}^{x}\right)} - y \]
    7. Step-by-step derivation
      1. add-cbrt-cube9.5%

        \[\leadsto \log \color{blue}{\left(\sqrt[3]{\left(\left(t \cdot {y}^{x}\right) \cdot \left(t \cdot {y}^{x}\right)\right) \cdot \left(t \cdot {y}^{x}\right)}\right)} - y \]
      2. pow1/39.5%

        \[\leadsto \log \color{blue}{\left({\left(\left(\left(t \cdot {y}^{x}\right) \cdot \left(t \cdot {y}^{x}\right)\right) \cdot \left(t \cdot {y}^{x}\right)\right)}^{0.3333333333333333}\right)} - y \]
      3. log-pow9.5%

        \[\leadsto \color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(t \cdot {y}^{x}\right) \cdot \left(t \cdot {y}^{x}\right)\right) \cdot \left(t \cdot {y}^{x}\right)\right)} - y \]
      4. pow39.5%

        \[\leadsto 0.3333333333333333 \cdot \log \color{blue}{\left({\left(t \cdot {y}^{x}\right)}^{3}\right)} - y \]
      5. log-pow9.5%

        \[\leadsto 0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(t \cdot {y}^{x}\right)\right)} - y \]
      6. log-prod9.5%

        \[\leadsto 0.3333333333333333 \cdot \left(3 \cdot \color{blue}{\left(\log t + \log \left({y}^{x}\right)\right)}\right) - y \]
      7. log-pow85.5%

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

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

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

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \left(3 \cdot \mathsf{fma}\left(x, \log y, \log t\right)\right)} - y \]
    9. Taylor expanded in x around inf 85.5%

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

    if -7.2e17 < x < 1.20000000000000004e74

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
      10. 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. Taylor expanded in x around 0 96.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.2 \cdot 10^{+17} \lor \neg \left(x \leq 1.2 \cdot 10^{+74}\right):\\ \;\;\;\;0.3333333333333333 \cdot \left(\left(x \cdot \log y\right) \cdot 3\right) - y\\ \mathbf{else}:\\ \;\;\;\;\left(\log t - z\right) - y\\ \end{array} \]

Alternative 5: 69.5% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2100000 \lor \neg \left(z \leq 2000000000\right):\\
\;\;\;\;\left(-z\right) - y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.1e6 or 2e9 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
      10. 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. Taylor expanded in z around inf 82.6%

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

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

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

    if -2.1e6 < z < 2e9

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
      10. 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. Taylor expanded in z around 0 99.6%

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

        \[\leadsto \left(\log t + \color{blue}{\log \left({y}^{x}\right)}\right) - y \]
      2. log-prod54.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2100000 \lor \neg \left(z \leq 2000000000\right):\\ \;\;\;\;\left(-z\right) - y\\ \mathbf{else}:\\ \;\;\;\;\log t - y\\ \end{array} \]

Alternative 6: 70.2% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
    10. 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. Taylor expanded in x around 0 70.1%

    \[\leadsto \color{blue}{\left(\log t - z\right)} - y \]
  5. Final simplification70.1%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
    10. 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. Taylor expanded in z around inf 55.5%

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

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

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

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

Alternative 8: 29.6% 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)} \]
    2. associate--l-99.9%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{\log t + \left(-z\right)}\right) - y \]
    10. 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. Taylor expanded in z around 0 73.0%

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

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

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

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

    \[\leadsto \color{blue}{\log t} - y \]
  8. Taylor expanded in y around inf 29.7%

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

      \[\leadsto \color{blue}{-y} \]
  10. Simplified29.7%

    \[\leadsto \color{blue}{-y} \]
  11. Final simplification29.7%

    \[\leadsto -y \]

Reproduce

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