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

Percentage Accurate: 99.9% → 99.9%
Time: 4.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);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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(\mathsf{fma}\left(\log y, x, -y\right) - z\right) + \log t \end{array} \]
(FPCore (x y z t) :precision binary64 (+ (- (fma (log y) x (- y)) z) (log t)))
double code(double x, double y, double z, double t) {
	return (fma(log(y), x, -y) - z) + log(t);
}
function code(x, y, z, t)
	return Float64(Float64(fma(log(y), x, Float64(-y)) - z) + log(t))
end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\mathsf{fma}\left(\log y, x, -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. Add Preprocessing
  3. Taylor expanded in y around 0

    \[\leadsto \left(\color{blue}{\left(-1 \cdot y + x \cdot \log y\right)} - z\right) + \log t \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \left(\left(x \cdot \log y + \color{blue}{-1 \cdot y}\right) - z\right) + \log t \]
    2. *-commutativeN/A

      \[\leadsto \left(\left(\log y \cdot x + \color{blue}{-1} \cdot y\right) - z\right) + \log t \]
    3. lower-fma.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(\log y, \color{blue}{x}, -1 \cdot y\right) - z\right) + \log t \]
    4. lift-log.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(\log y, x, -1 \cdot y\right) - z\right) + \log t \]
    5. mul-1-negN/A

      \[\leadsto \left(\mathsf{fma}\left(\log y, x, \mathsf{neg}\left(y\right)\right) - z\right) + \log t \]
    6. lower-neg.f6499.9

      \[\leadsto \left(\mathsf{fma}\left(\log y, x, -y\right) - z\right) + \log t \]
  5. Applied rewrites99.9%

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

