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

Percentage Accurate: 89.5% → 99.8%
Time: 12.3s
Alternatives: 18
Speedup: 1.9×

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 18 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.8% accurate, 0.7× speedup?

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

\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left(\left(-y\right) \cdot y\right) - \mathsf{log1p}\left(y\right)\right)\right) - t
\end{array}
Derivation
  1. Initial program 91.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. Step-by-step derivation
    1. lift-log.f64N/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\left(-y\right)} \cdot y\right) - \log \left(1 + y\right)\right)\right) - t \]
    11. lower-log1p.f6499.8

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

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \color{blue}{\left(\mathsf{log1p}\left(\left(-y\right) \cdot y\right) - \mathsf{log1p}\left(y\right)\right)}\right) - t \]
  5. Add Preprocessing

Alternative 2: 57.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t\\ \mathbf{if}\;t\_1 \leq 45 \lor \neg \left(t\_1 \leq 1000\right):\\ \;\;\;\;\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t\\ \mathbf{else}:\\ \;\;\;\;-\log y\\ \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)))) t)))
   (if (or (<= t_1 45.0) (not (<= t_1 1000.0)))
     (-
      (* (* (- (* (fma (fma -0.25 y -0.3333333333333333) y -0.5) y) 1.0) y) z)
      t)
     (- (log y)))))
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)))) - t;
	double tmp;
	if ((t_1 <= 45.0) || !(t_1 <= 1000.0)) {
		tmp = ((((fma(fma(-0.25, y, -0.3333333333333333), y, -0.5) * y) - 1.0) * y) * z) - t;
	} else {
		tmp = -log(y);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t)
	tmp = 0.0
	if ((t_1 <= 45.0) || !(t_1 <= 1000.0))
		tmp = Float64(Float64(Float64(Float64(Float64(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5) * y) - 1.0) * y) * z) - t);
	else
		tmp = Float64(-log(y));
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = 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]}, If[Or[LessEqual[t$95$1, 45.0], N[Not[LessEqual[t$95$1, 1000.0]], $MachinePrecision]], N[(N[(N[(N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * y + -0.5), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision], (-N[Log[y], $MachinePrecision])]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t\\
\mathbf{if}\;t\_1 \leq 45 \lor \neg \left(t\_1 \leq 1000\right):\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (+.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)))) t) < 45 or 1e3 < (-.f64 (+.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)))) t)

    1. Initial program 93.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. 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 \]
      2. Taylor expanded in z around inf

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

          \[\leadsto \color{blue}{\mathsf{log1p}\left(-y\right) \cdot z} - t \]
        2. Taylor expanded in y around 0

          \[\leadsto \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) \cdot z - t \]
        3. Applied rewrites53.8%

          \[\leadsto \left(\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t \]

        if 45 < (-.f64 (+.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)))) t) < 1e3

        1. Initial program 86.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 y around 0

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

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

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

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

              \[\leadsto -1 \cdot \log y \]
            3. Step-by-step derivation
              1. Applied rewrites84.8%

                \[\leadsto -\log y \]
            4. Recombined 2 regimes into one program.
            5. Final simplification62.5%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \leq 45 \lor \neg \left(\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \leq 1000\right):\\ \;\;\;\;\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t\\ \mathbf{else}:\\ \;\;\;\;-\log y\\ \end{array} \]
            6. Add Preprocessing

            Alternative 3: 55.8% accurate, 0.7× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \leq 45:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t\\ \mathbf{else}:\\ \;\;\;\;-\left(\log y + t\right)\\ \end{array} \end{array} \]
            (FPCore (x y z t)
             :precision binary64
             (if (<= (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t) 45.0)
               (-
                (* (* (- (* (fma (fma -0.25 y -0.3333333333333333) y -0.5) y) 1.0) y) z)
                t)
               (- (+ (log y) t))))
            double code(double x, double y, double z, double t) {
            	double tmp;
            	if (((((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t) <= 45.0) {
            		tmp = ((((fma(fma(-0.25, y, -0.3333333333333333), y, -0.5) * y) - 1.0) * y) * z) - t;
            	} else {
            		tmp = -(log(y) + t);
            	}
            	return tmp;
            }
            
            function code(x, y, z, t)
            	tmp = 0.0
            	if (Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) <= 45.0)
            		tmp = Float64(Float64(Float64(Float64(Float64(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5) * y) - 1.0) * y) * z) - t);
            	else
            		tmp = Float64(-Float64(log(y) + t));
            	end
            	return tmp
            end
            
            code[x_, y_, z_, t_] := If[LessEqual[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], 45.0], N[(N[(N[(N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * y + -0.5), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision], (-N[(N[Log[y], $MachinePrecision] + t), $MachinePrecision])]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \leq 45:\\
            \;\;\;\;\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t\\
            
            \mathbf{else}:\\
            \;\;\;\;-\left(\log y + t\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (-.f64 (+.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)))) t) < 45

              1. Initial program 91.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 \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. Applied rewrites99.7%

                  \[\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 \]
                2. Taylor expanded in z around inf

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

                    \[\leadsto \color{blue}{\mathsf{log1p}\left(-y\right) \cdot z} - t \]
                  2. Taylor expanded in y around 0

                    \[\leadsto \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) \cdot z - t \]
                  3. Applied rewrites54.9%

                    \[\leadsto \left(\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t \]

                  if 45 < (-.f64 (+.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)))) t)

                  1. Initial program 91.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}{\log y \cdot \left(x - 1\right) - t} \]
                  4. Step-by-step derivation
                    1. Applied rewrites90.6%

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

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

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \leq 45:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t\\ \mathbf{else}:\\ \;\;\;\;-\left(\log y + t\right)\\ \end{array} \]
                    6. Add Preprocessing

                    Alternative 4: 99.5% accurate, 1.5× speedup?

                    \[\begin{array}{l} \\ \left(\left(x - 1\right) \cdot \log y + \left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y \cdot y, -0.5 \cdot y - 1\right) \cdot z\right) \cdot y\right) - t \end{array} \]
                    (FPCore (x y z t)
                     :precision binary64
                     (-
                      (+
                       (* (- x 1.0) (log y))
                       (*
                        (* (fma (fma -0.25 y -0.3333333333333333) (* y y) (- (* -0.5 y) 1.0)) z)
                        y))
                      t))
                    double code(double x, double y, double z, double t) {
                    	return (((x - 1.0) * log(y)) + ((fma(fma(-0.25, y, -0.3333333333333333), (y * y), ((-0.5 * y) - 1.0)) * z) * y)) - t;
                    }
                    
                    function code(x, y, z, t)
                    	return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(fma(fma(-0.25, y, -0.3333333333333333), Float64(y * y), Float64(Float64(-0.5 * y) - 1.0)) * z) * y)) - t)
                    end
                    
                    code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    \left(\left(x - 1\right) \cdot \log y + \left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y \cdot y, -0.5 \cdot y - 1\right) \cdot z\right) \cdot y\right) - t
                    \end{array}
                    
                    Derivation
                    1. Initial program 91.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. Step-by-step derivation
                      1. lift-log.f64N/A

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

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

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

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

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

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

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

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

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

                        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\left(-y\right)} \cdot y\right) - \log \left(1 + y\right)\right)\right) - t \]
                      11. lower-log1p.f6499.8

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

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

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

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

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

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

                        Alternative 5: 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 91.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. Applied rewrites99.6%

                            \[\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 \]
                          2. Add Preprocessing

                          Alternative 6: 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 91.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(\frac{-1}{3} \cdot y - \frac{1}{2}\right) - 1\right)\right)}\right) - t \]
                          4. Step-by-step derivation
                            1. Applied rewrites99.6%

                              \[\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 \]
                            2. Add Preprocessing

                            Alternative 7: 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 91.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(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. Applied rewrites99.3%

                              \[\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 \]
                            5. Add Preprocessing

                            Alternative 8: 87.1% accurate, 1.8× speedup?

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

                              1. Initial program 96.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 \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
                              4. Step-by-step derivation
                                1. Applied rewrites96.2%

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

                                  \[\leadsto \mathsf{fma}\left(\log y, x, -t\right) \]
                                3. Step-by-step derivation
                                  1. Applied rewrites96.2%

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

                                  if -2e20 < (-.f64 x #s(literal 1 binary64)) < 5e10

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

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

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

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

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

                                    Alternative 9: 99.0% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

                                        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\left(-y\right)} \cdot y\right) - \log \left(1 + y\right)\right)\right) - t \]
                                      11. lower-log1p.f6499.8

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

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

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

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

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

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

                                          \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(-1 \cdot z\right) \cdot y\right) - t \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites99.0%

                                            \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(-z\right) \cdot y\right) - t \]
                                          2. Add Preprocessing

                                          Alternative 10: 77.7% accurate, 1.9× speedup?

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

                                            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 \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. Applied rewrites99.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 \]
                                              2. Taylor expanded in z around inf

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

                                                  \[\leadsto \color{blue}{\mathsf{log1p}\left(-y\right) \cdot z} - t \]
                                                2. Taylor expanded in y around 0

                                                  \[\leadsto \left(-1 \cdot y\right) \cdot z - t \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites70.3%

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

                                                  if -4.49999999999999987e-22 < t < 1.2e6

                                                  1. Initial program 90.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}{\log y \cdot \left(x - 1\right) - t} \]
                                                  4. Step-by-step derivation
                                                    1. Applied rewrites89.0%

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

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

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

                                                      if 1.2e6 < t

                                                      1. Initial program 94.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 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. Applied rewrites99.3%

                                                          \[\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 \]
                                                        2. Taylor expanded in z around inf

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

                                                            \[\leadsto \color{blue}{\mathsf{log1p}\left(-y\right) \cdot z} - t \]
                                                          2. Taylor expanded in y around 0

                                                            \[\leadsto \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) \cdot z - t \]
                                                          3. Applied rewrites80.3%

                                                            \[\leadsto \left(\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t \]
                                                        4. Recombined 3 regimes into one program.
                                                        5. Add Preprocessing

                                                        Alternative 11: 76.4% accurate, 1.9× speedup?

                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.55 \cdot 10^{+23} \lor \neg \left(x \leq 1.05 \cdot 10^{+45}\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;-\left(\log y + t\right)\\ \end{array} \end{array} \]
                                                        (FPCore (x y z t)
                                                         :precision binary64
                                                         (if (or (<= x -2.55e+23) (not (<= x 1.05e+45)))
                                                           (* (log y) x)
                                                           (- (+ (log y) t))))
                                                        double code(double x, double y, double z, double t) {
                                                        	double tmp;
                                                        	if ((x <= -2.55e+23) || !(x <= 1.05e+45)) {
                                                        		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) :: tmp
                                                            if ((x <= (-2.55d+23)) .or. (.not. (x <= 1.05d+45))) 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 tmp;
                                                        	if ((x <= -2.55e+23) || !(x <= 1.05e+45)) {
                                                        		tmp = Math.log(y) * x;
                                                        	} else {
                                                        		tmp = -(Math.log(y) + t);
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        def code(x, y, z, t):
                                                        	tmp = 0
                                                        	if (x <= -2.55e+23) or not (x <= 1.05e+45):
                                                        		tmp = math.log(y) * x
                                                        	else:
                                                        		tmp = -(math.log(y) + t)
                                                        	return tmp
                                                        
                                                        function code(x, y, z, t)
                                                        	tmp = 0.0
                                                        	if ((x <= -2.55e+23) || !(x <= 1.05e+45))
                                                        		tmp = Float64(log(y) * x);
                                                        	else
                                                        		tmp = Float64(-Float64(log(y) + t));
                                                        	end
                                                        	return tmp
                                                        end
                                                        
                                                        function tmp_2 = code(x, y, z, t)
                                                        	tmp = 0.0;
                                                        	if ((x <= -2.55e+23) || ~((x <= 1.05e+45)))
                                                        		tmp = log(y) * x;
                                                        	else
                                                        		tmp = -(log(y) + t);
                                                        	end
                                                        	tmp_2 = tmp;
                                                        end
                                                        
                                                        code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.55e+23], N[Not[LessEqual[x, 1.05e+45]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], (-N[(N[Log[y], $MachinePrecision] + t), $MachinePrecision])]
                                                        
                                                        \begin{array}{l}
                                                        
                                                        \\
                                                        \begin{array}{l}
                                                        \mathbf{if}\;x \leq -2.55 \cdot 10^{+23} \lor \neg \left(x \leq 1.05 \cdot 10^{+45}\right):\\
                                                        \;\;\;\;\log y \cdot x\\
                                                        
                                                        \mathbf{else}:\\
                                                        \;\;\;\;-\left(\log y + t\right)\\
                                                        
                                                        
                                                        \end{array}
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Split input into 2 regimes
                                                        2. if x < -2.5500000000000001e23 or 1.04999999999999997e45 < x

                                                          1. Initial program 96.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. Applied rewrites76.1%

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

                                                            if -2.5500000000000001e23 < x < 1.04999999999999997e45

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

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

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

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

                                                                \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.55 \cdot 10^{+23} \lor \neg \left(x \leq 1.05 \cdot 10^{+45}\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;-\left(\log y + t\right)\\ \end{array} \]
                                                              6. Add Preprocessing

                                                              Alternative 12: 88.4% accurate, 2.0× speedup?

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

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

                                                                Alternative 13: 46.2% accurate, 6.6× speedup?

                                                                \[\begin{array}{l} \\ \left(\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t \end{array} \]
                                                                (FPCore (x y z t)
                                                                 :precision binary64
                                                                 (-
                                                                  (* (* (- (* (fma (fma -0.25 y -0.3333333333333333) y -0.5) y) 1.0) y) z)
                                                                  t))
                                                                double code(double x, double y, double z, double t) {
                                                                	return ((((fma(fma(-0.25, y, -0.3333333333333333), y, -0.5) * y) - 1.0) * y) * z) - t;
                                                                }
                                                                
                                                                function code(x, y, z, t)
                                                                	return Float64(Float64(Float64(Float64(Float64(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5) * y) - 1.0) * y) * z) - t)
                                                                end
                                                                
                                                                code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * y + -0.5), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]
                                                                
                                                                \begin{array}{l}
                                                                
                                                                \\
                                                                \left(\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t
                                                                \end{array}
                                                                
                                                                Derivation
                                                                1. Initial program 91.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. Applied rewrites99.6%

                                                                    \[\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 \]
                                                                  2. Taylor expanded in z around inf

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

                                                                      \[\leadsto \color{blue}{\mathsf{log1p}\left(-y\right) \cdot z} - t \]
                                                                    2. Taylor expanded in y around 0

                                                                      \[\leadsto \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) \cdot z - t \]
                                                                    3. Applied rewrites42.5%

                                                                      \[\leadsto \left(\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t \]
                                                                    4. Add Preprocessing

                                                                    Alternative 14: 46.1% accurate, 8.1× speedup?

                                                                    \[\begin{array}{l} \\ \left(\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t \end{array} \]
                                                                    (FPCore (x y z t)
                                                                     :precision binary64
                                                                     (- (* (* (- (* (fma -0.3333333333333333 y -0.5) y) 1.0) y) z) t))
                                                                    double code(double x, double y, double z, double t) {
                                                                    	return ((((fma(-0.3333333333333333, y, -0.5) * y) - 1.0) * y) * z) - t;
                                                                    }
                                                                    
                                                                    function code(x, y, z, t)
                                                                    	return Float64(Float64(Float64(Float64(Float64(fma(-0.3333333333333333, y, -0.5) * y) - 1.0) * y) * z) - t)
                                                                    end
                                                                    
                                                                    code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]
                                                                    
                                                                    \begin{array}{l}
                                                                    
                                                                    \\
                                                                    \left(\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right) \cdot y - 1\right) \cdot y\right) \cdot z - t
                                                                    \end{array}
                                                                    
                                                                    Derivation
                                                                    1. Initial program 91.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. Applied rewrites99.6%

                                                                        \[\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 \]
                                                                      2. Taylor expanded in z around inf

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

                                                                          \[\leadsto \color{blue}{\mathsf{log1p}\left(-y\right) \cdot z} - t \]
                                                                        2. Taylor expanded in y around 0

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

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

                                                                          Alternative 15: 46.1% accurate, 8.1× speedup?

                                                                          \[\begin{array}{l} \\ \mathsf{fma}\left(z \cdot \mathsf{fma}\left(-0.3333333333333333, y, -0.5\right), y, -z\right) \cdot y - t \end{array} \]
                                                                          (FPCore (x y z t)
                                                                           :precision binary64
                                                                           (- (* (fma (* z (fma -0.3333333333333333 y -0.5)) y (- z)) y) t))
                                                                          double code(double x, double y, double z, double t) {
                                                                          	return (fma((z * fma(-0.3333333333333333, y, -0.5)), y, -z) * y) - t;
                                                                          }
                                                                          
                                                                          function code(x, y, z, t)
                                                                          	return Float64(Float64(fma(Float64(z * fma(-0.3333333333333333, y, -0.5)), y, Float64(-z)) * y) - t)
                                                                          end
                                                                          
                                                                          code[x_, y_, z_, t_] := N[(N[(N[(N[(z * N[(-0.3333333333333333 * y + -0.5), $MachinePrecision]), $MachinePrecision] * y + (-z)), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]
                                                                          
                                                                          \begin{array}{l}
                                                                          
                                                                          \\
                                                                          \mathsf{fma}\left(z \cdot \mathsf{fma}\left(-0.3333333333333333, y, -0.5\right), y, -z\right) \cdot y - t
                                                                          \end{array}
                                                                          
                                                                          Derivation
                                                                          1. Initial program 91.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. Applied rewrites99.6%

                                                                              \[\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 \]
                                                                            2. Taylor expanded in z around inf

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

                                                                                \[\leadsto \color{blue}{\mathsf{log1p}\left(-y\right) \cdot z} - t \]
                                                                              2. Taylor expanded in y around 0

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

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

                                                                                Alternative 16: 46.0% accurate, 11.3× speedup?

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

                                                                                    \[\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 \]
                                                                                  2. Taylor expanded in z around inf

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

                                                                                      \[\leadsto \color{blue}{\mathsf{log1p}\left(-y\right) \cdot z} - t \]
                                                                                    2. Taylor expanded in y around 0

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

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

                                                                                      Alternative 17: 45.8% accurate, 20.5× speedup?

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

                                                                                          \[\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 \]
                                                                                        2. Taylor expanded in z around inf

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

                                                                                            \[\leadsto \color{blue}{\mathsf{log1p}\left(-y\right) \cdot z} - t \]
                                                                                          2. Taylor expanded in y around 0

                                                                                            \[\leadsto \left(-1 \cdot y\right) \cdot z - t \]
                                                                                          3. Step-by-step derivation
                                                                                            1. Applied rewrites42.0%

                                                                                              \[\leadsto \left(-y\right) \cdot z - t \]
                                                                                            2. Add Preprocessing

                                                                                            Alternative 18: 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 91.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. Applied rewrites33.9%

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

                                                                                              Reproduce

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