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

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

Specification

?
\[\begin{array}{l} \\ \left(\left(x \cdot \log y - y\right) - z\right) + \log t \end{array} \]
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
	return (((x * log(y)) - y) - z) + log(t);
}
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}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

\\
\left(\mathsf{fma}\left(\log y, x, -z\right) - y\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 z around 0

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

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

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

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

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

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

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

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

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

Alternative 2: 71.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y - y\\ t_2 := \log y \cdot x\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+264}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+15}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, -y\right)\\ \mathbf{elif}\;t\_1 \leq 10^{+128}:\\ \;\;\;\;\left(-z\right) + \log t\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* x (log y)) y)) (t_2 (* (log y) x)))
   (if (<= t_1 -5e+264)
     t_2
     (if (<= t_1 -2e+15)
       (fma (/ (- z) x) x (- y))
       (if (<= t_1 1e+128) (+ (- z) (log t)) t_2)))))
double code(double x, double y, double z, double t) {
	double t_1 = (x * log(y)) - y;
	double t_2 = log(y) * x;
	double tmp;
	if (t_1 <= -5e+264) {
		tmp = t_2;
	} else if (t_1 <= -2e+15) {
		tmp = fma((-z / x), x, -y);
	} else if (t_1 <= 1e+128) {
		tmp = -z + log(t);
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(x * log(y)) - y)
	t_2 = Float64(log(y) * x)
	tmp = 0.0
	if (t_1 <= -5e+264)
		tmp = t_2;
	elseif (t_1 <= -2e+15)
		tmp = fma(Float64(Float64(-z) / x), x, Float64(-y));
	elseif (t_1 <= 1e+128)
		tmp = Float64(Float64(-z) + log(t));
	else
		tmp = t_2;
	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), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+264], t$95$2, If[LessEqual[t$95$1, -2e+15], N[(N[((-z) / x), $MachinePrecision] * x + (-y)), $MachinePrecision], If[LessEqual[t$95$1, 1e+128], N[((-z) + N[Log[t], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
t_2 := \log y \cdot x\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+264}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, -y\right)\\

\mathbf{elif}\;t\_1 \leq 10^{+128}:\\
\;\;\;\;\left(-z\right) + \log t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (*.f64 x (log.f64 y)) y) < -5.00000000000000033e264 or 1.0000000000000001e128 < (-.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.f6463.4

        \[\leadsto \log y \cdot x \]
    5. Applied rewrites63.4%

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

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

    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 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.f6475.9

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(\log y + \frac{\log t}{x}\right) - \frac{z}{x}, x, -1 \cdot y\right) \]
      4. associate--l+N/A

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

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

        \[\leadsto \mathsf{fma}\left(\log y + \left(\frac{\log t}{x} - \frac{z}{x}\right), x, -1 \cdot y\right) \]
      7. sub-divN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\log y + \frac{\log t - z}{x}, x, \mathsf{neg}\left(y\right)\right) \]
      12. lift-neg.f6489.2

        \[\leadsto \mathsf{fma}\left(\log y + \frac{\log t - z}{x}, x, -y\right) \]
    8. Applied rewrites89.2%

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

      \[\leadsto \mathsf{fma}\left(-1 \cdot \frac{z}{x}, x, -y\right) \]
    10. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1 \cdot z}{x}, x, -y\right) \]
      2. lower-/.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{neg}\left(z\right)}{x}, x, -y\right) \]
      4. lower-neg.f6465.3

        \[\leadsto \mathsf{fma}\left(\frac{-z}{x}, x, -y\right) \]
    11. Applied rewrites65.3%

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

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

    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 inf

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

        \[\leadsto \left(\mathsf{neg}\left(z\right)\right) + \log t \]
      2. lower-neg.f6485.5

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

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

Alternative 3: 89.4% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;z \leq 3.5 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.45e86 or 3.5000000000000002e27 < 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.f6481.4

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

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

    if -2.45e86 < z < 3.5000000000000002e27

    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 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.f6495.0

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

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

Alternative 4: 88.8% accurate, 1.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.05000000000000005e135 or 1.10000000000000004e26 < 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 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. lift-neg.f6482.7

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

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

    if -1.05000000000000005e135 < x < 1.10000000000000004e26

    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.f6492.2

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

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