Alternative 2: 90.6% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(\log t + x \cdot \log y\right) - y} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \left(\log t + x \cdot \log y\right) - \color{blue}{y} \]
      2. +-commutativeN/A

        \[\leadsto \left(x \cdot \log y + \log t\right) - y \]
      3. *-commutativeN/A

        \[\leadsto \left(\log y \cdot x + \log t\right) - y \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \log t\right) - y \]
      5. lift-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \log t\right) - y \]
      6. lift-log.f6493.5

        \[\leadsto \mathsf{fma}\left(\log y, x, \log t\right) - y \]
    5. Applied rewrites93.5%

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

    if -1.9999999999999999e168 < (-.f64 (*.f64 x (log.f64 y)) y) < -5e18

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      2. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      3. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - z \]
      4. lift-log.f6489.4

        \[\leadsto \left(\log t - y\right) - z \]
    5. Applied rewrites89.4%

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

      \[\leadsto -1 \cdot y - z \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(y\right)\right) - z \]
      2. lift-neg.f6489.4

        \[\leadsto \left(-y\right) - z \]
    8. Applied rewrites89.4%

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

    if -5e18 < (-.f64 (*.f64 x (log.f64 y)) y)

    1. Initial program 99.8%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\left(\log t + x \cdot \log y\right) - z} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \left(\log t + x \cdot \log y\right) - \color{blue}{z} \]
      2. +-commutativeN/A

        \[\leadsto \left(x \cdot \log y + \log t\right) - z \]
      3. *-commutativeN/A

        \[\leadsto \left(\log y \cdot x + \log t\right) - z \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \log t\right) - z \]
      5. lift-log.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\log y, x, \log t\right) - z \]
    5. Applied rewrites99.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \log t\right) - z} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 90.6% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\left(\log t - y\right) - z\\

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


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

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(\log t + x \cdot \log y\right) - y} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \left(\log t + x \cdot \log y\right) - \color{blue}{y} \]
      2. +-commutativeN/A

        \[\leadsto \left(x \cdot \log y + \log t\right) - y \]
      3. *-commutativeN/A

        \[\leadsto \left(\log y \cdot x + \log t\right) - y \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \log t\right) - y \]
      5. lift-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \log t\right) - y \]
      6. lift-log.f6493.5

        \[\leadsto \mathsf{fma}\left(\log y, x, \log t\right) - y \]
    5. Applied rewrites93.5%

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

    if -1.9999999999999999e168 < (-.f64 (*.f64 x (log.f64 y)) y) < 2

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      2. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      3. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - z \]
      4. lift-log.f6492.5

        \[\leadsto \left(\log t - y\right) - z \]
    5. Applied rewrites92.5%

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

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

    1. Initial program 99.8%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(\left(\log y + \frac{\log t}{x}\right) - \left(\frac{y}{x} + \frac{z}{x}\right)\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\left(\log y + \frac{\log t}{x}\right) - \left(\frac{y}{x} + \frac{z}{x}\right)\right) \cdot \color{blue}{x} \]
      2. lower-*.f64N/A

        \[\leadsto \left(\left(\log y + \frac{\log t}{x}\right) - \left(\frac{y}{x} + \frac{z}{x}\right)\right) \cdot \color{blue}{x} \]
      3. associate--l+N/A

        \[\leadsto \left(\log y + \left(\frac{\log t}{x} - \left(\frac{y}{x} + \frac{z}{x}\right)\right)\right) \cdot x \]
      4. div-add-revN/A

        \[\leadsto \left(\log y + \left(\frac{\log t}{x} - \frac{y + z}{x}\right)\right) \cdot x \]
      5. div-subN/A

        \[\leadsto \left(\log y + \frac{\log t - \left(y + z\right)}{x}\right) \cdot x \]
      6. lower-+.f64N/A

        \[\leadsto \left(\log y + \frac{\log t - \left(y + z\right)}{x}\right) \cdot x \]
      7. lift-log.f64N/A

        \[\leadsto \left(\log y + \frac{\log t - \left(y + z\right)}{x}\right) \cdot x \]
      8. lower-/.f64N/A

        \[\leadsto \left(\log y + \frac{\log t - \left(y + z\right)}{x}\right) \cdot x \]
      9. associate--r+N/A

        \[\leadsto \left(\log y + \frac{\left(\log t - y\right) - z}{x}\right) \cdot x \]
      10. lower--.f64N/A

        \[\leadsto \left(\log y + \frac{\left(\log t - y\right) - z}{x}\right) \cdot x \]
      11. lower--.f64N/A

        \[\leadsto \left(\log y + \frac{\left(\log t - y\right) - z}{x}\right) \cdot x \]
      12. lift-log.f6499.7

        \[\leadsto \left(\log y + \frac{\left(\log t - y\right) - z}{x}\right) \cdot x \]
    5. Applied rewrites99.7%

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

      \[\leadsto \left(\log y + \frac{-1 \cdot z}{x}\right) \cdot x \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left(\log y + \frac{\mathsf{neg}\left(z\right)}{x}\right) \cdot x \]
      2. lower-neg.f6496.9

        \[\leadsto \left(\log y + \frac{-z}{x}\right) \cdot x \]
    8. Applied rewrites96.9%

      \[\leadsto \left(\log y + \frac{-z}{x}\right) \cdot x \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 79.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y - y\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+18}:\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+76}:\\ \;\;\;\;\log t - z\\ \mathbf{else}:\\ \;\;\;\;\log y \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* x (log y)) y)))
   (if (<= t_1 -5e+18)
     (- (- y) z)
     (if (<= t_1 5e+76) (- (log t) z) (* (log y) x)))))
