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

Percentage Accurate: 99.9% → 99.9%
Time: 11.2s
Alternatives: 12
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.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 - y\right) + \left(-\left(z - \log t\right)\right)} \]
    3. sub-neg99.8%

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

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

      \[\leadsto \color{blue}{\left(-y\right) + \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-udef99.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. Final simplification99.8%

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

Alternative 2: 98.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \left(t\_1 - y\right) - z\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+18}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, -y\right) - z\\ \mathbf{elif}\;t\_2 \leq 10^{+16}:\\ \;\;\;\;\left(\log t + t\_1\right) - y\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))) (t_2 (- (- t_1 y) z)))
   (if (<= t_2 -1e+18)
     (- (fma (log y) x (- y)) z)
     (if (<= t_2 1e+16) (- (+ (log t) t_1) y) t_2))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double t_2 = (t_1 - y) - z;
	double tmp;
	if (t_2 <= -1e+18) {
		tmp = fma(log(y), x, -y) - z;
	} else if (t_2 <= 1e+16) {
		tmp = (log(t) + t_1) - y;
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	t_2 = Float64(Float64(t_1 - y) - z)
	tmp = 0.0
	if (t_2 <= -1e+18)
		tmp = Float64(fma(log(y), x, Float64(-y)) - z);
	elseif (t_2 <= 1e+16)
		tmp = Float64(Float64(log(t) + t_1) - y);
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 - y), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+18], N[(N[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[t$95$2, 1e+16], N[(N[(N[Log[t], $MachinePrecision] + t$95$1), $MachinePrecision] - y), $MachinePrecision], t$95$2]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \left(t\_1 - y\right) - z\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -y\right) - z\\

\mathbf{elif}\;t\_2 \leq 10^{+16}:\\
\;\;\;\;\left(\log t + t\_1\right) - y\\

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


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

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

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

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

        \[\leadsto \left(\color{blue}{\sqrt[3]{\left(\left(x \cdot \log y\right) \cdot \left(x \cdot \log y\right)\right) \cdot \left(x \cdot \log y\right)}} - y\right) - z \]
      2. pow366.6%

        \[\leadsto \left(\sqrt[3]{\color{blue}{{\left(x \cdot \log y\right)}^{3}}} - y\right) - z \]
    7. Applied egg-rr66.6%

      \[\leadsto \left(\color{blue}{\sqrt[3]{{\left(x \cdot \log y\right)}^{3}}} - y\right) - z \]
    8. Taylor expanded in x around 0 99.8%

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

        \[\leadsto \left(-1 \cdot y + \color{blue}{\log y \cdot x}\right) - z \]
      2. neg-mul-199.8%

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

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

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

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

    if -1e18 < (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) < 1e16

    1. Initial program 99.9%

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

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

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

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

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

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

    if 1e16 < (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z)

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

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

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

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

Alternative 3: 98.3% accurate, 0.5× speedup?

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

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

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


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

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

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

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

    if -2e7 < (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) < 1e16

    1. Initial program 99.9%

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

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

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

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

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

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

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

Alternative 4: 98.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \left(t\_1 - y\right) - z\\ \mathbf{if}\;t\_2 \leq -20000000:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, -y\right) - z\\ \mathbf{elif}\;t\_2 \leq 10^{+16}:\\ \;\;\;\;\log t + t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))) (t_2 (- (- t_1 y) z)))
   (if (<= t_2 -20000000.0)
     (- (fma (log y) x (- y)) z)
     (if (<= t_2 1e+16) (+ (log t) t_1) t_2))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double t_2 = (t_1 - y) - z;
	double tmp;
	if (t_2 <= -20000000.0) {
		tmp = fma(log(y), x, -y) - z;
	} else if (t_2 <= 1e+16) {
		tmp = log(t) + t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	t_2 = Float64(Float64(t_1 - y) - z)
	tmp = 0.0
	if (t_2 <= -20000000.0)
		tmp = Float64(fma(log(y), x, Float64(-y)) - z);
	elseif (t_2 <= 1e+16)
		tmp = Float64(log(t) + t_1);
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 - y), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$2, -20000000.0], N[(N[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[t$95$2, 1e+16], N[(N[Log[t], $MachinePrecision] + t$95$1), $MachinePrecision], t$95$2]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \left(t\_1 - y\right) - z\\
\mathbf{if}\;t\_2 \leq -20000000:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -y\right) - z\\

\mathbf{elif}\;t\_2 \leq 10^{+16}:\\
\;\;\;\;\log t + t\_1\\

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


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

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

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

      \[\leadsto \left(x \cdot \log y - y\right) - \color{blue}{z} \]
    6. Step-by-step derivation
      1. add-cbrt-cube66.8%

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

        \[\leadsto \left(\sqrt[3]{\color{blue}{{\left(x \cdot \log y\right)}^{3}}} - y\right) - z \]
    7. Applied egg-rr66.8%

      \[\leadsto \left(\color{blue}{\sqrt[3]{{\left(x \cdot \log y\right)}^{3}}} - y\right) - z \]
    8. Taylor expanded in x around 0 99.1%

      \[\leadsto \color{blue}{\left(-1 \cdot y + x \cdot \log y\right)} - z \]
    9. Step-by-step derivation
      1. *-commutative99.1%

        \[\leadsto \left(-1 \cdot y + \color{blue}{\log y \cdot x}\right) - z \]
      2. neg-mul-199.1%

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

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

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

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

    if -2e7 < (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) < 1e16

    1. Initial program 99.9%

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

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

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

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

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

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

    if 1e16 < (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z)

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x \cdot \log y - y\right) - z \leq -20000000:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, -y\right) - z\\ \mathbf{elif}\;\left(x \cdot \log y - y\right) - z \leq 10^{+16}:\\ \;\;\;\;\log t + x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \log y - y\right) - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 98.6% accurate, 0.6× speedup?

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

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

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


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

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

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

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

    if -1.00000000000000009e25 < (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) < 500

    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 - y\right) + \left(-\left(z - \log t\right)\right)} \]
      3. sub-neg99.9%

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

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

        \[\leadsto \color{blue}{\left(-y\right) + \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-udef100.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 88.7%

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

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

Alternative 6: 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 7: 69.3% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+14} \lor \neg \left(z \leq 1.1 \cdot 10^{-6}\right):\\
\;\;\;\;\left(-y\right) - z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.2e14 or 1.1000000000000001e-6 < z

    1. Initial program 99.9%

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

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

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

      \[\leadsto \left(x \cdot \log y - y\right) - \color{blue}{z} \]
    6. Step-by-step derivation
      1. add-cbrt-cube70.8%

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

        \[\leadsto \left(\sqrt[3]{\color{blue}{{\left(x \cdot \log y\right)}^{3}}} - y\right) - z \]
    7. Applied egg-rr70.8%

      \[\leadsto \left(\color{blue}{\sqrt[3]{{\left(x \cdot \log y\right)}^{3}}} - y\right) - z \]
    8. Taylor expanded in x around 0 79.9%

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

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

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

    if -1.2e14 < z < 1.1000000000000001e-6

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log t - y} \]
    10. Simplified54.5%

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

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

