Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2

Percentage Accurate: 89.5% → 99.6%
Time: 10.0s
Alternatives: 16
Speedup: 1.8×

Specification

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

\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - 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 16 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: 89.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right), y, -1\right) \cdot y\right)\right) - t \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (-
  (+
   (* (- x 1.0) (log y))
   (*
    (- z 1.0)
    (* (fma (fma (fma -0.25 y -0.3333333333333333) y -0.5) y -1.0) y)))
  t))
double code(double x, double y, double z, double t) {
	return (((x - 1.0) * log(y)) + ((z - 1.0) * (fma(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5), y, -1.0) * y))) - t;
}
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * Float64(fma(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5), y, -1.0) * y))) - t)
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * y + -0.5), $MachinePrecision] * y + -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right), y, -1\right) \cdot y\right)\right) - t
\end{array}
Derivation
  1. Initial program 89.1%

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

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

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

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

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

Alternative 2: 75.2% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := \left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\\
\mathbf{if}\;t\_1 \leq -1.25 \cdot 10^{+77} \lor \neg \left(t\_1 \leq 10^{+67}\right):\\
\;\;\;\;\log y \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -1.25000000000000001e77 or 9.99999999999999983e66 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y))))

    1. Initial program 95.8%

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

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

        \[\leadsto \color{blue}{\log y \cdot x} \]
      2. remove-double-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y\right)\right)\right)\right)} \cdot x \]
      3. log-recN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\log \left(\frac{1}{y}\right)}\right)\right) \cdot x \]
      4. mul-1-negN/A

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

        \[\leadsto \color{blue}{\left(-1 \cdot \log \left(\frac{1}{y}\right)\right) \cdot x} \]
      6. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right)\right)\right)} \cdot x \]
      7. log-recN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right)\right) \cdot x \]
      8. remove-double-negN/A

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

        \[\leadsto \color{blue}{\log y} \cdot x \]
    5. Applied rewrites79.4%

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

    if -1.25000000000000001e77 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 9.99999999999999983e66

    1. Initial program 84.0%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)\right)\right)} - t\right) \]
      8. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(x - 1\right)}\right)\right) - t\right) \]
      9. log-recN/A

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

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

        \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right) \cdot \left(x - 1\right)\right)\right)} - t\right) \]
      12. log-recN/A

        \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} \cdot \left(x - 1\right)\right)\right) - t\right) \]
      13. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)}\right)\right) - t\right) \]
      14. remove-double-negN/A

        \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\log y \cdot \left(x - 1\right)} - t\right) \]
      15. *-rgt-identityN/A

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

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

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

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

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

        \[\leadsto \left(y + -1 \cdot \log y\right) - t \]
      3. Step-by-step derivation
        1. Applied rewrites78.9%

          \[\leadsto \left(y - \log y\right) - t \]
      4. Recombined 2 regimes into one program.
      5. Final simplification79.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right) \leq -1.25 \cdot 10^{+77} \lor \neg \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right) \leq 10^{+67}\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(y - \log y\right) - t\\ \end{array} \]
      6. Add Preprocessing

      Alternative 3: 75.2% accurate, 0.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\\ \mathbf{if}\;t\_1 \leq -1.25 \cdot 10^{+77} \lor \neg \left(t\_1 \leq 10^{+67}\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(-\log y\right) - t\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (let* ((t_1 (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y))))))
         (if (or (<= t_1 -1.25e+77) (not (<= t_1 1e+67)))
           (* (log y) x)
           (- (- (log y)) t))))
      double code(double x, double y, double z, double t) {
      	double t_1 = ((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)));
      	double tmp;
      	if ((t_1 <= -1.25e+77) || !(t_1 <= 1e+67)) {
      		tmp = log(y) * x;
      	} else {
      		tmp = -log(y) - t;
      	}
      	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 - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))
          if ((t_1 <= (-1.25d+77)) .or. (.not. (t_1 <= 1d+67))) then
              tmp = log(y) * x
          else
              tmp = -log(y) - t
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z, double t) {
      	double t_1 = ((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)));
      	double tmp;
      	if ((t_1 <= -1.25e+77) || !(t_1 <= 1e+67)) {
      		tmp = Math.log(y) * x;
      	} else {
      		tmp = -Math.log(y) - t;
      	}
      	return tmp;
      }
      
      def code(x, y, z, t):
      	t_1 = ((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))
      	tmp = 0
      	if (t_1 <= -1.25e+77) or not (t_1 <= 1e+67):
      		tmp = math.log(y) * x
      	else:
      		tmp = -math.log(y) - t
      	return tmp
      
      function code(x, y, z, t)
      	t_1 = Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y))))
      	tmp = 0.0
      	if ((t_1 <= -1.25e+77) || !(t_1 <= 1e+67))
      		tmp = Float64(log(y) * x);
      	else
      		tmp = Float64(Float64(-log(y)) - t);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z, t)
      	t_1 = ((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)));
      	tmp = 0.0;
      	if ((t_1 <= -1.25e+77) || ~((t_1 <= 1e+67)))
      		tmp = log(y) * x;
      	else
      		tmp = -log(y) - t;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1.25e+77], N[Not[LessEqual[t$95$1, 1e+67]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\\
      \mathbf{if}\;t\_1 \leq -1.25 \cdot 10^{+77} \lor \neg \left(t\_1 \leq 10^{+67}\right):\\
      \;\;\;\;\log y \cdot x\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(-\log y\right) - t\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -1.25000000000000001e77 or 9.99999999999999983e66 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y))))

        1. Initial program 95.8%

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

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

            \[\leadsto \color{blue}{\log y \cdot x} \]
          2. remove-double-negN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y\right)\right)\right)\right)} \cdot x \]
          3. log-recN/A

            \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\log \left(\frac{1}{y}\right)}\right)\right) \cdot x \]
          4. mul-1-negN/A

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

            \[\leadsto \color{blue}{\left(-1 \cdot \log \left(\frac{1}{y}\right)\right) \cdot x} \]
          6. mul-1-negN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right)\right)\right)} \cdot x \]
          7. log-recN/A

            \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right)\right) \cdot x \]
          8. remove-double-negN/A

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

            \[\leadsto \color{blue}{\log y} \cdot x \]
        5. Applied rewrites79.4%

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

        if -1.25000000000000001e77 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 9.99999999999999983e66

        1. Initial program 84.0%

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

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

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y\right)\right)\right)\right)} \cdot \left(x - 1\right) - t \]
          2. log-recN/A

            \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\log \left(\frac{1}{y}\right)}\right)\right) \cdot \left(x - 1\right) - t \]
          3. mul-1-negN/A

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

            \[\leadsto \color{blue}{\left(-1 \cdot \log \left(\frac{1}{y}\right)\right) \cdot \left(x - 1\right)} - t \]
          5. mul-1-negN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right)\right)\right)} \cdot \left(x - 1\right) - t \]
          6. log-recN/A

            \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right)\right) \cdot \left(x - 1\right) - t \]
          7. remove-double-negN/A

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

            \[\leadsto \color{blue}{\log y} \cdot \left(x - 1\right) - t \]
          9. lower--.f6483.4

            \[\leadsto \log y \cdot \color{blue}{\left(x - 1\right)} - t \]
        5. Applied rewrites83.4%

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

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

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

            \[\leadsto -1 \cdot \color{blue}{\log y} - t \]
          3. Step-by-step derivation
            1. Applied rewrites78.8%

              \[\leadsto \left(-\log y\right) - t \]
          4. Recombined 2 regimes into one program.
          5. Final simplification79.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right) \leq -1.25 \cdot 10^{+77} \lor \neg \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right) \leq 10^{+67}\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(-\log y\right) - t\\ \end{array} \]
          6. Add Preprocessing

          Alternative 4: 99.6% accurate, 1.6× speedup?

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

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

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

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

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

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

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

              \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\left(\color{blue}{\left(\frac{-1}{3} \cdot y - \frac{1}{2}\right) \cdot y} + \left(\mathsf{neg}\left(-1\right)\right) \cdot -1\right) \cdot y\right)\right) - t \]
            6. metadata-evalN/A

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

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

              \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\color{blue}{\mathsf{fma}\left(\frac{-1}{3} \cdot y - \frac{1}{2}, y, -1\right)} \cdot y\right)\right) - t \]
            9. metadata-evalN/A

              \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{fma}\left(\frac{-1}{3} \cdot y - \color{blue}{\frac{1}{2} \cdot 1}, y, -1\right) \cdot y\right)\right) - t \]
            10. fp-cancel-sub-sign-invN/A

              \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{fma}\left(\color{blue}{\frac{-1}{3} \cdot y + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot 1}, y, -1\right) \cdot y\right)\right) - t \]
            11. metadata-evalN/A

              \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{fma}\left(\frac{-1}{3} \cdot y + \color{blue}{\frac{-1}{2}} \cdot 1, y, -1\right) \cdot y\right)\right) - t \]
            12. metadata-evalN/A

              \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{fma}\left(\frac{-1}{3} \cdot y + \color{blue}{\frac{-1}{2}}, y, -1\right) \cdot y\right)\right) - t \]
            13. lower-fma.f6499.1

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

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

          Alternative 5: 99.5% accurate, 1.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 6: 99.5% accurate, 1.7× speedup?

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

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

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

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

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

              \[\leadsto \left(\left(\mathsf{neg}\left(\color{blue}{\log \left(\frac{1}{y}\right)}\right)\right) \cdot \left(x - 1\right) + y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right)\right) - t \]
            4. mul-1-negN/A

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(\log \left(\frac{1}{y}\right)\right)}, x - 1, y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right)\right) - t \]
            7. log-recN/A

              \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right), x - 1, y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right)\right) - t \]
            8. remove-double-negN/A

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

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

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

              \[\leadsto \mathsf{fma}\left(\log y, x - 1, y \cdot \color{blue}{\left(\frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right) + -1 \cdot \left(z - 1\right)\right)}\right) - t \]
            12. distribute-lft-inN/A

              \[\leadsto \mathsf{fma}\left(\log y, x - 1, \color{blue}{y \cdot \left(\frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + y \cdot \left(-1 \cdot \left(z - 1\right)\right)}\right) - t \]
            13. associate-*r*N/A

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

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

              \[\leadsto \mathsf{fma}\left(\log y, x - 1, \left(\frac{-1}{2} \cdot y\right) \cdot \left(y \cdot \left(z - 1\right)\right) + y \cdot \color{blue}{\left(\mathsf{neg}\left(\left(z - 1\right)\right)\right)}\right) - t \]
            16. distribute-rgt-neg-inN/A

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

              \[\leadsto \mathsf{fma}\left(\log y, x - 1, \left(\frac{-1}{2} \cdot y\right) \cdot \left(y \cdot \left(z - 1\right)\right) + \color{blue}{-1 \cdot \left(y \cdot \left(z - 1\right)\right)}\right) - t \]
            18. distribute-rgt-outN/A

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

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

          Alternative 7: 94.8% accurate, 1.8× speedup?

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

            1. Initial program 95.0%

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

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

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y\right)\right)\right)\right)} \cdot \left(x - 1\right) - t \]
              2. log-recN/A

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\log \left(\frac{1}{y}\right)}\right)\right) \cdot \left(x - 1\right) - t \]
              3. mul-1-negN/A

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

                \[\leadsto \color{blue}{\left(-1 \cdot \log \left(\frac{1}{y}\right)\right) \cdot \left(x - 1\right)} - t \]
              5. mul-1-negN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right)\right)\right)} \cdot \left(x - 1\right) - t \]
              6. log-recN/A

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right)\right) \cdot \left(x - 1\right) - t \]
              7. remove-double-negN/A

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

                \[\leadsto \color{blue}{\log y} \cdot \left(x - 1\right) - t \]
              9. lower--.f6493.5

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

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

            if -2.1e16 < x < 2.29999999999999986e-88

            1. Initial program 79.3%

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)\right)\right)} - t\right) \]
              8. distribute-lft-neg-outN/A

                \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(x - 1\right)}\right)\right) - t\right) \]
              9. log-recN/A

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

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

                \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right) \cdot \left(x - 1\right)\right)\right)} - t\right) \]
              12. log-recN/A

                \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} \cdot \left(x - 1\right)\right)\right) - t\right) \]
              13. distribute-lft-neg-outN/A

                \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)}\right)\right) - t\right) \]
              14. remove-double-negN/A

                \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\log y \cdot \left(x - 1\right)} - t\right) \]
              15. *-rgt-identityN/A

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

                \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\log y \cdot \left(x - 1\right) + \left(\mathsf{neg}\left(t\right)\right) \cdot 1}\right) \]
            5. Applied rewrites98.9%

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

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

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

              if 2.29999999999999986e-88 < x

              1. Initial program 98.4%

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)\right)\right)} - t\right) \]
                8. distribute-lft-neg-outN/A

                  \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(x - 1\right)}\right)\right) - t\right) \]
                9. log-recN/A

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

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

                  \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right) \cdot \left(x - 1\right)\right)\right)} - t\right) \]
                12. log-recN/A

                  \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} \cdot \left(x - 1\right)\right)\right) - t\right) \]
                13. distribute-lft-neg-outN/A

                  \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)}\right)\right) - t\right) \]
                14. remove-double-negN/A

                  \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\log y \cdot \left(x - 1\right)} - t\right) \]
                15. *-rgt-identityN/A

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

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

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

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

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

              Alternative 8: 66.8% accurate, 1.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x - 1 \leq -5 \cdot 10^{+66} \lor \neg \left(x - 1 \leq 10^{+75}\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot y - t\\ \end{array} \end{array} \]
              (FPCore (x y z t)
               :precision binary64
               (if (or (<= (- x 1.0) -5e+66) (not (<= (- x 1.0) 1e+75)))
                 (* (log y) x)
                 (- (* (* (- (* -0.5 y) 1.0) z) y) t)))
              double code(double x, double y, double z, double t) {
              	double tmp;
              	if (((x - 1.0) <= -5e+66) || !((x - 1.0) <= 1e+75)) {
              		tmp = log(y) * x;
              	} else {
              		tmp = ((((-0.5 * y) - 1.0) * z) * y) - t;
              	}
              	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.0d0) <= (-5d+66)) .or. (.not. ((x - 1.0d0) <= 1d+75))) then
                      tmp = log(y) * x
                  else
                      tmp = (((((-0.5d0) * y) - 1.0d0) * z) * y) - t
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z, double t) {
              	double tmp;
              	if (((x - 1.0) <= -5e+66) || !((x - 1.0) <= 1e+75)) {
              		tmp = Math.log(y) * x;
              	} else {
              		tmp = ((((-0.5 * y) - 1.0) * z) * y) - t;
              	}
              	return tmp;
              }
              
              def code(x, y, z, t):
              	tmp = 0
              	if ((x - 1.0) <= -5e+66) or not ((x - 1.0) <= 1e+75):
              		tmp = math.log(y) * x
              	else:
              		tmp = ((((-0.5 * y) - 1.0) * z) * y) - t
              	return tmp
              
              function code(x, y, z, t)
              	tmp = 0.0
              	if ((Float64(x - 1.0) <= -5e+66) || !(Float64(x - 1.0) <= 1e+75))
              		tmp = Float64(log(y) * x);
              	else
              		tmp = Float64(Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * z) * y) - t);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z, t)
              	tmp = 0.0;
              	if (((x - 1.0) <= -5e+66) || ~(((x - 1.0) <= 1e+75)))
              		tmp = log(y) * x;
              	else
              		tmp = ((((-0.5 * y) - 1.0) * z) * y) - t;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x - 1.0), $MachinePrecision], -5e+66], N[Not[LessEqual[N[(x - 1.0), $MachinePrecision], 1e+75]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;x - 1 \leq -5 \cdot 10^{+66} \lor \neg \left(x - 1 \leq 10^{+75}\right):\\
              \;\;\;\;\log y \cdot x\\
              
              \mathbf{else}:\\
              \;\;\;\;\left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot y - t\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (-.f64 x #s(literal 1 binary64)) < -4.99999999999999991e66 or 9.99999999999999927e74 < (-.f64 x #s(literal 1 binary64))

                1. Initial program 96.0%

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

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

                    \[\leadsto \color{blue}{\log y \cdot x} \]
                  2. remove-double-negN/A

                    \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y\right)\right)\right)\right)} \cdot x \]
                  3. log-recN/A

                    \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\log \left(\frac{1}{y}\right)}\right)\right) \cdot x \]
                  4. mul-1-negN/A

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

                    \[\leadsto \color{blue}{\left(-1 \cdot \log \left(\frac{1}{y}\right)\right) \cdot x} \]
                  6. mul-1-negN/A

                    \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right)\right)\right)} \cdot x \]
                  7. log-recN/A

                    \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right)\right) \cdot x \]
                  8. remove-double-negN/A

                    \[\leadsto \color{blue}{\log y} \cdot x \]
                  9. lower-log.f6480.7

                    \[\leadsto \color{blue}{\log y} \cdot x \]
                5. Applied rewrites80.7%

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

                if -4.99999999999999991e66 < (-.f64 x #s(literal 1 binary64)) < 9.99999999999999927e74

                1. Initial program 84.1%

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto y \cdot \color{blue}{\left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
                10. Step-by-step derivation
                  1. Applied rewrites63.9%

                    \[\leadsto \left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot \color{blue}{y} - t \]
                11. Recombined 2 regimes into one program.
                12. Final simplification70.9%

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

                Alternative 9: 99.1% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)\right)\right)} - t\right) \]
                  8. distribute-lft-neg-outN/A

                    \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(x - 1\right)}\right)\right) - t\right) \]
                  9. log-recN/A

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

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

                    \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right) \cdot \left(x - 1\right)\right)\right)} - t\right) \]
                  12. log-recN/A

                    \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} \cdot \left(x - 1\right)\right)\right) - t\right) \]
                  13. distribute-lft-neg-outN/A

                    \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)}\right)\right) - t\right) \]
                  14. remove-double-negN/A

                    \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\log y \cdot \left(x - 1\right)} - t\right) \]
                  15. *-rgt-identityN/A

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

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

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

                Alternative 10: 89.0% accurate, 1.9× speedup?

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

                  1. Initial program 90.4%

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)\right)\right)} - t\right) \]
                    8. distribute-lft-neg-outN/A

                      \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(x - 1\right)}\right)\right) - t\right) \]
                    9. log-recN/A

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

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

                      \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right) \cdot \left(x - 1\right)\right)\right)} - t\right) \]
                    12. log-recN/A

                      \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} \cdot \left(x - 1\right)\right)\right) - t\right) \]
                    13. distribute-lft-neg-outN/A

                      \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)}\right)\right) - t\right) \]
                    14. remove-double-negN/A

                      \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\log y \cdot \left(x - 1\right)} - t\right) \]
                    15. *-rgt-identityN/A

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

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

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

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

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

                    if 6.10000000000000056e287 < z

                    1. Initial program 33.2%

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

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

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

                        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \color{blue}{\left(\left(y \cdot \left(y \cdot \left(\frac{-1}{4} \cdot y - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right) \cdot y\right)}\right) - t \]
                    5. Applied rewrites94.8%

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(-1 \cdot \left(z - 1\right) + y \cdot \left(\frac{-1}{2} \cdot \left(z - 1\right)\right), y, \log y \cdot \left(x - 1\right)\right)} - t \]
                    8. Applied rewrites90.6%

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

                      \[\leadsto y \cdot \color{blue}{\left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
                    10. Step-by-step derivation
                      1. Applied rewrites90.6%

                        \[\leadsto \left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot \color{blue}{y} - t \]
                    11. Recombined 2 regimes into one program.
                    12. Add Preprocessing

                    Alternative 11: 89.0% accurate, 1.9× speedup?

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

                      1. Initial program 90.4%

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

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

                          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y\right)\right)\right)\right)} \cdot \left(x - 1\right) - t \]
                        2. log-recN/A

                          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\log \left(\frac{1}{y}\right)}\right)\right) \cdot \left(x - 1\right) - t \]
                        3. mul-1-negN/A

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

                          \[\leadsto \color{blue}{\left(-1 \cdot \log \left(\frac{1}{y}\right)\right) \cdot \left(x - 1\right)} - t \]
                        5. mul-1-negN/A

                          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right)\right)\right)} \cdot \left(x - 1\right) - t \]
                        6. log-recN/A

                          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right)\right) \cdot \left(x - 1\right) - t \]
                        7. remove-double-negN/A

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

                          \[\leadsto \color{blue}{\log y} \cdot \left(x - 1\right) - t \]
                        9. lower--.f6489.4

                          \[\leadsto \log y \cdot \color{blue}{\left(x - 1\right)} - t \]
                      5. Applied rewrites89.4%

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

                      if 6.10000000000000056e287 < z

                      1. Initial program 33.2%

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

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

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

                          \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \color{blue}{\left(\left(y \cdot \left(y \cdot \left(\frac{-1}{4} \cdot y - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right) \cdot y\right)}\right) - t \]
                      5. Applied rewrites94.8%

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\mathsf{fma}\left(-1 \cdot \left(z - 1\right) + y \cdot \left(\frac{-1}{2} \cdot \left(z - 1\right)\right), y, \log y \cdot \left(x - 1\right)\right)} - t \]
                      8. Applied rewrites90.6%

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

                        \[\leadsto y \cdot \color{blue}{\left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
                      10. Step-by-step derivation
                        1. Applied rewrites90.6%

                          \[\leadsto \left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot \color{blue}{y} - t \]
                      11. Recombined 2 regimes into one program.
                      12. Add Preprocessing

                      Alternative 12: 42.8% accurate, 6.6× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{+38} \lor \neg \left(t \leq 4500000\right):\\ \;\;\;\;\left(\left(\left(z - 1\right) \cdot y\right) \cdot y\right) \cdot -0.5 - t\\ \mathbf{else}:\\ \;\;\;\;\left(-y\right) \cdot \left(z - 1\right)\\ \end{array} \end{array} \]
                      (FPCore (x y z t)
                       :precision binary64
                       (if (or (<= t -1.5e+38) (not (<= t 4500000.0)))
                         (- (* (* (* (- z 1.0) y) y) -0.5) t)
                         (* (- y) (- z 1.0))))
                      double code(double x, double y, double z, double t) {
                      	double tmp;
                      	if ((t <= -1.5e+38) || !(t <= 4500000.0)) {
                      		tmp = ((((z - 1.0) * y) * y) * -0.5) - t;
                      	} else {
                      		tmp = -y * (z - 1.0);
                      	}
                      	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 ((t <= (-1.5d+38)) .or. (.not. (t <= 4500000.0d0))) then
                              tmp = ((((z - 1.0d0) * y) * y) * (-0.5d0)) - t
                          else
                              tmp = -y * (z - 1.0d0)
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double x, double y, double z, double t) {
                      	double tmp;
                      	if ((t <= -1.5e+38) || !(t <= 4500000.0)) {
                      		tmp = ((((z - 1.0) * y) * y) * -0.5) - t;
                      	} else {
                      		tmp = -y * (z - 1.0);
                      	}
                      	return tmp;
                      }
                      
                      def code(x, y, z, t):
                      	tmp = 0
                      	if (t <= -1.5e+38) or not (t <= 4500000.0):
                      		tmp = ((((z - 1.0) * y) * y) * -0.5) - t
                      	else:
                      		tmp = -y * (z - 1.0)
                      	return tmp
                      
                      function code(x, y, z, t)
                      	tmp = 0.0
                      	if ((t <= -1.5e+38) || !(t <= 4500000.0))
                      		tmp = Float64(Float64(Float64(Float64(Float64(z - 1.0) * y) * y) * -0.5) - t);
                      	else
                      		tmp = Float64(Float64(-y) * Float64(z - 1.0));
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(x, y, z, t)
                      	tmp = 0.0;
                      	if ((t <= -1.5e+38) || ~((t <= 4500000.0)))
                      		tmp = ((((z - 1.0) * y) * y) * -0.5) - t;
                      	else
                      		tmp = -y * (z - 1.0);
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.5e+38], N[Not[LessEqual[t, 4500000.0]], $MachinePrecision]], N[(N[(N[(N[(N[(z - 1.0), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] * -0.5), $MachinePrecision] - t), $MachinePrecision], N[((-y) * N[(z - 1.0), $MachinePrecision]), $MachinePrecision]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;t \leq -1.5 \cdot 10^{+38} \lor \neg \left(t \leq 4500000\right):\\
                      \;\;\;\;\left(\left(\left(z - 1\right) \cdot y\right) \cdot y\right) \cdot -0.5 - t\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left(-y\right) \cdot \left(z - 1\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if t < -1.5000000000000001e38 or 4.5e6 < t

                        1. Initial program 96.4%

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \frac{-1}{2} \cdot \color{blue}{\left({y}^{2} \cdot \left(z - 1\right)\right)} - t \]
                        10. Step-by-step derivation
                          1. Applied rewrites73.6%

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

                          if -1.5000000000000001e38 < t < 4.5e6

                          1. Initial program 83.5%

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)\right)\right)} - t\right) \]
                            8. distribute-lft-neg-outN/A

                              \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(x - 1\right)}\right)\right) - t\right) \]
                            9. log-recN/A

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

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

                              \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right) \cdot \left(x - 1\right)\right)\right)} - t\right) \]
                            12. log-recN/A

                              \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} \cdot \left(x - 1\right)\right)\right) - t\right) \]
                            13. distribute-lft-neg-outN/A

                              \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)}\right)\right) - t\right) \]
                            14. remove-double-negN/A

                              \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\log y \cdot \left(x - 1\right)} - t\right) \]
                            15. *-rgt-identityN/A

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

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

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

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

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

                              \[\leadsto -1 \cdot \color{blue}{\left(y \cdot \left(z - 1\right)\right)} \]
                            3. Step-by-step derivation
                              1. Applied rewrites19.8%

                                \[\leadsto \left(-y\right) \cdot \color{blue}{\left(z - 1\right)} \]
                            4. Recombined 2 regimes into one program.
                            5. Final simplification43.1%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{+38} \lor \neg \left(t \leq 4500000\right):\\ \;\;\;\;\left(\left(\left(z - 1\right) \cdot y\right) \cdot y\right) \cdot -0.5 - t\\ \mathbf{else}:\\ \;\;\;\;\left(-y\right) \cdot \left(z - 1\right)\\ \end{array} \]
                            6. Add Preprocessing

                            Alternative 13: 42.8% accurate, 9.8× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{+38} \lor \neg \left(t \leq 4500000\right):\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;\left(-y\right) \cdot \left(z - 1\right)\\ \end{array} \end{array} \]
                            (FPCore (x y z t)
                             :precision binary64
                             (if (or (<= t -1.5e+38) (not (<= t 4500000.0))) (- t) (* (- y) (- z 1.0))))
                            double code(double x, double y, double z, double t) {
                            	double tmp;
                            	if ((t <= -1.5e+38) || !(t <= 4500000.0)) {
                            		tmp = -t;
                            	} else {
                            		tmp = -y * (z - 1.0);
                            	}
                            	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 ((t <= (-1.5d+38)) .or. (.not. (t <= 4500000.0d0))) then
                                    tmp = -t
                                else
                                    tmp = -y * (z - 1.0d0)
                                end if
                                code = tmp
                            end function
                            
                            public static double code(double x, double y, double z, double t) {
                            	double tmp;
                            	if ((t <= -1.5e+38) || !(t <= 4500000.0)) {
                            		tmp = -t;
                            	} else {
                            		tmp = -y * (z - 1.0);
                            	}
                            	return tmp;
                            }
                            
                            def code(x, y, z, t):
                            	tmp = 0
                            	if (t <= -1.5e+38) or not (t <= 4500000.0):
                            		tmp = -t
                            	else:
                            		tmp = -y * (z - 1.0)
                            	return tmp
                            
                            function code(x, y, z, t)
                            	tmp = 0.0
                            	if ((t <= -1.5e+38) || !(t <= 4500000.0))
                            		tmp = Float64(-t);
                            	else
                            		tmp = Float64(Float64(-y) * Float64(z - 1.0));
                            	end
                            	return tmp
                            end
                            
                            function tmp_2 = code(x, y, z, t)
                            	tmp = 0.0;
                            	if ((t <= -1.5e+38) || ~((t <= 4500000.0)))
                            		tmp = -t;
                            	else
                            		tmp = -y * (z - 1.0);
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.5e+38], N[Not[LessEqual[t, 4500000.0]], $MachinePrecision]], (-t), N[((-y) * N[(z - 1.0), $MachinePrecision]), $MachinePrecision]]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;t \leq -1.5 \cdot 10^{+38} \lor \neg \left(t \leq 4500000\right):\\
                            \;\;\;\;-t\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\left(-y\right) \cdot \left(z - 1\right)\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if t < -1.5000000000000001e38 or 4.5e6 < t

                              1. Initial program 96.4%

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

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

                                  \[\leadsto \color{blue}{\mathsf{neg}\left(t\right)} \]
                                2. lower-neg.f6473.5

                                  \[\leadsto \color{blue}{-t} \]
                              5. Applied rewrites73.5%

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

                              if -1.5000000000000001e38 < t < 4.5e6

                              1. Initial program 83.5%

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)\right)\right)} - t\right) \]
                                8. distribute-lft-neg-outN/A

                                  \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(x - 1\right)}\right)\right) - t\right) \]
                                9. log-recN/A

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

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

                                  \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right) \cdot \left(x - 1\right)\right)\right)} - t\right) \]
                                12. log-recN/A

                                  \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} \cdot \left(x - 1\right)\right)\right) - t\right) \]
                                13. distribute-lft-neg-outN/A

                                  \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)}\right)\right) - t\right) \]
                                14. remove-double-negN/A

                                  \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\log y \cdot \left(x - 1\right)} - t\right) \]
                                15. *-rgt-identityN/A

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

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

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

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

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

                                  \[\leadsto -1 \cdot \color{blue}{\left(y \cdot \left(z - 1\right)\right)} \]
                                3. Step-by-step derivation
                                  1. Applied rewrites19.8%

                                    \[\leadsto \left(-y\right) \cdot \color{blue}{\left(z - 1\right)} \]
                                4. Recombined 2 regimes into one program.
                                5. Final simplification43.1%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{+38} \lor \neg \left(t \leq 4500000\right):\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;\left(-y\right) \cdot \left(z - 1\right)\\ \end{array} \]
                                6. Add Preprocessing

                                Alternative 14: 46.0% accurate, 10.3× speedup?

                                \[\begin{array}{l} \\ \left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot y - t \end{array} \]
                                (FPCore (x y z t) :precision binary64 (- (* (* (- (* -0.5 y) 1.0) z) y) t))
                                double code(double x, double y, double z, double t) {
                                	return ((((-0.5 * y) - 1.0) * z) * y) - 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 = (((((-0.5d0) * y) - 1.0d0) * z) * y) - t
                                end function
                                
                                public static double code(double x, double y, double z, double t) {
                                	return ((((-0.5 * y) - 1.0) * z) * y) - t;
                                }
                                
                                def code(x, y, z, t):
                                	return ((((-0.5 * y) - 1.0) * z) * y) - t
                                
                                function code(x, y, z, t)
                                	return Float64(Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * z) * y) - t)
                                end
                                
                                function tmp = code(x, y, z, t)
                                	tmp = ((((-0.5 * y) - 1.0) * z) * y) - t;
                                end
                                
                                code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]
                                
                                \begin{array}{l}
                                
                                \\
                                \left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot y - t
                                \end{array}
                                
                                Derivation
                                1. Initial program 89.1%

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto y \cdot \color{blue}{\left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
                                10. Step-by-step derivation
                                  1. Applied rewrites45.6%

                                    \[\leadsto \left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot \color{blue}{y} - t \]
                                  2. Add Preprocessing

                                  Alternative 15: 42.5% accurate, 11.3× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{+38} \lor \neg \left(t \leq 4500000\right):\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) \cdot y\\ \end{array} \end{array} \]
                                  (FPCore (x y z t)
                                   :precision binary64
                                   (if (or (<= t -1.5e+38) (not (<= t 4500000.0))) (- t) (* (- z) y)))
                                  double code(double x, double y, double z, double t) {
                                  	double tmp;
                                  	if ((t <= -1.5e+38) || !(t <= 4500000.0)) {
                                  		tmp = -t;
                                  	} else {
                                  		tmp = -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 ((t <= (-1.5d+38)) .or. (.not. (t <= 4500000.0d0))) then
                                          tmp = -t
                                      else
                                          tmp = -z * y
                                      end if
                                      code = tmp
                                  end function
                                  
                                  public static double code(double x, double y, double z, double t) {
                                  	double tmp;
                                  	if ((t <= -1.5e+38) || !(t <= 4500000.0)) {
                                  		tmp = -t;
                                  	} else {
                                  		tmp = -z * y;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  def code(x, y, z, t):
                                  	tmp = 0
                                  	if (t <= -1.5e+38) or not (t <= 4500000.0):
                                  		tmp = -t
                                  	else:
                                  		tmp = -z * y
                                  	return tmp
                                  
                                  function code(x, y, z, t)
                                  	tmp = 0.0
                                  	if ((t <= -1.5e+38) || !(t <= 4500000.0))
                                  		tmp = Float64(-t);
                                  	else
                                  		tmp = Float64(Float64(-z) * y);
                                  	end
                                  	return tmp
                                  end
                                  
                                  function tmp_2 = code(x, y, z, t)
                                  	tmp = 0.0;
                                  	if ((t <= -1.5e+38) || ~((t <= 4500000.0)))
                                  		tmp = -t;
                                  	else
                                  		tmp = -z * y;
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.5e+38], N[Not[LessEqual[t, 4500000.0]], $MachinePrecision]], (-t), N[((-z) * y), $MachinePrecision]]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  \mathbf{if}\;t \leq -1.5 \cdot 10^{+38} \lor \neg \left(t \leq 4500000\right):\\
                                  \;\;\;\;-t\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\left(-z\right) \cdot y\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if t < -1.5000000000000001e38 or 4.5e6 < t

                                    1. Initial program 96.4%

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

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

                                        \[\leadsto \color{blue}{\mathsf{neg}\left(t\right)} \]
                                      2. lower-neg.f6473.5

                                        \[\leadsto \color{blue}{-t} \]
                                    5. Applied rewrites73.5%

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

                                    if -1.5000000000000001e38 < t < 4.5e6

                                    1. Initial program 83.5%

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

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

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

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

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

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

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

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

                                        \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)\right)\right)} - t\right) \]
                                      8. distribute-lft-neg-outN/A

                                        \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(x - 1\right)}\right)\right) - t\right) \]
                                      9. log-recN/A

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

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

                                        \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right) \cdot \left(x - 1\right)\right)\right)} - t\right) \]
                                      12. log-recN/A

                                        \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} \cdot \left(x - 1\right)\right)\right) - t\right) \]
                                      13. distribute-lft-neg-outN/A

                                        \[\leadsto \mathsf{fma}\left(-y, z - 1, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y \cdot \left(x - 1\right)\right)\right)}\right)\right) - t\right) \]
                                      14. remove-double-negN/A

                                        \[\leadsto \mathsf{fma}\left(-y, z - 1, \color{blue}{\log y \cdot \left(x - 1\right)} - t\right) \]
                                      15. *-rgt-identityN/A

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

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

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

                                      \[\leadsto -1 \cdot \color{blue}{\left(y \cdot z\right)} \]
                                    7. Step-by-step derivation
                                      1. Applied rewrites19.2%

                                        \[\leadsto \left(-z\right) \cdot \color{blue}{y} \]
                                    8. Recombined 2 regimes into one program.
                                    9. Final simplification42.7%

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

                                    Alternative 16: 35.7% accurate, 75.3× speedup?

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

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

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

                                        \[\leadsto \color{blue}{\mathsf{neg}\left(t\right)} \]
                                      2. lower-neg.f6434.4

                                        \[\leadsto \color{blue}{-t} \]
                                    5. Applied rewrites34.4%

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

                                    Reproduce

                                    ?
                                    herbie shell --seed 2025017 
                                    (FPCore (x y z t)
                                      :name "Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2"
                                      :precision binary64
                                      (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))