Alternative 5: 88.6% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+135}:\\
\;\;\;\;\log y \cdot x - y\\

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

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


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

    1. Initial program 99.7%

      \[\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.f6487.8

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

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

      \[\leadsto x \cdot \log y - y \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \log y \cdot x - y \]
      3. lift-log.f6487.8

        \[\leadsto \log y \cdot x - y \]
    8. Applied rewrites87.8%

      \[\leadsto \log y \cdot x - y \]

    if -2.1000000000000001e135 < x < 4.4999999999999997e106

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

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

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

    if 4.4999999999999997e106 < 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.f6484.8

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

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

Alternative 6: 65.7% accurate, 1.7× speedup?

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

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

\mathbf{elif}\;x \leq -2.6 \cdot 10^{-91}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;x \leq 4.6 \cdot 10^{+170}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.19999999999999975e135 or 4.6000000000000001e170 < 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.f6476.0

        \[\leadsto \log y \cdot x \]
    5. Applied rewrites76.0%

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

    if -3.19999999999999975e135 < x < -2.60000000000000014e-91 or 4.99999999999999997e-56 < x < 4.6000000000000001e170

    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 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.f6496.0

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(\log y + \frac{\log t}{x}\right) - \frac{z}{x}, x, -1 \cdot y\right) \]
      4. associate--l+N/A

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

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

        \[\leadsto \mathsf{fma}\left(\log y + \left(\frac{\log t}{x} - \frac{z}{x}\right), x, -1 \cdot y\right) \]
      7. sub-divN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\log y + \frac{\log t - z}{x}, x, \mathsf{neg}\left(y\right)\right) \]
      12. lift-neg.f6497.7

        \[\leadsto \mathsf{fma}\left(\log y + \frac{\log t - z}{x}, x, -y\right) \]
    8. Applied rewrites97.7%

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

      \[\leadsto \mathsf{fma}\left(-1 \cdot \frac{z}{x}, x, -y\right) \]
    10. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1 \cdot z}{x}, x, -y\right) \]
      2. lower-/.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{neg}\left(z\right)}{x}, x, -y\right) \]
      4. lower-neg.f6462.7

        \[\leadsto \mathsf{fma}\left(\frac{-z}{x}, x, -y\right) \]
    11. Applied rewrites62.7%

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

    if -2.60000000000000014e-91 < x < 4.99999999999999997e-56

    1. Initial program 100.0%

      \[\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.f6462.0

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

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

      \[\leadsto \log t - y \]
    7. Step-by-step derivation
      1. lift-log.f6462.0

        \[\leadsto \log t - y \]
    8. Applied rewrites62.0%

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

Alternative 7: 88.6% accurate, 1.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.1000000000000001e135 or 4.4999999999999997e106 < 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 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.f6486.2

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

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

      \[\leadsto x \cdot \log y - y \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \log y \cdot x - y \]
      3. lift-log.f6486.2

        \[\leadsto \log y \cdot x - y \]
    8. Applied rewrites86.2%

      \[\leadsto \log y \cdot x - y \]

    if -2.1000000000000001e135 < x < 4.4999999999999997e106

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

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

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

Alternative 8: 83.9% accurate, 1.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.19999999999999975e135 or 4.6000000000000001e170 < 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.f6476.0

        \[\leadsto \log y \cdot x \]
    5. Applied rewrites76.0%

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

    if -3.19999999999999975e135 < x < 4.6000000000000001e170

    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.f6486.5

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

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

Alternative 9: 62.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+69}:\\
\;\;\;\;-z\\

\mathbf{elif}\;z \leq 9.5 \cdot 10^{+19}:\\
\;\;\;\;\log t - y\\