Alternative 8: 69.5% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00165:\\
\;\;\;\;\log t - z\\

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(x \cdot \log y - y\right) - \color{blue}{z} \]
    6. Step-by-step derivation
      1. add-cbrt-cube66.0%

        \[\leadsto \left(\color{blue}{\sqrt[3]{\left(\left(x \cdot \log y\right) \cdot \left(x \cdot \log y\right)\right) \cdot \left(x \cdot \log y\right)}} - y\right) - z \]
      2. pow366.0%

        \[\leadsto \left(\sqrt[3]{\color{blue}{{\left(x \cdot \log y\right)}^{3}}} - y\right) - z \]
    7. Applied egg-rr66.0%

      \[\leadsto \left(\color{blue}{\sqrt[3]{{\left(x \cdot \log y\right)}^{3}}} - y\right) - z \]
    8. Taylor expanded in x around 0 75.9%

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

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

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

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

Alternative 9: 70.1% 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.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 - y\right) + \left(-\left(z - \log t\right)\right)} \]
    3. sub-neg99.8%

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

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

      \[\leadsto \color{blue}{\left(-y\right) + \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-udef99.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.6%

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

    \[\leadsto \left(\log t - z\right) - y \]
  7. Add Preprocessing

Alternative 10: 48.5% accurate, 29.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 2.6 \cdot 10^{+76}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \end{array} \]
(FPCore (x y z t) :precision binary64 (if (<= y 2.6e+76) (- z) (- y)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.6e+76) {
		tmp = -z;
	} else {
		tmp = -y;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= 2.6d+76) then
        tmp = -z
    else
        tmp = -y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.6e+76) {
		tmp = -z;
	} else {
		tmp = -y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 2.6e+76:
		tmp = -z
	else:
		tmp = -y
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 2.6e+76)
		tmp = Float64(-z);
	else
		tmp = Float64(-y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 2.6e+76)
		tmp = -z;
	else
		tmp = -y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.6e+76], (-z), (-y)]
\begin{array}{l}

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

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


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

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

      \[\leadsto \color{blue}{\left(x \cdot \log y - y\right) - \left(z - \log t\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt99.1%

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

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

      \[\leadsto \left(\color{blue}{{\left(\sqrt[3]{x \cdot \log y}\right)}^{3}} - y\right) - \left(z - \log t\right) \]
    7. Taylor expanded in z around inf 38.0%

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

        \[\leadsto \color{blue}{-z} \]
    9. Simplified38.0%

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

    if 2.5999999999999999e76 < y

    1. Initial program 99.9%

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

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

      \[\leadsto \color{blue}{\left(x \cdot \log y - y\right) - \left(z - \log t\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt99.6%

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

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

      \[\leadsto \left(\color{blue}{{\left(\sqrt[3]{x \cdot \log y}\right)}^{3}} - y\right) - \left(z - \log t\right) \]
    7. Taylor expanded in y around inf 68.4%

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

        \[\leadsto \color{blue}{-y} \]
    9. Simplified68.4%

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

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

Alternative 11: 57.4% accurate, 52.3× speedup?

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

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

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

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

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

    \[\leadsto \left(x \cdot \log y - y\right) - \color{blue}{z} \]
  6. Step-by-step derivation
    1. add-cbrt-cube56.2%

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

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

    \[\leadsto \left(\color{blue}{\sqrt[3]{{\left(x \cdot \log y\right)}^{3}}} - y\right) - z \]
  8. Taylor expanded in x around 0 56.6%

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

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

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

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

Alternative 12: 30.5% 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)} \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\left(x \cdot \log y - y\right) - \left(z - \log t\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. add-cube-cbrt99.3%

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

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

    \[\leadsto \left(\color{blue}{{\left(\sqrt[3]{x \cdot \log y}\right)}^{3}} - y\right) - \left(z - \log t\right) \]
  7. Taylor expanded in y around inf 29.8%

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

      \[\leadsto \color{blue}{-y} \]
  9. Simplified29.8%

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

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

Reproduce

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