double code(double x, double y, double z, double t) {
	double t_1 = (x * log(y)) - y;
	double tmp;
	if (t_1 <= -5e+18) {
		tmp = -y - z;
	} else if (t_1 <= 5e+76) {
		tmp = log(t) - z;
	} else {
		tmp = log(y) * x;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (x * log(y)) - y
    if (t_1 <= (-5d+18)) then
        tmp = -y - z
    else if (t_1 <= 5d+76) then
        tmp = log(t) - z
    else
        tmp = log(y) * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (x * Math.log(y)) - y;
	double tmp;
	if (t_1 <= -5e+18) {
		tmp = -y - z;
	} else if (t_1 <= 5e+76) {
		tmp = Math.log(t) - z;
	} else {
		tmp = Math.log(y) * x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x * math.log(y)) - y
	tmp = 0
	if t_1 <= -5e+18:
		tmp = -y - z
	elif t_1 <= 5e+76:
		tmp = math.log(t) - z
	else:
		tmp = math.log(y) * x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x * log(y)) - y)
	tmp = 0.0
	if (t_1 <= -5e+18)
		tmp = Float64(Float64(-y) - z);
	elseif (t_1 <= 5e+76)
		tmp = Float64(log(t) - z);
	else
		tmp = Float64(log(y) * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x * log(y)) - y;
	tmp = 0.0;
	if (t_1 <= -5e+18)
		tmp = -y - z;
	elseif (t_1 <= 5e+76)
		tmp = log(t) - z;
	else
		tmp = log(y) * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+18], N[((-y) - z), $MachinePrecision], If[LessEqual[t$95$1, 5e+76], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;\log y \cdot x\\


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

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      2. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      3. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - z \]
      4. lift-log.f6477.5

        \[\leadsto \left(\log t - y\right) - z \]
    5. Applied rewrites77.5%

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

      \[\leadsto -1 \cdot y - z \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(y\right)\right) - z \]
      2. lift-neg.f6477.5

        \[\leadsto \left(-y\right) - z \]
    8. Applied rewrites77.5%

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

    if -5e18 < (-.f64 (*.f64 x (log.f64 y)) y) < 4.99999999999999991e76

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      2. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      3. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - z \]
      4. lift-log.f6490.6

        \[\leadsto \left(\log t - y\right) - z \]
    5. Applied rewrites90.6%

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

      \[\leadsto \log t - z \]
    7. Step-by-step derivation
      1. lift-log.f6490.6

        \[\leadsto \log t - z \]
    8. Applied rewrites90.6%

      \[\leadsto \log t - z \]

    if 4.99999999999999991e76 < (-.f64 (*.f64 x (log.f64 y)) y)

    1. Initial program 99.7%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \log y} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \log y \cdot \color{blue}{x} \]
      2. lower-*.f64N/A

        \[\leadsto \log y \cdot \color{blue}{x} \]
      3. lift-log.f6491.1

        \[\leadsto \log y \cdot x \]
    5. Applied rewrites91.1%

      \[\leadsto \color{blue}{\log y \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 70.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot \log y - y \leq -5 \cdot 10^{+18}:\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{else}:\\ \;\;\;\;\log t - z\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (- (* x (log y)) y) -5e+18) (- (- y) z) (- (log t) z)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * log(y)) - y) <= -5e+18) {
		tmp = -y - z;
	} else {
		tmp = log(t) - z;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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 * log(y)) - y) <= (-5d+18)) then
        tmp = -y - z
    else
        tmp = log(t) - z
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * Math.log(y)) - y) <= -5e+18) {
		tmp = -y - z;
	} else {
		tmp = Math.log(t) - z;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x * math.log(y)) - y) <= -5e+18:
		tmp = -y - z
	else:
		tmp = math.log(t) - z
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(Float64(x * log(y)) - y) <= -5e+18)
		tmp = Float64(Float64(-y) - z);
	else
		tmp = Float64(log(t) - z);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((x * log(y)) - y) <= -5e+18)
		tmp = -y - z;
	else
		tmp = log(t) - z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], -5e+18], N[((-y) - z), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot \log y - y \leq -5 \cdot 10^{+18}:\\
\;\;\;\;\left(-y\right) - z\\

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


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

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      2. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      3. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - z \]
      4. lift-log.f6477.5

        \[\leadsto \left(\log t - y\right) - z \]
    5. Applied rewrites77.5%

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

      \[\leadsto -1 \cdot y - z \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(y\right)\right) - z \]
      2. lift-neg.f6477.5

        \[\leadsto \left(-y\right) - z \]
    8. Applied rewrites77.5%

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

    if -5e18 < (-.f64 (*.f64 x (log.f64 y)) y)

    1. Initial program 99.8%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      2. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      3. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - z \]
      4. lift-log.f6464.7

        \[\leadsto \left(\log t - y\right) - z \]
    5. Applied rewrites64.7%

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

      \[\leadsto \log t - z \]
    7. Step-by-step derivation
      1. lift-log.f6464.9

        \[\leadsto \log t - z \]
    8. Applied rewrites64.9%

      \[\leadsto \log t - z \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 89.5% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.2 \cdot 10^{+99} \lor \neg \left(x \leq 17000000000000\right):\\ \;\;\;\;\left(\log y + \frac{-y}{x}\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(\log t - y\right) - z\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -4.2e+99) (not (<= x 17000000000000.0)))
   (* (+ (log y) (/ (- y) x)) x)
   (- (- (log t) y) z)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -4.2e+99) || !(x <= 17000000000000.0)) {
		tmp = (log(y) + (-y / x)) * x;
	} else {
		tmp = (log(t) - y) - z;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((x <= (-4.2d+99)) .or. (.not. (x <= 17000000000000.0d0))) then
        tmp = (log(y) + (-y / x)) * x
    else
        tmp = (log(t) - y) - z
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -4.2e+99) || !(x <= 17000000000000.0)) {
		tmp = (Math.log(y) + (-y / x)) * x;
	} else {
		tmp = (Math.log(t) - y) - z;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -4.2e+99) or not (x <= 17000000000000.0):
		tmp = (math.log(y) + (-y / x)) * x
	else:
		tmp = (math.log(t) - y) - z
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -4.2e+99) || !(x <= 17000000000000.0))
		tmp = Float64(Float64(log(y) + Float64(Float64(-y) / x)) * x);
	else
		tmp = Float64(Float64(log(t) - y) - z);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x <= -4.2e+99) || ~((x <= 17000000000000.0)))
		tmp = (log(y) + (-y / x)) * x;
	else
		tmp = (log(t) - y) - z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.2e+99], N[Not[LessEqual[x, 17000000000000.0]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] + N[((-y) / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.2000000000000002e99 or 1.7e13 < x

    1. Initial program 99.7%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(\left(\log y + \frac{\log t}{x}\right) - \left(\frac{y}{x} + \frac{z}{x}\right)\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\left(\log y + \frac{\log t}{x}\right) - \left(\frac{y}{x} + \frac{z}{x}\right)\right) \cdot \color{blue}{x} \]
      2. lower-*.f64N/A

        \[\leadsto \left(\left(\log y + \frac{\log t}{x}\right) - \left(\frac{y}{x} + \frac{z}{x}\right)\right) \cdot \color{blue}{x} \]
      3. associate--l+N/A

        \[\leadsto \left(\log y + \left(\frac{\log t}{x} - \left(\frac{y}{x} + \frac{z}{x}\right)\right)\right) \cdot x \]
      4. div-add-revN/A

        \[\leadsto \left(\log y + \left(\frac{\log t}{x} - \frac{y + z}{x}\right)\right) \cdot x \]
      5. div-subN/A

        \[\leadsto \left(\log y + \frac{\log t - \left(y + z\right)}{x}\right) \cdot x \]
      6. lower-+.f64N/A

        \[\leadsto \left(\log y + \frac{\log t - \left(y + z\right)}{x}\right) \cdot x \]
      7. lift-log.f64N/A

        \[\leadsto \left(\log y + \frac{\log t - \left(y + z\right)}{x}\right) \cdot x \]
      8. lower-/.f64N/A

        \[\leadsto \left(\log y + \frac{\log t - \left(y + z\right)}{x}\right) \cdot x \]
      9. associate--r+N/A

        \[\leadsto \left(\log y + \frac{\left(\log t - y\right) - z}{x}\right) \cdot x \]
      10. lower--.f64N/A

        \[\leadsto \left(\log y + \frac{\left(\log t - y\right) - z}{x}\right) \cdot x \]
      11. lower--.f64N/A

        \[\leadsto \left(\log y + \frac{\left(\log t - y\right) - z}{x}\right) \cdot x \]
      12. lift-log.f6499.7

        \[\leadsto \left(\log y + \frac{\left(\log t - y\right) - z}{x}\right) \cdot x \]
    5. Applied rewrites99.7%

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

      \[\leadsto \left(\log y + \frac{-1 \cdot y}{x}\right) \cdot x \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left(\log y + \frac{\mathsf{neg}\left(y\right)}{x}\right) \cdot x \]
      2. lift-neg.f6488.9

        \[\leadsto \left(\log y + \frac{-y}{x}\right) \cdot x \]
    8. Applied rewrites88.9%

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

    if -4.2000000000000002e99 < x < 1.7e13

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      2. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      3. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - z \]
      4. lift-log.f6495.4

        \[\leadsto \left(\log t - y\right) - z \]
    5. Applied rewrites95.4%

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

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

Alternative 7: 83.8% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.8 \cdot 10^{+102} \lor \neg \left(x \leq 1.62 \cdot 10^{+181}\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(\log t - y\right) - z\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -5.8e+102) (not (<= x 1.62e+181)))
   (* (log y) x)
   (- (- (log t) y) z)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -5.8e+102) || !(x <= 1.62e+181)) {
		tmp = log(y) * x;
	} else {
		tmp = (log(t) - y) - z;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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 <= (-5.8d+102)) .or. (.not. (x <= 1.62d+181))) then
        tmp = log(y) * x
    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 <= -5.8e+102) || !(x <= 1.62e+181)) {
		tmp = Math.log(y) * x;
	} else {
		tmp = (Math.log(t) - y) - z;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -5.8e+102) or not (x <= 1.62e+181):
		tmp = math.log(y) * x
	else:
		tmp = (math.log(t) - y) - z
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -5.8e+102) || !(x <= 1.62e+181))
		tmp = Float64(log(y) * x);
	else
		tmp = Float64(Float64(log(t) - y) - z);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x <= -5.8e+102) || ~((x <= 1.62e+181)))
		tmp = log(y) * x;
	else
		tmp = (log(t) - y) - z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.8e+102], N[Not[LessEqual[x, 1.62e+181]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+102} \lor \neg \left(x \leq 1.62 \cdot 10^{+181}\right):\\
\;\;\;\;\log y \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.8000000000000005e102 or 1.62000000000000001e181 < x

    1. Initial program 99.7%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \log y} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \log y \cdot \color{blue}{x} \]
      2. lower-*.f64N/A

        \[\leadsto \log y \cdot \color{blue}{x} \]
      3. lift-log.f6479.9

        \[\leadsto \log y \cdot x \]
    5. Applied rewrites79.9%

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

    if -5.8000000000000005e102 < x < 1.62000000000000001e181

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      2. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      3. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - z \]
      4. lift-log.f6491.6

        \[\leadsto \left(\log t - y\right) - z \]
    5. Applied rewrites91.6%

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

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