\mathbf{elif}\;z \leq 6.2 \cdot 10^{+174}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, -y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.5000000000000001e69 or 6.2e174 < 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 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.f6470.2

        \[\leadsto -z \]
    5. Applied rewrites70.2%

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

    if -6.5000000000000001e69 < z < 9.5e19

    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 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.f6495.9

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

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

      \[\leadsto \log t - y \]
    7. Step-by-step derivation
      1. lift-log.f6459.5

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

      \[\leadsto \log t - y \]

    if 9.5e19 < z < 6.2e174

    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 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.f6478.5

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(\log y + \frac{\log t}{x}\right) - \frac{z}{x}, x, -1 \cdot y\right) \]
      4. associate--l+N/A

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

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

        \[\leadsto \mathsf{fma}\left(\log y + \left(\frac{\log t}{x} - \frac{z}{x}\right), x, -1 \cdot y\right) \]
      7. sub-divN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\log y + \frac{\log t - z}{x}, x, \mathsf{neg}\left(y\right)\right) \]
      12. lift-neg.f6484.2

        \[\leadsto \mathsf{fma}\left(\log y + \frac{\log t - z}{x}, x, -y\right) \]
    8. Applied rewrites84.2%

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

      \[\leadsto \mathsf{fma}\left(-1 \cdot \frac{z}{x}, x, -y\right) \]
    10. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1 \cdot z}{x}, x, -y\right) \]
      2. lower-/.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{neg}\left(z\right)}{x}, x, -y\right) \]
      4. lower-neg.f6455.4

        \[\leadsto \mathsf{fma}\left(\frac{-z}{x}, x, -y\right) \]
    11. Applied rewrites55.4%

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

Alternative 10: 52.4% accurate, 6.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+170}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+174}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, -y\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -4.3e+170)
   (- z)
   (if (<= z 6.2e+174) (fma (/ (- z) x) x (- y)) (- z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -4.3e+170) {
		tmp = -z;
	} else if (z <= 6.2e+174) {
		tmp = fma((-z / x), x, -y);
	} else {
		tmp = -z;
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -4.3e+170)
		tmp = Float64(-z);
	elseif (z <= 6.2e+174)
		tmp = fma(Float64(Float64(-z) / x), x, Float64(-y));
	else
		tmp = Float64(-z);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.3e+170], (-z), If[LessEqual[z, 6.2e+174], N[(N[((-z) / x), $MachinePrecision] * x + (-y)), $MachinePrecision], (-z)]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+170}:\\
\;\;\;\;-z\\

\mathbf{elif}\;z \leq 6.2 \cdot 10^{+174}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, -y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.2999999999999999e170 or 6.2e174 < z

    1. Initial program 100.0%

      \[\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.f6478.5

        \[\leadsto -z \]
    5. Applied rewrites78.5%

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

    if -4.2999999999999999e170 < z < 6.2e174

    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.f6484.4

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(\log y + \frac{\log t}{x}\right) - \frac{z}{x}, x, -1 \cdot y\right) \]
      4. associate--l+N/A

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

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

        \[\leadsto \mathsf{fma}\left(\log y + \left(\frac{\log t}{x} - \frac{z}{x}\right), x, -1 \cdot y\right) \]
      7. sub-divN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\log y + \frac{\log t - z}{x}, x, \mathsf{neg}\left(y\right)\right) \]
      12. lift-neg.f6494.6

        \[\leadsto \mathsf{fma}\left(\log y + \frac{\log t - z}{x}, x, -y\right) \]
    8. Applied rewrites94.6%

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

      \[\leadsto \mathsf{fma}\left(-1 \cdot \frac{z}{x}, x, -y\right) \]
    10. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1 \cdot z}{x}, x, -y\right) \]
      2. lower-/.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{neg}\left(z\right)}{x}, x, -y\right) \]
      4. lower-neg.f6444.9

        \[\leadsto \mathsf{fma}\left(\frac{-z}{x}, x, -y\right) \]
    11. Applied rewrites44.9%

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

Alternative 11: 49.5% accurate, 14.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+69}:\\
\;\;\;\;-z\\

\mathbf{elif}\;z \leq 1.4 \cdot 10^{+35}:\\
\;\;\;\;-y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.5000000000000001e69 or 1.39999999999999999e35 < 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 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.f6464.5

        \[\leadsto -z \]
    5. Applied rewrites64.5%

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

    if -6.5000000000000001e69 < z < 1.39999999999999999e35

    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 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.f6438.6

        \[\leadsto -y \]
    5. Applied rewrites38.6%

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

Alternative 12: 30.0% 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.f6430.0

      \[\leadsto -y \]
  5. Applied rewrites30.0%

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

Reproduce

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