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

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

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

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

    \[\leadsto \color{blue}{z \cdot \left(\left(\frac{\log t}{z} + \frac{x \cdot \log y}{z}\right) - \left(1 + \frac{y}{z}\right)\right)} \]
  4. Step-by-step derivation
    1. Applied rewrites78.8%

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

      \[\leadsto -1 \cdot y + \color{blue}{z \cdot \left(\left(\frac{\log t}{z} + \frac{x \cdot \log y}{z}\right) - 1\right)} \]
    3. Step-by-step derivation
      1. Applied rewrites83.9%

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

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

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

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

        Alternative 2: 79.2% accurate, 0.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y - y\\ \mathbf{if}\;t\_1 \leq -500:\\ \;\;\;\;\mathsf{fma}\left(-1, z, -y\right)\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+85}:\\ \;\;\;\;\left(-z\right) + \log t\\ \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 -500.0)
             (fma -1.0 z (- y))
             (if (<= t_1 4e+85) (+ (- z) (log t)) (* (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 <= -500.0) {
        		tmp = fma(-1.0, z, -y);
        	} else if (t_1 <= 4e+85) {
        		tmp = -z + log(t);
        	} else {
        		tmp = 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 <= -500.0)
        		tmp = fma(-1.0, z, Float64(-y));
        	elseif (t_1 <= 4e+85)
        		tmp = Float64(Float64(-z) + log(t));
        	else
        		tmp = Float64(log(y) * x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t$95$1, -500.0], N[(-1.0 * z + (-y)), $MachinePrecision], If[LessEqual[t$95$1, 4e+85], N[((-z) + N[Log[t], $MachinePrecision]), $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 -500:\\
        \;\;\;\;\mathsf{fma}\left(-1, z, -y\right)\\
        
        \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+85}:\\
        \;\;\;\;\left(-z\right) + \log t\\
        
        \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) < -500

          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}{z \cdot \left(\left(\frac{\log t}{z} + \frac{x \cdot \log y}{z}\right) - \left(1 + \frac{y}{z}\right)\right)} \]
          4. Step-by-step derivation
            1. Applied rewrites77.0%

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

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

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

                \[\leadsto \mathsf{fma}\left(-1, z, -y\right) \]
              3. Step-by-step derivation
                1. Applied rewrites72.4%

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

                if -500 < (-.f64 (*.f64 x (log.f64 y)) y) < 4.0000000000000001e85

                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} + \log t \]
                4. Step-by-step derivation
                  1. Applied rewrites93.0%

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

                  if 4.0000000000000001e85 < (-.f64 (*.f64 x (log.f64 y)) y)

                  1. Initial program 99.6%

                    \[\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. Applied rewrites83.1%

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

                  Alternative 3: 99.3% accurate, 1.0× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -720 \lor \neg \left(z \leq 11.8\right):\\ \;\;\;\;\left(\frac{\log y \cdot x - y}{z} - 1\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - y\\ \end{array} \end{array} \]
                  (FPCore (x y z t)
                   :precision binary64
                   (if (or (<= z -720.0) (not (<= z 11.8)))
                     (* (- (/ (- (* (log y) x) y) z) 1.0) z)
                     (- (fma (log y) x (log t)) y)))
                  double code(double x, double y, double z, double t) {
                  	double tmp;
                  	if ((z <= -720.0) || !(z <= 11.8)) {
                  		tmp = ((((log(y) * x) - y) / z) - 1.0) * z;
                  	} else {
                  		tmp = fma(log(y), x, log(t)) - y;
                  	}
                  	return tmp;
                  }
                  
                  function code(x, y, z, t)
                  	tmp = 0.0
                  	if ((z <= -720.0) || !(z <= 11.8))
                  		tmp = Float64(Float64(Float64(Float64(Float64(log(y) * x) - y) / z) - 1.0) * z);
                  	else
                  		tmp = Float64(fma(log(y), x, log(t)) - y);
                  	end
                  	return tmp
                  end
                  
                  code[x_, y_, z_, t_] := If[Or[LessEqual[z, -720.0], N[Not[LessEqual[z, 11.8]], $MachinePrecision]], N[(N[(N[(N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - y), $MachinePrecision] / z), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;z \leq -720 \lor \neg \left(z \leq 11.8\right):\\
                  \;\;\;\;\left(\frac{\log y \cdot x - y}{z} - 1\right) \cdot z\\
                  
                  \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 z < -720 or 11.800000000000001 < 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}{z \cdot \left(\left(\frac{\log t}{z} + \frac{x \cdot \log y}{z}\right) - \left(1 + \frac{y}{z}\right)\right)} \]
                    4. Step-by-step derivation
                      1. Applied rewrites99.8%

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

                        \[\leadsto \left(\frac{x \cdot \log y - y}{z} - 1\right) \cdot z \]
                      3. Step-by-step derivation
                        1. Applied rewrites98.8%

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

                        if -720 < z < 11.800000000000001

                        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. Applied rewrites99.3%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \log t\right) - y} \]
                        5. Recombined 2 regimes into one program.
                        6. Final simplification99.1%

                          \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -720 \lor \neg \left(z \leq 11.8\right):\\ \;\;\;\;\left(\frac{\log y \cdot x - y}{z} - 1\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - y\\ \end{array} \]
                        7. Add Preprocessing

                        Alternative 4: 89.0% accurate, 1.4× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \log y \cdot x\\ t_2 := \left(\frac{t\_1 - y}{z} - 1\right) \cdot z\\ \mathbf{if}\;x \leq -3 \cdot 10^{+167}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -20500000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-7}:\\ \;\;\;\;\left(\log t - z\right) - y\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+211}:\\ \;\;\;\;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 (* (- (/ (- t_1 y) z) 1.0) z)))
                           (if (<= x -3e+167)
                             t_1
                             (if (<= x -20500000.0)
                               t_2
                               (if (<= x 5.8e-7) (- (- (log t) z) y) (if (<= x 9.5e+211) t_2 t_1))))))
                        double code(double x, double y, double z, double t) {
                        	double t_1 = log(y) * x;
                        	double t_2 = (((t_1 - y) / z) - 1.0) * z;
                        	double tmp;
                        	if (x <= -3e+167) {
                        		tmp = t_1;
                        	} else if (x <= -20500000.0) {
                        		tmp = t_2;
                        	} else if (x <= 5.8e-7) {
                        		tmp = (log(t) - z) - y;
                        	} else if (x <= 9.5e+211) {
                        		tmp = t_2;
                        	} 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) :: t_2
                            real(8) :: tmp
                            t_1 = log(y) * x
                            t_2 = (((t_1 - y) / z) - 1.0d0) * z
                            if (x <= (-3d+167)) then
                                tmp = t_1
                            else if (x <= (-20500000.0d0)) then
                                tmp = t_2
                            else if (x <= 5.8d-7) then
                                tmp = (log(t) - z) - y
                            else if (x <= 9.5d+211) then
                                tmp = t_2
                            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 t_2 = (((t_1 - y) / z) - 1.0) * z;
                        	double tmp;
                        	if (x <= -3e+167) {
                        		tmp = t_1;
                        	} else if (x <= -20500000.0) {
                        		tmp = t_2;
                        	} else if (x <= 5.8e-7) {
                        		tmp = (Math.log(t) - z) - y;
                        	} else if (x <= 9.5e+211) {
                        		tmp = t_2;
                        	} else {
                        		tmp = t_1;
                        	}
                        	return tmp;
                        }
                        
                        def code(x, y, z, t):
                        	t_1 = math.log(y) * x
                        	t_2 = (((t_1 - y) / z) - 1.0) * z
                        	tmp = 0
                        	if x <= -3e+167:
                        		tmp = t_1
                        	elif x <= -20500000.0:
                        		tmp = t_2
                        	elif x <= 5.8e-7:
                        		tmp = (math.log(t) - z) - y
                        	elif x <= 9.5e+211:
                        		tmp = t_2
                        	else:
                        		tmp = t_1
                        	return tmp
                        
                        function code(x, y, z, t)
                        	t_1 = Float64(log(y) * x)
                        	t_2 = Float64(Float64(Float64(Float64(t_1 - y) / z) - 1.0) * z)
                        	tmp = 0.0
                        	if (x <= -3e+167)
                        		tmp = t_1;
                        	elseif (x <= -20500000.0)
                        		tmp = t_2;
                        	elseif (x <= 5.8e-7)
                        		tmp = Float64(Float64(log(t) - z) - y);
                        	elseif (x <= 9.5e+211)
                        		tmp = t_2;
                        	else
                        		tmp = t_1;
                        	end
                        	return tmp
                        end
                        
                        function tmp_2 = code(x, y, z, t)
                        	t_1 = log(y) * x;
                        	t_2 = (((t_1 - y) / z) - 1.0) * z;
                        	tmp = 0.0;
                        	if (x <= -3e+167)
                        		tmp = t_1;
                        	elseif (x <= -20500000.0)
                        		tmp = t_2;
                        	elseif (x <= 5.8e-7)
                        		tmp = (log(t) - z) - y;
                        	elseif (x <= 9.5e+211)
                        		tmp = t_2;
                        	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]}, Block[{t$95$2 = N[(N[(N[(N[(t$95$1 - y), $MachinePrecision] / z), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -3e+167], t$95$1, If[LessEqual[x, -20500000.0], t$95$2, If[LessEqual[x, 5.8e-7], N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, 9.5e+211], t$95$2, t$95$1]]]]]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        t_1 := \log y \cdot x\\
                        t_2 := \left(\frac{t\_1 - y}{z} - 1\right) \cdot z\\
                        \mathbf{if}\;x \leq -3 \cdot 10^{+167}:\\
                        \;\;\;\;t\_1\\
                        
                        \mathbf{elif}\;x \leq -20500000:\\
                        \;\;\;\;t\_2\\
                        
                        \mathbf{elif}\;x \leq 5.8 \cdot 10^{-7}:\\
                        \;\;\;\;\left(\log t - z\right) - y\\
                        
                        \mathbf{elif}\;x \leq 9.5 \cdot 10^{+211}:\\
                        \;\;\;\;t\_2\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;t\_1\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 3 regimes
                        2. if x < -3.00000000000000012e167 or 9.4999999999999997e211 < 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. Applied rewrites85.7%

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

                            if -3.00000000000000012e167 < x < -2.05e7 or 5.7999999999999995e-7 < x < 9.4999999999999997e211

                            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}{z \cdot \left(\left(\frac{\log t}{z} + \frac{x \cdot \log y}{z}\right) - \left(1 + \frac{y}{z}\right)\right)} \]
                            4. Step-by-step derivation
                              1. Applied rewrites82.8%

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

                                \[\leadsto \left(\frac{x \cdot \log y - y}{z} - 1\right) \cdot z \]
                              3. Step-by-step derivation
                                1. Applied rewrites81.5%

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

                                if -2.05e7 < x < 5.7999999999999995e-7

                                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. Applied rewrites99.2%

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

                                Alternative 5: 67.9% accurate, 1.7× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} t_1 := \log y \cdot x\\ t_2 := \mathsf{fma}\left(-1, z, -y\right)\\ \mathbf{if}\;x \leq -4.4 \cdot 10^{+164}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{-100}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq -7.5 \cdot 10^{-285}:\\ \;\;\;\;\left(-y\right) + \log t\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+161}:\\ \;\;\;\;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 -1.0 z (- y))))
                                   (if (<= x -4.4e+164)
                                     t_1
                                     (if (<= x -2.8e-100)
                                       t_2
                                       (if (<= x -7.5e-285) (+ (- y) (log t)) (if (<= x 9.5e+161) t_2 t_1))))))
                                double code(double x, double y, double z, double t) {
                                	double t_1 = log(y) * x;
                                	double t_2 = fma(-1.0, z, -y);
                                	double tmp;
                                	if (x <= -4.4e+164) {
                                		tmp = t_1;
                                	} else if (x <= -2.8e-100) {
                                		tmp = t_2;
                                	} else if (x <= -7.5e-285) {
                                		tmp = -y + log(t);
                                	} else if (x <= 9.5e+161) {
                                		tmp = t_2;
                                	} else {
                                		tmp = t_1;
                                	}
                                	return tmp;
                                }
                                
                                function code(x, y, z, t)
                                	t_1 = Float64(log(y) * x)
                                	t_2 = fma(-1.0, z, Float64(-y))
                                	tmp = 0.0
                                	if (x <= -4.4e+164)
                                		tmp = t_1;
                                	elseif (x <= -2.8e-100)
                                		tmp = t_2;
                                	elseif (x <= -7.5e-285)
                                		tmp = Float64(Float64(-y) + log(t));
                                	elseif (x <= 9.5e+161)
                                		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[(-1.0 * z + (-y)), $MachinePrecision]}, If[LessEqual[x, -4.4e+164], t$95$1, If[LessEqual[x, -2.8e-100], t$95$2, If[LessEqual[x, -7.5e-285], N[((-y) + N[Log[t], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.5e+161], t$95$2, t$95$1]]]]]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                t_1 := \log y \cdot x\\
                                t_2 := \mathsf{fma}\left(-1, z, -y\right)\\
                                \mathbf{if}\;x \leq -4.4 \cdot 10^{+164}:\\
                                \;\;\;\;t\_1\\
                                
                                \mathbf{elif}\;x \leq -2.8 \cdot 10^{-100}:\\
                                \;\;\;\;t\_2\\
                                
                                \mathbf{elif}\;x \leq -7.5 \cdot 10^{-285}:\\
                                \;\;\;\;\left(-y\right) + \log t\\
                                
                                \mathbf{elif}\;x \leq 9.5 \cdot 10^{+161}:\\
                                \;\;\;\;t\_2\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;t\_1\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 3 regimes
                                2. if x < -4.40000000000000011e164 or 9.50000000000000061e161 < 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. Applied rewrites85.0%

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

                                    if -4.40000000000000011e164 < x < -2.79999999999999995e-100 or -7.4999999999999999e-285 < x < 9.50000000000000061e161

                                    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}{z \cdot \left(\left(\frac{\log t}{z} + \frac{x \cdot \log y}{z}\right) - \left(1 + \frac{y}{z}\right)\right)} \]
                                    4. Step-by-step derivation
                                      1. Applied rewrites85.8%

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

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

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

                                          \[\leadsto \mathsf{fma}\left(-1, z, -y\right) \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites73.9%

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

                                          if -2.79999999999999995e-100 < x < -7.4999999999999999e-285

                                          1. Initial program 100.0%

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

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

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

                                          Alternative 6: 83.2% accurate, 1.8× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.4 \cdot 10^{+164} \lor \neg \left(x \leq 9.5 \cdot 10^{+161}\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(\log t - z\right) - y\\ \end{array} \end{array} \]
                                          (FPCore (x y z t)
                                           :precision binary64
                                           (if (or (<= x -4.4e+164) (not (<= x 9.5e+161)))
                                             (* (log y) x)
                                             (- (- (log t) z) y)))
                                          double code(double x, double y, double z, double t) {
                                          	double tmp;
                                          	if ((x <= -4.4e+164) || !(x <= 9.5e+161)) {
                                          		tmp = log(y) * x;
                                          	} else {
                                          		tmp = (log(t) - z) - 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 ((x <= (-4.4d+164)) .or. (.not. (x <= 9.5d+161))) then
                                                  tmp = log(y) * x
                                              else
                                                  tmp = (log(t) - z) - y
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double x, double y, double z, double t) {
                                          	double tmp;
                                          	if ((x <= -4.4e+164) || !(x <= 9.5e+161)) {
                                          		tmp = Math.log(y) * x;
                                          	} else {
                                          		tmp = (Math.log(t) - z) - y;
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(x, y, z, t):
                                          	tmp = 0
                                          	if (x <= -4.4e+164) or not (x <= 9.5e+161):
                                          		tmp = math.log(y) * x
                                          	else:
                                          		tmp = (math.log(t) - z) - y
                                          	return tmp
                                          
                                          function code(x, y, z, t)
                                          	tmp = 0.0
                                          	if ((x <= -4.4e+164) || !(x <= 9.5e+161))
                                          		tmp = Float64(log(y) * x);
                                          	else
                                          		tmp = Float64(Float64(log(t) - z) - y);
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(x, y, z, t)
                                          	tmp = 0.0;
                                          	if ((x <= -4.4e+164) || ~((x <= 9.5e+161)))
                                          		tmp = log(y) * x;
                                          	else
                                          		tmp = (log(t) - z) - y;
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.4e+164], N[Not[LessEqual[x, 9.5e+161]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;x \leq -4.4 \cdot 10^{+164} \lor \neg \left(x \leq 9.5 \cdot 10^{+161}\right):\\
                                          \;\;\;\;\log y \cdot x\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\left(\log t - z\right) - y\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if x < -4.40000000000000011e164 or 9.50000000000000061e161 < 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. Applied rewrites85.0%

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

                                              if -4.40000000000000011e164 < x < 9.50000000000000061e161

                                              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. Applied rewrites86.7%

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

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

                                              Alternative 7: 70.0% accurate, 1.8× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.4 \cdot 10^{+164} \lor \neg \left(x \leq 9.5 \cdot 10^{+161}\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-1, z, -y\right)\\ \end{array} \end{array} \]
                                              (FPCore (x y z t)
                                               :precision binary64
                                               (if (or (<= x -4.4e+164) (not (<= x 9.5e+161)))
                                                 (* (log y) x)
                                                 (fma -1.0 z (- y))))
                                              double code(double x, double y, double z, double t) {
                                              	double tmp;
                                              	if ((x <= -4.4e+164) || !(x <= 9.5e+161)) {
                                              		tmp = log(y) * x;
                                              	} else {
                                              		tmp = fma(-1.0, z, -y);
                                              	}
                                              	return tmp;
                                              }
                                              
                                              function code(x, y, z, t)
                                              	tmp = 0.0
                                              	if ((x <= -4.4e+164) || !(x <= 9.5e+161))
                                              		tmp = Float64(log(y) * x);
                                              	else
                                              		tmp = fma(-1.0, z, Float64(-y));
                                              	end
                                              	return tmp
                                              end
                                              
                                              code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.4e+164], N[Not[LessEqual[x, 9.5e+161]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[(-1.0 * z + (-y)), $MachinePrecision]]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \begin{array}{l}
                                              \mathbf{if}\;x \leq -4.4 \cdot 10^{+164} \lor \neg \left(x \leq 9.5 \cdot 10^{+161}\right):\\
                                              \;\;\;\;\log y \cdot x\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;\mathsf{fma}\left(-1, z, -y\right)\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 2 regimes
                                              2. if x < -4.40000000000000011e164 or 9.50000000000000061e161 < 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. Applied rewrites85.0%

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

                                                  if -4.40000000000000011e164 < x < 9.50000000000000061e161

                                                  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}{z \cdot \left(\left(\frac{\log t}{z} + \frac{x \cdot \log y}{z}\right) - \left(1 + \frac{y}{z}\right)\right)} \]
                                                  4. Step-by-step derivation
                                                    1. Applied rewrites86.2%

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

                                                      \[\leadsto -1 \cdot y + \color{blue}{z \cdot \left(\left(\frac{\log t}{z} + \frac{x \cdot \log y}{z}\right) - 1\right)} \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites93.2%

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

                                                        \[\leadsto \mathsf{fma}\left(-1, z, -y\right) \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites71.9%

                                                          \[\leadsto \mathsf{fma}\left(-1, z, -y\right) \]
                                                      4. Recombined 2 regimes into one program.
                                                      5. Final simplification75.5%

                                                        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.4 \cdot 10^{+164} \lor \neg \left(x \leq 9.5 \cdot 10^{+161}\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-1, z, -y\right)\\ \end{array} \]
                                                      6. Add Preprocessing

                                                      Alternative 8: 46.3% accurate, 23.8× speedup?

                                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.32 \cdot 10^{+109}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \end{array} \]
                                                      (FPCore (x y z t) :precision binary64 (if (<= y 1.32e+109) (- z) (- y)))
                                                      double code(double x, double y, double z, double t) {
                                                      	double tmp;
                                                      	if (y <= 1.32e+109) {
                                                      		tmp = -z;
                                                      	} else {
                                                      		tmp = -y;
                                                      	}
                                                      	return tmp;
                                                      }
                                                      
                                                      module fmin_fmax_functions
                                                          implicit none
                                                          private
                                                          public fmax
                                                          public fmin
                                                      
                                                          interface fmax
                                                              module procedure fmax88
                                                              module procedure fmax44
                                                              module procedure fmax84
                                                              module procedure fmax48
                                                          end interface
                                                          interface fmin
                                                              module procedure fmin88
                                                              module procedure fmin44
                                                              module procedure fmin84
                                                              module procedure fmin48
                                                          end interface
                                                      contains
                                                          real(8) function fmax88(x, y) result (res)
                                                              real(8), intent (in) :: x
                                                              real(8), intent (in) :: y
                                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                          end function
                                                          real(4) function fmax44(x, y) result (res)
                                                              real(4), intent (in) :: x
                                                              real(4), intent (in) :: y
                                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                          end function
                                                          real(8) function fmax84(x, y) result(res)
                                                              real(8), intent (in) :: x
                                                              real(4), intent (in) :: y
                                                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                          end function
                                                          real(8) function fmax48(x, y) result(res)
                                                              real(4), intent (in) :: x
                                                              real(8), intent (in) :: y
                                                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                          end function
                                                          real(8) function fmin88(x, y) result (res)
                                                              real(8), intent (in) :: x
                                                              real(8), intent (in) :: y
                                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                          end function
                                                          real(4) function fmin44(x, y) result (res)
                                                              real(4), intent (in) :: x
                                                              real(4), intent (in) :: y
                                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                          end function
                                                          real(8) function fmin84(x, y) result(res)
                                                              real(8), intent (in) :: x
                                                              real(4), intent (in) :: y
                                                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                          end function
                                                          real(8) function fmin48(x, y) result(res)
                                                              real(4), intent (in) :: x
                                                              real(8), intent (in) :: y
                                                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                          end function
                                                      end module
                                                      
                                                      real(8) function code(x, y, z, t)
                                                      use fmin_fmax_functions
                                                          real(8), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          real(8), intent (in) :: z
                                                          real(8), intent (in) :: t
                                                          real(8) :: tmp
                                                          if (y <= 1.32d+109) then
                                                              tmp = -z
                                                          else
                                                              tmp = -y
                                                          end if
                                                          code = tmp
                                                      end function
                                                      
                                                      public static double code(double x, double y, double z, double t) {
                                                      	double tmp;
                                                      	if (y <= 1.32e+109) {
                                                      		tmp = -z;
                                                      	} else {
                                                      		tmp = -y;
                                                      	}
                                                      	return tmp;
                                                      }
                                                      
                                                      def code(x, y, z, t):
                                                      	tmp = 0
                                                      	if y <= 1.32e+109:
                                                      		tmp = -z
                                                      	else:
                                                      		tmp = -y
                                                      	return tmp
                                                      
                                                      function code(x, y, z, t)
                                                      	tmp = 0.0
                                                      	if (y <= 1.32e+109)
                                                      		tmp = Float64(-z);
                                                      	else
                                                      		tmp = Float64(-y);
                                                      	end
                                                      	return tmp
                                                      end
                                                      
                                                      function tmp_2 = code(x, y, z, t)
                                                      	tmp = 0.0;
                                                      	if (y <= 1.32e+109)
                                                      		tmp = -z;
                                                      	else
                                                      		tmp = -y;
                                                      	end
                                                      	tmp_2 = tmp;
                                                      end
                                                      
                                                      code[x_, y_, z_, t_] := If[LessEqual[y, 1.32e+109], (-z), (-y)]
                                                      
                                                      \begin{array}{l}
                                                      
                                                      \\
                                                      \begin{array}{l}
                                                      \mathbf{if}\;y \leq 1.32 \cdot 10^{+109}:\\
                                                      \;\;\;\;-z\\
                                                      
                                                      \mathbf{else}:\\
                                                      \;\;\;\;-y\\
                                                      
                                                      
                                                      \end{array}
                                                      \end{array}
                                                      
                                                      Derivation
                                                      1. Split input into 2 regimes
                                                      2. if y < 1.32000000000000008e109

                                                        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. Applied rewrites40.5%

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

                                                          if 1.32000000000000008e109 < 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 y around inf

                                                            \[\leadsto \color{blue}{-1 \cdot y} \]
                                                          4. Step-by-step derivation
                                                            1. Applied rewrites66.9%

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

                                                          Alternative 9: 57.0% accurate, 23.9× speedup?

                                                          \[\begin{array}{l} \\ \mathsf{fma}\left(-1, z, -y\right) \end{array} \]
                                                          (FPCore (x y z t) :precision binary64 (fma -1.0 z (- y)))
                                                          double code(double x, double y, double z, double t) {
                                                          	return fma(-1.0, z, -y);
                                                          }
                                                          
                                                          function code(x, y, z, t)
                                                          	return fma(-1.0, z, Float64(-y))
                                                          end
                                                          
                                                          code[x_, y_, z_, t_] := N[(-1.0 * z + (-y)), $MachinePrecision]
                                                          
                                                          \begin{array}{l}
                                                          
                                                          \\
                                                          \mathsf{fma}\left(-1, z, -y\right)
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Initial program 99.9%

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

                                                            \[\leadsto \color{blue}{z \cdot \left(\left(\frac{\log t}{z} + \frac{x \cdot \log y}{z}\right) - \left(1 + \frac{y}{z}\right)\right)} \]
                                                          4. Step-by-step derivation
                                                            1. Applied rewrites78.8%

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

                                                              \[\leadsto -1 \cdot y + \color{blue}{z \cdot \left(\left(\frac{\log t}{z} + \frac{x \cdot \log y}{z}\right) - 1\right)} \]
                                                            3. Step-by-step derivation
                                                              1. Applied rewrites83.9%

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

                                                                \[\leadsto \mathsf{fma}\left(-1, z, -y\right) \]
                                                              3. Step-by-step derivation
                                                                1. Applied rewrites56.7%

                                                                  \[\leadsto \mathsf{fma}\left(-1, z, -y\right) \]
                                                                2. Add Preprocessing

                                                                Alternative 10: 29.3% 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. Applied rewrites28.1%

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

                                                                  Reproduce

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