Alternative 8: 70.4% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -225 \lor \neg \left(z \leq 230\right):\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{else}:\\ \;\;\;\;\log t - y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= z -225.0) (not (<= z 230.0))) (- (- y) z) (- (log t) y)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -225.0) || !(z <= 230.0)) {
		tmp = -y - z;
	} else {
		tmp = log(t) - y;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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 <= (-225.0d0)) .or. (.not. (z <= 230.0d0))) 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 <= -225.0) || !(z <= 230.0)) {
		tmp = -y - z;
	} else {
		tmp = Math.log(t) - y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -225.0) or not (z <= 230.0):
		tmp = -y - z
	else:
		tmp = math.log(t) - y
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((z <= -225.0) || !(z <= 230.0))
		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 <= -225.0) || ~((z <= 230.0)))
		tmp = -y - z;
	else
		tmp = log(t) - y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -225.0], N[Not[LessEqual[z, 230.0]], $MachinePrecision]], N[((-y) - z), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -225 or 230 < z

    1. Initial program 99.9%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      2. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      3. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - z \]
      4. lift-log.f6478.2

        \[\leadsto \left(\log t - y\right) - z \]
    5. Applied rewrites78.2%

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

      \[\leadsto -1 \cdot y - z \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(y\right)\right) - z \]
      2. lift-neg.f6476.4

        \[\leadsto \left(-y\right) - z \]
    8. Applied rewrites76.4%

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

    if -225 < z < 230

    1. Initial program 99.8%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      2. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
      3. lower--.f64N/A

        \[\leadsto \left(\log t - y\right) - z \]
      4. lift-log.f6465.2

        \[\leadsto \left(\log t - y\right) - z \]
    5. Applied rewrites65.2%

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

      \[\leadsto \log t - \color{blue}{y} \]
    7. Step-by-step derivation
      1. lift-log.f64N/A

        \[\leadsto \log t - y \]
      2. lift--.f6464.5

        \[\leadsto \log t - y \]
    8. Applied rewrites64.5%

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

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

