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

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

\\
\left(\mathsf{fma}\left(\log y, x, \log t\right) - z\right) - 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. Step-by-step derivation
    1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(\color{blue}{\log y \cdot x} + \log t\right) - z\right) - y \]
    14. lower-fma.f6499.9

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

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

Alternative 2: 68.9% 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^{+53}:\\ \;\;\;\;-1 \cdot y\\ \mathbf{elif}\;t\_1 \leq 2000000:\\ \;\;\;\;\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+53)
     (* -1.0 y)
     (if (<= t_1 2000000.0) (- (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+53) {
		tmp = -1.0 * y;
	} else if (t_1 <= 2000000.0) {
		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+53)) then
        tmp = (-1.0d0) * y
    else if (t_1 <= 2000000.0d0) 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+53) {
		tmp = -1.0 * y;
	} else if (t_1 <= 2000000.0) {
		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+53:
		tmp = -1.0 * y
	elif t_1 <= 2000000.0:
		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+53)
		tmp = Float64(-1.0 * y);
	elseif (t_1 <= 2000000.0)
		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+53)
		tmp = -1.0 * y;
	elseif (t_1 <= 2000000.0)
		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+53], N[(-1.0 * y), $MachinePrecision], If[LessEqual[t$95$1, 2000000.0], 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^{+53}:\\
\;\;\;\;-1 \cdot y\\

\mathbf{elif}\;t\_1 \leq 2000000:\\
\;\;\;\;\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) < -5.0000000000000004e53

    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 \color{blue}{\left(\log t + x \cdot \log y\right) - y} \]
    5. Applied rewrites86.6%

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

      \[\leadsto y \cdot \color{blue}{\left(\left(-1 \cdot \frac{x \cdot \log \left(\frac{1}{y}\right)}{y} + \frac{\log t}{y}\right) - 1\right)} \]
    7. Applied rewrites78.1%

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

      \[\leadsto -1 \cdot y \]
    9. Step-by-step derivation
      1. Applied rewrites59.9%

        \[\leadsto -1 \cdot y \]

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

      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 0

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

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

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

        \[\leadsto \log t - z \]
      7. Step-by-step derivation
        1. Applied rewrites95.2%

          \[\leadsto \log t - z \]

        if 2e6 < (-.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 0

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

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

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

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

            \[\leadsto \left(\left(x \cdot \log y - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right) - y\right) + \log t \]
          5. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

            \[\leadsto \left(\log y \cdot x + \left(-1 \cdot z - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot y\right)\right) + \log t \]
          12. fp-cancel-sign-sub-invN/A

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\mathsf{neg}\left(\left(y + z\right)\right)}\right) + \log t \]
          18. lower-neg.f64N/A

            \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{-\left(y + z\right)}\right) + \log t \]
          19. +-commutativeN/A

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

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

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

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

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

            \[\leadsto \color{blue}{\log y \cdot x} \]
          3. lower-log.f6492.2

            \[\leadsto \color{blue}{\log y} \cdot x \]
        8. Applied rewrites92.2%

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

      Alternative 3: 89.0% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+105} \lor \neg \left(x \leq 10^{+30}\right):\\ \;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - y\\ \mathbf{else}:\\ \;\;\;\;\left(\log t - y\right) - z\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (if (or (<= x -4.5e+105) (not (<= x 1e+30)))
         (- (fma (log y) x (log t)) y)
         (- (- (log t) y) z)))
      double code(double x, double y, double z, double t) {
      	double tmp;
      	if ((x <= -4.5e+105) || !(x <= 1e+30)) {
      		tmp = fma(log(y), x, log(t)) - y;
      	} else {
      		tmp = (log(t) - y) - z;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	tmp = 0.0
      	if ((x <= -4.5e+105) || !(x <= 1e+30))
      		tmp = Float64(fma(log(y), x, log(t)) - y);
      	else
      		tmp = Float64(Float64(log(t) - y) - z);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.5e+105], N[Not[LessEqual[x, 1e+30]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;x \leq -4.5 \cdot 10^{+105} \lor \neg \left(x \leq 10^{+30}\right):\\
      \;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - y\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(\log t - y\right) - z\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < -4.5000000000000001e105 or 1e30 < x

        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 \color{blue}{\left(\log t + x \cdot \log y\right) - y} \]
        5. Applied rewrites90.1%

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

        if -4.5000000000000001e105 < x < 1e30

        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 \color{blue}{\left(\log t - y\right) - z} \]
          2. *-lft-identityN/A

            \[\leadsto \left(\log t - \color{blue}{1 \cdot y}\right) - z \]
          3. metadata-evalN/A

            \[\leadsto \left(\log t - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot y\right) - z \]
          4. fp-cancel-sign-sub-invN/A

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

            \[\leadsto \color{blue}{\left(\log t + -1 \cdot y\right) - z} \]
          6. fp-cancel-sign-sub-invN/A

            \[\leadsto \color{blue}{\left(\log t - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right)} - z \]
          7. metadata-evalN/A

            \[\leadsto \left(\log t - \color{blue}{1} \cdot y\right) - z \]
          8. *-lft-identityN/A

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

            \[\leadsto \color{blue}{\left(\log t - y\right)} - z \]
          10. lower-log.f6498.6

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

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

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

      Alternative 4: 89.7% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 5.1 \cdot 10^{+48}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, \log t - z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - y\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (if (<= y 5.1e+48)
         (fma (log y) x (- (log t) z))
         (- (fma (log y) x (log t)) y)))
      double code(double x, double y, double z, double t) {
      	double tmp;
      	if (y <= 5.1e+48) {
      		tmp = fma(log(y), x, (log(t) - z));
      	} else {
      		tmp = fma(log(y), x, log(t)) - y;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	tmp = 0.0
      	if (y <= 5.1e+48)
      		tmp = fma(log(y), x, Float64(log(t) - z));
      	else
      		tmp = Float64(fma(log(y), x, log(t)) - y);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := If[LessEqual[y, 5.1e+48], N[(N[Log[y], $MachinePrecision] * x + N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq 5.1 \cdot 10^{+48}:\\
      \;\;\;\;\mathsf{fma}\left(\log y, x, \log t - z\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - y\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < 5.0999999999999998e48

        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 \color{blue}{\left(\log t + x \cdot \log y\right) - z} \]
        4. Step-by-step derivation
          1. lower--.f64N/A

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \log t\right) - z} \]
        6. Step-by-step derivation
          1. Applied rewrites98.0%

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

          if 5.0999999999999998e48 < y

          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 \color{blue}{\left(\log t + x \cdot \log y\right) - y} \]
          5. Applied rewrites87.7%

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

        Alternative 5: 89.7% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(\log y, x, \log t\right)\\ \mathbf{if}\;y \leq 5.1 \cdot 10^{+48}:\\ \;\;\;\;t\_1 - z\\ \mathbf{else}:\\ \;\;\;\;t\_1 - y\\ \end{array} \end{array} \]
        (FPCore (x y z t)
         :precision binary64
         (let* ((t_1 (fma (log y) x (log t))))
           (if (<= y 5.1e+48) (- t_1 z) (- t_1 y))))
        double code(double x, double y, double z, double t) {
        	double t_1 = fma(log(y), x, log(t));
        	double tmp;
        	if (y <= 5.1e+48) {
        		tmp = t_1 - z;
        	} else {
        		tmp = t_1 - y;
        	}
        	return tmp;
        }
        
        function code(x, y, z, t)
        	t_1 = fma(log(y), x, log(t))
        	tmp = 0.0
        	if (y <= 5.1e+48)
        		tmp = Float64(t_1 - z);
        	else
        		tmp = Float64(t_1 - y);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 5.1e+48], N[(t$95$1 - z), $MachinePrecision], N[(t$95$1 - y), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \mathsf{fma}\left(\log y, x, \log t\right)\\
        \mathbf{if}\;y \leq 5.1 \cdot 10^{+48}:\\
        \;\;\;\;t\_1 - z\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1 - y\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < 5.0999999999999998e48

          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 \color{blue}{\left(\log t + x \cdot \log y\right) - z} \]
          4. Step-by-step derivation
            1. lower--.f64N/A

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

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

          if 5.0999999999999998e48 < y

          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 \color{blue}{\left(\log t + x \cdot \log y\right) - y} \]
          5. Applied rewrites87.7%

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

        Alternative 6: 83.7% accurate, 1.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+106} \lor \neg \left(x \leq 7.2 \cdot 10^{+73}\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 -1.4e+106) (not (<= x 7.2e+73)))
           (* (log y) x)
           (- (- (log t) y) z)))
        double code(double x, double y, double z, double t) {
        	double tmp;
        	if ((x <= -1.4e+106) || !(x <= 7.2e+73)) {
        		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 <= (-1.4d+106)) .or. (.not. (x <= 7.2d+73))) 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 <= -1.4e+106) || !(x <= 7.2e+73)) {
        		tmp = Math.log(y) * x;
        	} else {
        		tmp = (Math.log(t) - y) - z;
        	}
        	return tmp;
        }
        
        def code(x, y, z, t):
        	tmp = 0
        	if (x <= -1.4e+106) or not (x <= 7.2e+73):
        		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 <= -1.4e+106) || !(x <= 7.2e+73))
        		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 <= -1.4e+106) || ~((x <= 7.2e+73)))
        		tmp = log(y) * x;
        	else
        		tmp = (log(t) - y) - z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.4e+106], N[Not[LessEqual[x, 7.2e+73]], $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 -1.4 \cdot 10^{+106} \lor \neg \left(x \leq 7.2 \cdot 10^{+73}\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 < -1.39999999999999996e106 or 7.1999999999999998e73 < x

          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}{\left(x \cdot \log y - \left(y + z\right)\right)} + \log t \]
          4. Step-by-step derivation
            1. +-commutativeN/A

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

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

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

              \[\leadsto \left(\left(x \cdot \log y - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right) - y\right) + \log t \]
            5. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

              \[\leadsto \left(\log y \cdot x + \left(-1 \cdot z - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot y\right)\right) + \log t \]
            12. fp-cancel-sign-sub-invN/A

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\mathsf{neg}\left(\left(y + z\right)\right)}\right) + \log t \]
            18. lower-neg.f64N/A

              \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{-\left(y + z\right)}\right) + \log t \]
            19. +-commutativeN/A

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

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

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

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

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

              \[\leadsto \color{blue}{\log y \cdot x} \]
            3. lower-log.f6469.8

              \[\leadsto \color{blue}{\log y} \cdot x \]
          8. Applied rewrites69.8%

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

          if -1.39999999999999996e106 < x < 7.1999999999999998e73

          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 \color{blue}{\left(\log t - y\right) - z} \]
            2. *-lft-identityN/A

              \[\leadsto \left(\log t - \color{blue}{1 \cdot y}\right) - z \]
            3. metadata-evalN/A

              \[\leadsto \left(\log t - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot y\right) - z \]
            4. fp-cancel-sign-sub-invN/A

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

              \[\leadsto \color{blue}{\left(\log t + -1 \cdot y\right) - z} \]
            6. fp-cancel-sign-sub-invN/A

              \[\leadsto \color{blue}{\left(\log t - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right)} - z \]
            7. metadata-evalN/A

              \[\leadsto \left(\log t - \color{blue}{1} \cdot y\right) - z \]
            8. *-lft-identityN/A

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

              \[\leadsto \color{blue}{\left(\log t - y\right)} - z \]
            10. lower-log.f6497.4

              \[\leadsto \left(\color{blue}{\log t} - y\right) - z \]
          5. Applied rewrites97.4%

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

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

        Alternative 7: 58.1% accurate, 1.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.8 \cdot 10^{+185} \lor \neg \left(z \leq 8.5 \cdot 10^{+120}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;\log t - y\\ \end{array} \end{array} \]
        (FPCore (x y z t)
         :precision binary64
         (if (or (<= z -5.8e+185) (not (<= z 8.5e+120))) (- z) (- (log t) y)))
        double code(double x, double y, double z, double t) {
        	double tmp;
        	if ((z <= -5.8e+185) || !(z <= 8.5e+120)) {
        		tmp = -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 <= (-5.8d+185)) .or. (.not. (z <= 8.5d+120))) then
                tmp = -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 <= -5.8e+185) || !(z <= 8.5e+120)) {
        		tmp = -z;
        	} else {
        		tmp = Math.log(t) - y;
        	}
        	return tmp;
        }
        
        def code(x, y, z, t):
        	tmp = 0
        	if (z <= -5.8e+185) or not (z <= 8.5e+120):
        		tmp = -z
        	else:
        		tmp = math.log(t) - y
        	return tmp
        
        function code(x, y, z, t)
        	tmp = 0.0
        	if ((z <= -5.8e+185) || !(z <= 8.5e+120))
        		tmp = Float64(-z);
        	else
        		tmp = Float64(log(t) - y);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z, t)
        	tmp = 0.0;
        	if ((z <= -5.8e+185) || ~((z <= 8.5e+120)))
        		tmp = -z;
        	else
        		tmp = log(t) - y;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.8e+185], N[Not[LessEqual[z, 8.5e+120]], $MachinePrecision]], (-z), N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -5.8 \cdot 10^{+185} \lor \neg \left(z \leq 8.5 \cdot 10^{+120}\right):\\
        \;\;\;\;-z\\
        
        \mathbf{else}:\\
        \;\;\;\;\log t - y\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -5.79999999999999976e185 or 8.50000000000000026e120 < 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 \color{blue}{\mathsf{neg}\left(z\right)} \]
            2. lower-neg.f6469.7

              \[\leadsto \color{blue}{-z} \]
          5. Applied rewrites69.7%

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

          if -5.79999999999999976e185 < z < 8.50000000000000026e120

          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 \color{blue}{\left(\log t + x \cdot \log y\right) - y} \]
          5. Applied rewrites93.5%

            \[\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. Applied rewrites59.9%

              \[\leadsto \log t - y \]
          8. Recombined 2 regimes into one program.
          9. Final simplification62.3%

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

          Alternative 8: 60.7% accurate, 2.0× speedup?

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

            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 \color{blue}{\left(\log t + x \cdot \log y\right) - z} \]
            4. Step-by-step derivation
              1. lower--.f64N/A

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

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

              \[\leadsto \log t - z \]
            7. Step-by-step derivation
              1. Applied rewrites58.1%

                \[\leadsto \log t - z \]

              if 5.0999999999999998e48 < y

              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 \color{blue}{\left(\log t + x \cdot \log y\right) - y} \]
              5. Applied rewrites87.7%

                \[\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. Applied rewrites70.9%

                  \[\leadsto \log t - y \]
              8. Recombined 2 regimes into one program.
              9. Add Preprocessing

              Alternative 9: 48.1% accurate, 17.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 5.1 \cdot 10^{+48}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot y\\ \end{array} \end{array} \]
              (FPCore (x y z t) :precision binary64 (if (<= y 5.1e+48) (- z) (* -1.0 y)))
              double code(double x, double y, double z, double t) {
              	double tmp;
              	if (y <= 5.1e+48) {
              		tmp = -z;
              	} else {
              		tmp = -1.0 * 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.1d+48) then
                      tmp = -z
                  else
                      tmp = (-1.0d0) * y
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z, double t) {
              	double tmp;
              	if (y <= 5.1e+48) {
              		tmp = -z;
              	} else {
              		tmp = -1.0 * y;
              	}
              	return tmp;
              }
              
              def code(x, y, z, t):
              	tmp = 0
              	if y <= 5.1e+48:
              		tmp = -z
              	else:
              		tmp = -1.0 * y
              	return tmp
              
              function code(x, y, z, t)
              	tmp = 0.0
              	if (y <= 5.1e+48)
              		tmp = Float64(-z);
              	else
              		tmp = Float64(-1.0 * y);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z, t)
              	tmp = 0.0;
              	if (y <= 5.1e+48)
              		tmp = -z;
              	else
              		tmp = -1.0 * y;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_, t_] := If[LessEqual[y, 5.1e+48], (-z), N[(-1.0 * y), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;y \leq 5.1 \cdot 10^{+48}:\\
              \;\;\;\;-z\\
              
              \mathbf{else}:\\
              \;\;\;\;-1 \cdot y\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if y < 5.0999999999999998e48

                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 \color{blue}{\mathsf{neg}\left(z\right)} \]
                  2. lower-neg.f6431.4

                    \[\leadsto \color{blue}{-z} \]
                5. Applied rewrites31.4%

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

                if 5.0999999999999998e48 < y

                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 \color{blue}{\left(\log t + x \cdot \log y\right) - y} \]
                5. Applied rewrites87.7%

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

                  \[\leadsto y \cdot \color{blue}{\left(\left(-1 \cdot \frac{x \cdot \log \left(\frac{1}{y}\right)}{y} + \frac{\log t}{y}\right) - 1\right)} \]
                7. Applied rewrites87.7%

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

                  \[\leadsto -1 \cdot y \]
                9. Step-by-step derivation
                  1. Applied rewrites70.9%

                    \[\leadsto -1 \cdot y \]
                10. Recombined 2 regimes into one program.
                11. Add Preprocessing

                Alternative 10: 29.1% accurate, 71.7× speedup?

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

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

                    \[\leadsto \color{blue}{\mathsf{neg}\left(z\right)} \]
                  2. lower-neg.f6423.6

                    \[\leadsto \color{blue}{-z} \]
                5. Applied rewrites23.6%

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

                Reproduce

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