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

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.0× speedup?

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

\\
x \cdot \log y + \left(\left(\log t - z\right) - y\right)
\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. Simplified99.9%

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

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

Alternative 2: 89.0% accurate, 1.0× speedup?

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

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

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

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


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

    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-define99.7%

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

      \[\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 95.1%

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

    if -5.1e-16 < x < 1.20000000000000004e46

    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-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. Simplified100.0%

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

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

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

        \[\leadsto x \cdot \log y - \log \color{blue}{\left(\frac{e^{y + z}}{e^{\log t}}\right)} \]
      4. add-exp-log26.9%

        \[\leadsto x \cdot \log y - \log \left(\frac{e^{y + z}}{\color{blue}{t}}\right) \]
    6. Applied egg-rr26.9%

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

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

        \[\leadsto \color{blue}{-\log \left(\frac{e^{y + z}}{t}\right)} \]
    9. Simplified25.6%

      \[\leadsto \color{blue}{-\log \left(\frac{e^{y + z}}{t}\right)} \]
    10. Taylor expanded in t around 0 98.7%

      \[\leadsto -\color{blue}{\left(y + \left(z + -1 \cdot \log t\right)\right)} \]
    11. Step-by-step derivation
      1. neg-mul-198.7%

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

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

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

    if 1.20000000000000004e46 < 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. Simplified99.8%

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

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

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

Alternative 3: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 4: 89.0% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -260 \lor \neg \left(x \leq 1.55 \cdot 10^{+42}\right):\\
\;\;\;\;x \cdot \log y - y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -260 or 1.5500000000000001e42 < 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. Simplified99.8%

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

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

    if -260 < x < 1.5500000000000001e42

    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-define99.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 0 98.6%

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

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

Alternative 5: 89.0% accurate, 1.8× speedup?

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

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

    if -260 < x < 1.17999999999999993e45

    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-define99.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 0 98.6%

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

    if 1.17999999999999993e45 < 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. Simplified99.8%

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

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

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

Alternative 6: 89.0% accurate, 1.8× speedup?

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

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

    if -260 < x < 5.5999999999999999e45

    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-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. Simplified100.0%

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

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

        \[\leadsto x \cdot \log y - \log \left(e^{\color{blue}{\left(y + z\right) - \log t}}\right) \]
      3. exp-diff27.2%

        \[\leadsto x \cdot \log y - \log \color{blue}{\left(\frac{e^{y + z}}{e^{\log t}}\right)} \]
      4. add-exp-log27.2%

        \[\leadsto x \cdot \log y - \log \left(\frac{e^{y + z}}{\color{blue}{t}}\right) \]
    6. Applied egg-rr27.2%

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

      \[\leadsto \color{blue}{-1 \cdot \log \left(\frac{e^{y + z}}{t}\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg25.9%

        \[\leadsto \color{blue}{-\log \left(\frac{e^{y + z}}{t}\right)} \]
    9. Simplified25.9%

      \[\leadsto \color{blue}{-\log \left(\frac{e^{y + z}}{t}\right)} \]
    10. Taylor expanded in t around 0 98.7%

      \[\leadsto -\color{blue}{\left(y + \left(z + -1 \cdot \log t\right)\right)} \]
    11. Step-by-step derivation
      1. neg-mul-198.7%

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

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

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

    if 5.5999999999999999e45 < 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. Simplified99.8%

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

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

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

Alternative 7: 60.9% accurate, 1.9× speedup?

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

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

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


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

    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-define99.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 x around 0 66.1%

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

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

    if 2.09999999999999986e54 < y

    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-define99.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log t - y} \]
    10. Simplified68.4%

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

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

Alternative 8: 70.7% accurate, 2.0× speedup?

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

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

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

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

      \[\leadsto \color{blue}{\left(x \cdot \log y + \left(\left(-y\right) - z\right)\right)} + \log t \]
    3. fma-define99.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 0 72.1%

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

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

Alternative 9: 42.4% accurate, 2.0× speedup?

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

\\
\log t - 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. 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-define99.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\log t - y} \]
  10. Simplified46.1%

    \[\leadsto \color{blue}{\log t - y} \]
  11. Final simplification46.1%

    \[\leadsto \log t - y \]
  12. Add Preprocessing

Alternative 10: 14.2% accurate, 2.1× speedup?

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

\\
\log t
\end{array}
Derivation
  1. Initial program 99.9%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\log t} \]
  9. Final simplification14.3%

    \[\leadsto \log t \]
  10. Add Preprocessing

Alternative 11: 2.2% accurate, 209.0× speedup?

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

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

    \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
  2. Step-by-step derivation
    1. 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-define99.9%

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

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

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

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

    \[\leadsto \color{blue}{\left(-y\right)} + \log t \]
  8. Step-by-step derivation
    1. *-un-lft-identity46.1%

      \[\leadsto \color{blue}{1 \cdot \left(\left(-y\right) + \log t\right)} \]
    2. add-sqr-sqrt0.0%

      \[\leadsto 1 \cdot \left(\color{blue}{\sqrt{-y} \cdot \sqrt{-y}} + \log t\right) \]
    3. sqrt-unprod13.5%

      \[\leadsto 1 \cdot \left(\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}} + \log t\right) \]
    4. sqr-neg13.5%

      \[\leadsto 1 \cdot \left(\sqrt{\color{blue}{y \cdot y}} + \log t\right) \]
    5. sqrt-unprod13.5%

      \[\leadsto 1 \cdot \left(\color{blue}{\sqrt{y} \cdot \sqrt{y}} + \log t\right) \]
    6. add-sqr-sqrt13.5%

      \[\leadsto 1 \cdot \left(\color{blue}{y} + \log t\right) \]
  9. Applied egg-rr13.5%

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

      \[\leadsto \color{blue}{y + \log t} \]
  11. Simplified13.5%

    \[\leadsto \color{blue}{y + \log t} \]
  12. Taylor expanded in y around inf 2.2%

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

    \[\leadsto y \]
  14. Add Preprocessing

Reproduce

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