Alternative 9: 48.3% accurate, 23.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 5.8 \cdot 10^{+72}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \end{array} \]
(FPCore (x y z t) :precision binary64 (if (<= y 5.8e+72) (- z) (- y)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 5.8e+72) {
		tmp = -z;
	} else {
		tmp = -y;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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 <= 5.8d+72) 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 <= 5.8e+72) {
		tmp = -z;
	} else {
		tmp = -y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 5.8e+72:
		tmp = -z
	else:
		tmp = -y
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 5.8e+72)
		tmp = Float64(-z);
	else
		tmp = Float64(-y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 5.8e+72)
		tmp = -z;
	else
		tmp = -y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 5.8e+72], (-z), (-y)]
\begin{array}{l}

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

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


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

    1. Initial program 99.8%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(z\right) \]
      2. lower-neg.f6437.7

        \[\leadsto -z \]
    5. Applied rewrites37.7%

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

    if 5.80000000000000034e72 < y

    1. Initial program 100.0%

      \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{-1 \cdot y} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(y\right) \]
      2. lower-neg.f6471.1

        \[\leadsto -y \]
    5. Applied rewrites71.1%

      \[\leadsto \color{blue}{-y} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 58.3% accurate, 35.8× 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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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

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

    \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\log t - \left(y + z\right)} \]
  4. Step-by-step derivation
    1. associate--r+N/A

      \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
    2. lower--.f64N/A

      \[\leadsto \left(\log t - y\right) - \color{blue}{z} \]
    3. lower--.f64N/A

      \[\leadsto \left(\log t - y\right) - z \]
    4. lift-log.f6471.8

      \[\leadsto \left(\log t - y\right) - z \]
  5. Applied rewrites71.8%

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

    \[\leadsto -1 \cdot y - z \]
  7. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \left(\mathsf{neg}\left(y\right)\right) - z \]
    2. lift-neg.f6458.6

      \[\leadsto \left(-y\right) - z \]
  8. Applied rewrites58.6%

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

Alternative 11: 29.8% accurate, 71.7× 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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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. Add Preprocessing
  3. Taylor expanded in y around inf

    \[\leadsto \color{blue}{-1 \cdot y} \]
  4. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{neg}\left(y\right) \]
    2. lower-neg.f6431.8

      \[\leadsto -y \]
  5. Applied rewrites31.8%

    \[\leadsto \color{blue}{-y} \]
  6. Add Preprocessing

Reproduce

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