Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.8%
Time: 8.4s
Alternatives: 15
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \end{array} \]
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
	return ((x - ((y + 0.5) * log(y))) + y) - z;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
	return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z):
	return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z)
	return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z)
end
function tmp = code(x, y, z)
	tmp = ((x - ((y + 0.5) * log(y))) + y) - z;
end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\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 15 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \end{array} \]
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
	return ((x - ((y + 0.5) * log(y))) + y) - z;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
	return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z):
	return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z)
	return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z)
end
function tmp = code(x, y, z)
	tmp = ((x - ((y + 0.5) * log(y))) + y) - z;
end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(y + x\right) - \log y \cdot \left(0.5 + y\right)\right) - z \end{array} \]
(FPCore (x y z) :precision binary64 (- (- (+ y x) (* (log y) (+ 0.5 y))) z))
double code(double x, double y, double z) {
	return ((y + x) - (log(y) * (0.5 + y))) - z;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((y + x) - (log(y) * (0.5d0 + y))) - z
end function
public static double code(double x, double y, double z) {
	return ((y + x) - (Math.log(y) * (0.5 + y))) - z;
}
def code(x, y, z):
	return ((y + x) - (math.log(y) * (0.5 + y))) - z
function code(x, y, z)
	return Float64(Float64(Float64(y + x) - Float64(log(y) * Float64(0.5 + y))) - z)
end
function tmp = code(x, y, z)
	tmp = ((y + x) - (log(y) * (0.5 + y))) - z;
end
code[x_, y_, z_] := N[(N[(N[(y + x), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * N[(0.5 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(y + x\right) - \log y \cdot \left(0.5 + y\right)\right) - z
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-+.f64N/A

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - z \]
    6. lower-+.f6499.9

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

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

      \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)}\right) - z \]
    9. lower-*.f6499.9

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

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

      \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)}\right) - z \]
    12. lower-+.f6499.9

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

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

Alternative 2: 63.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x - \left(y + 0.5\right) \cdot \log y\right) + y\\ t_1 := \left(y - x\right) \cdot \left(y - 0.5\right)\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{+140}:\\ \;\;\;\;\left(1 - \log y\right) \cdot y\\ \mathbf{elif}\;t\_0 \leq -2000000000000:\\ \;\;\;\;\frac{\left(\left(y - 0.5\right) \cdot x\right) \cdot \left(-x\right)}{t\_1} - z\\ \mathbf{elif}\;t\_0 \leq 500:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot 0.5}{t\_1} - z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ (- x (* (+ y 0.5) (log y))) y)) (t_1 (* (- y x) (- y 0.5))))
   (if (<= t_0 -5e+140)
     (* (- 1.0 (log y)) y)
     (if (<= t_0 -2000000000000.0)
       (- (/ (* (* (- y 0.5) x) (- x)) t_1) z)
       (if (<= t_0 500.0)
         (fma -0.5 (log y) (- z))
         (- (/ (* (* x x) 0.5) t_1) z))))))
double code(double x, double y, double z) {
	double t_0 = (x - ((y + 0.5) * log(y))) + y;
	double t_1 = (y - x) * (y - 0.5);
	double tmp;
	if (t_0 <= -5e+140) {
		tmp = (1.0 - log(y)) * y;
	} else if (t_0 <= -2000000000000.0) {
		tmp = ((((y - 0.5) * x) * -x) / t_1) - z;
	} else if (t_0 <= 500.0) {
		tmp = fma(-0.5, log(y), -z);
	} else {
		tmp = (((x * x) * 0.5) / t_1) - z;
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y)
	t_1 = Float64(Float64(y - x) * Float64(y - 0.5))
	tmp = 0.0
	if (t_0 <= -5e+140)
		tmp = Float64(Float64(1.0 - log(y)) * y);
	elseif (t_0 <= -2000000000000.0)
		tmp = Float64(Float64(Float64(Float64(Float64(y - 0.5) * x) * Float64(-x)) / t_1) - z);
	elseif (t_0 <= 500.0)
		tmp = fma(-0.5, log(y), Float64(-z));
	else
		tmp = Float64(Float64(Float64(Float64(x * x) * 0.5) / t_1) - z);
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(y - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+140], N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$0, -2000000000000.0], N[(N[(N[(N[(N[(y - 0.5), $MachinePrecision] * x), $MachinePrecision] * (-x)), $MachinePrecision] / t$95$1), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[t$95$0, 500.0], N[(-0.5 * N[Log[y], $MachinePrecision] + (-z)), $MachinePrecision], N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] / t$95$1), $MachinePrecision] - z), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(x - \left(y + 0.5\right) \cdot \log y\right) + y\\
t_1 := \left(y - x\right) \cdot \left(y - 0.5\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+140}:\\
\;\;\;\;\left(1 - \log y\right) \cdot y\\

\mathbf{elif}\;t\_0 \leq -2000000000000:\\
\;\;\;\;\frac{\left(\left(y - 0.5\right) \cdot x\right) \cdot \left(-x\right)}{t\_1} - z\\

\mathbf{elif}\;t\_0 \leq 500:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot x\right) \cdot 0.5}{t\_1} - z\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -5.00000000000000008e140

    1. Initial program 99.7%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(1 - \log y\right)} \cdot y \]
      7. lower-log.f6456.3

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

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

    if -5.00000000000000008e140 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -2e12

    1. Initial program 99.8%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

        \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - z \]
      6. lower-+.f6499.8

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

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

        \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)}\right) - z \]
      9. lower-*.f6499.8

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

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

        \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)}\right) - z \]
      12. lower-+.f6499.8

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{y \cdot y - x \cdot x}{y - x} + \left(\mathsf{neg}\left(\color{blue}{\log y \cdot \left(\frac{1}{2} + y\right)}\right)\right)\right) - z \]
      9. distribute-lft-neg-outN/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(y \cdot y - x \cdot x\right) \cdot \left(y - \frac{1}{2}\right) + \left(y - x\right) \cdot \left(\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(y \cdot y - \frac{1}{2} \cdot \frac{1}{2}\right)\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)}} - z \]
    6. Applied rewrites69.2%

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

      \[\leadsto \frac{\color{blue}{-1 \cdot \left({x}^{2} \cdot \left(y - \frac{1}{2}\right)\right)}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
    8. Step-by-step derivation
      1. associate-*r*N/A

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

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

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left({x}^{2}\right)\right)} \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
      4. unpow2N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{x \cdot x}\right)\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
      5. distribute-lft-neg-inN/A

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

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

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

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

        \[\leadsto \frac{\left(\color{blue}{\left(-x\right)} \cdot x\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
      10. lower--.f6456.9

        \[\leadsto \frac{\left(\left(-x\right) \cdot x\right) \cdot \color{blue}{\left(y - 0.5\right)}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
    9. Applied rewrites56.9%

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

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

      if -2e12 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 500

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

          \[\leadsto y - \mathsf{fma}\left(\color{blue}{\frac{1}{2} + y}, \log y, z\right) \]
        8. lower-log.f6499.0

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

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

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

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

        if 500 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y)

        1. Initial program 100.0%

          \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-+.f64N/A

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

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

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

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

            \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - z \]
          6. lower-+.f64100.0

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

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

            \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)}\right) - z \]
          9. lower-*.f64100.0

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

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

            \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)}\right) - z \]
          12. lower-+.f64100.0

            \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(0.5 + y\right)}\right) - z \]
        4. Applied rewrites100.0%

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

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

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

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

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

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

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

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

            \[\leadsto \left(\frac{y \cdot y - x \cdot x}{y - x} + \left(\mathsf{neg}\left(\color{blue}{\log y \cdot \left(\frac{1}{2} + y\right)}\right)\right)\right) - z \]
          9. distribute-lft-neg-outN/A

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

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

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

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

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

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

            \[\leadsto \color{blue}{\frac{\left(y \cdot y - x \cdot x\right) \cdot \left(y - \frac{1}{2}\right) + \left(y - x\right) \cdot \left(\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(y \cdot y - \frac{1}{2} \cdot \frac{1}{2}\right)\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)}} - z \]
        6. Applied rewrites43.9%

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

          \[\leadsto \frac{\color{blue}{-1 \cdot \left({x}^{2} \cdot \left(y - \frac{1}{2}\right)\right)}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
        8. Step-by-step derivation
          1. associate-*r*N/A

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

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

            \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left({x}^{2}\right)\right)} \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
          4. unpow2N/A

            \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{x \cdot x}\right)\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
          5. distribute-lft-neg-inN/A

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

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

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

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

            \[\leadsto \frac{\left(\color{blue}{\left(-x\right)} \cdot x\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
          10. lower--.f6443.9

            \[\leadsto \frac{\left(\left(-x\right) \cdot x\right) \cdot \color{blue}{\left(y - 0.5\right)}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
        9. Applied rewrites43.9%

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

          \[\leadsto \frac{\frac{1}{2} \cdot \color{blue}{{x}^{2}}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
        11. Step-by-step derivation
          1. Applied rewrites45.8%

            \[\leadsto \frac{\left(x \cdot x\right) \cdot \color{blue}{0.5}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
        12. Recombined 4 regimes into one program.
        13. Final simplification66.5%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x - \left(y + 0.5\right) \cdot \log y\right) + y \leq -5 \cdot 10^{+140}:\\ \;\;\;\;\left(1 - \log y\right) \cdot y\\ \mathbf{elif}\;\left(x - \left(y + 0.5\right) \cdot \log y\right) + y \leq -2000000000000:\\ \;\;\;\;\frac{\left(\left(y - 0.5\right) \cdot x\right) \cdot \left(-x\right)}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z\\ \mathbf{elif}\;\left(x - \left(y + 0.5\right) \cdot \log y\right) + y \leq 500:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot 0.5}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z\\ \end{array} \]
        14. Add Preprocessing

        Alternative 3: 46.6% accurate, 0.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z\\ \mathbf{if}\;t\_0 \leq -500000000:\\ \;\;\;\;\frac{\frac{\left(\left(y - 0.5\right) \cdot x\right) \cdot \left(-x\right)}{y - x}}{y - 0.5} - z\\ \mathbf{elif}\;t\_0 \leq 500:\\ \;\;\;\;-0.5 \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot 0.5}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (let* ((t_0 (- (+ (- x (* (+ y 0.5) (log y))) y) z)))
           (if (<= t_0 -500000000.0)
             (- (/ (/ (* (* (- y 0.5) x) (- x)) (- y x)) (- y 0.5)) z)
             (if (<= t_0 500.0)
               (* -0.5 (log y))
               (- (/ (* (* x x) 0.5) (* (- y x) (- y 0.5))) z)))))
        double code(double x, double y, double z) {
        	double t_0 = ((x - ((y + 0.5) * log(y))) + y) - z;
        	double tmp;
        	if (t_0 <= -500000000.0) {
        		tmp = (((((y - 0.5) * x) * -x) / (y - x)) / (y - 0.5)) - z;
        	} else if (t_0 <= 500.0) {
        		tmp = -0.5 * log(y);
        	} else {
        		tmp = (((x * x) * 0.5) / ((y - x) * (y - 0.5))) - z;
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(x, y, z)
        use fmin_fmax_functions
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: t_0
            real(8) :: tmp
            t_0 = ((x - ((y + 0.5d0) * log(y))) + y) - z
            if (t_0 <= (-500000000.0d0)) then
                tmp = (((((y - 0.5d0) * x) * -x) / (y - x)) / (y - 0.5d0)) - z
            else if (t_0 <= 500.0d0) then
                tmp = (-0.5d0) * log(y)
            else
                tmp = (((x * x) * 0.5d0) / ((y - x) * (y - 0.5d0))) - z
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double t_0 = ((x - ((y + 0.5) * Math.log(y))) + y) - z;
        	double tmp;
        	if (t_0 <= -500000000.0) {
        		tmp = (((((y - 0.5) * x) * -x) / (y - x)) / (y - 0.5)) - z;
        	} else if (t_0 <= 500.0) {
        		tmp = -0.5 * Math.log(y);
        	} else {
        		tmp = (((x * x) * 0.5) / ((y - x) * (y - 0.5))) - z;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	t_0 = ((x - ((y + 0.5) * math.log(y))) + y) - z
        	tmp = 0
        	if t_0 <= -500000000.0:
        		tmp = (((((y - 0.5) * x) * -x) / (y - x)) / (y - 0.5)) - z
        	elif t_0 <= 500.0:
        		tmp = -0.5 * math.log(y)
        	else:
        		tmp = (((x * x) * 0.5) / ((y - x) * (y - 0.5))) - z
        	return tmp
        
        function code(x, y, z)
        	t_0 = Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z)
        	tmp = 0.0
        	if (t_0 <= -500000000.0)
        		tmp = Float64(Float64(Float64(Float64(Float64(Float64(y - 0.5) * x) * Float64(-x)) / Float64(y - x)) / Float64(y - 0.5)) - z);
        	elseif (t_0 <= 500.0)
        		tmp = Float64(-0.5 * log(y));
        	else
        		tmp = Float64(Float64(Float64(Float64(x * x) * 0.5) / Float64(Float64(y - x) * Float64(y - 0.5))) - z);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	t_0 = ((x - ((y + 0.5) * log(y))) + y) - z;
        	tmp = 0.0;
        	if (t_0 <= -500000000.0)
        		tmp = (((((y - 0.5) * x) * -x) / (y - x)) / (y - 0.5)) - z;
        	elseif (t_0 <= 500.0)
        		tmp = -0.5 * log(y);
        	else
        		tmp = (((x * x) * 0.5) / ((y - x) * (y - 0.5))) - z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$0, -500000000.0], N[(N[(N[(N[(N[(N[(y - 0.5), $MachinePrecision] * x), $MachinePrecision] * (-x)), $MachinePrecision] / N[(y - x), $MachinePrecision]), $MachinePrecision] / N[(y - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[t$95$0, 500.0], N[(-0.5 * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] / N[(N[(y - x), $MachinePrecision] * N[(y - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z\\
        \mathbf{if}\;t\_0 \leq -500000000:\\
        \;\;\;\;\frac{\frac{\left(\left(y - 0.5\right) \cdot x\right) \cdot \left(-x\right)}{y - x}}{y - 0.5} - z\\
        
        \mathbf{elif}\;t\_0 \leq 500:\\
        \;\;\;\;-0.5 \cdot \log y\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\left(x \cdot x\right) \cdot 0.5}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < -5e8

          1. Initial program 99.8%

            \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-+.f64N/A

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

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

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

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

              \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - z \]
            6. lower-+.f6499.8

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

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

              \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)}\right) - z \]
            9. lower-*.f6499.8

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

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

              \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)}\right) - z \]
            12. lower-+.f6499.8

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(\frac{y \cdot y - x \cdot x}{y - x} + \left(\mathsf{neg}\left(\color{blue}{\log y \cdot \left(\frac{1}{2} + y\right)}\right)\right)\right) - z \]
            9. distribute-lft-neg-outN/A

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

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

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

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

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

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

              \[\leadsto \color{blue}{\frac{\left(y \cdot y - x \cdot x\right) \cdot \left(y - \frac{1}{2}\right) + \left(y - x\right) \cdot \left(\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(y \cdot y - \frac{1}{2} \cdot \frac{1}{2}\right)\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)}} - z \]
          6. Applied rewrites37.0%

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

            \[\leadsto \frac{\color{blue}{-1 \cdot \left({x}^{2} \cdot \left(y - \frac{1}{2}\right)\right)}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
          8. Step-by-step derivation
            1. associate-*r*N/A

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

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

              \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left({x}^{2}\right)\right)} \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
            4. unpow2N/A

              \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{x \cdot x}\right)\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
            5. distribute-lft-neg-inN/A

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

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

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

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

              \[\leadsto \frac{\left(\color{blue}{\left(-x\right)} \cdot x\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
            10. lower--.f6429.5

              \[\leadsto \frac{\left(\left(-x\right) \cdot x\right) \cdot \color{blue}{\left(y - 0.5\right)}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
          9. Applied rewrites29.5%

            \[\leadsto \frac{\color{blue}{\left(\left(-x\right) \cdot x\right) \cdot \left(y - 0.5\right)}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
          10. Step-by-step derivation
            1. lift-/.f64N/A

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

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

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

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

              \[\leadsto \color{blue}{\frac{\frac{\left(\left(-x\right) \cdot x\right) \cdot \left(y - \frac{1}{2}\right)}{y - x}}{y - \frac{1}{2}}} - z \]
          11. Applied rewrites32.0%

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

          if -5e8 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < 500

          1. Initial program 99.9%

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

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

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

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

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

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

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

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

              \[\leadsto y - \mathsf{fma}\left(\color{blue}{\frac{1}{2} + y}, \log y, z\right) \]
            8. lower-log.f6498.2

              \[\leadsto y - \mathsf{fma}\left(0.5 + y, \color{blue}{\log y}, z\right) \]
          5. Applied rewrites98.2%

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

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

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

              \[\leadsto \frac{-1}{2} \cdot \log y \]
            3. Step-by-step derivation
              1. Applied rewrites91.4%

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

              if 500 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z)

              1. Initial program 100.0%

                \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-+.f64N/A

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

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

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

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

                  \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - z \]
                6. lower-+.f64100.0

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

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

                  \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)}\right) - z \]
                9. lower-*.f64100.0

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

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

                  \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)}\right) - z \]
                12. lower-+.f64100.0

                  \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(0.5 + y\right)}\right) - z \]
              4. Applied rewrites100.0%

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

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

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

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

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

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

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

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

                  \[\leadsto \left(\frac{y \cdot y - x \cdot x}{y - x} + \left(\mathsf{neg}\left(\color{blue}{\log y \cdot \left(\frac{1}{2} + y\right)}\right)\right)\right) - z \]
                9. distribute-lft-neg-outN/A

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\frac{\left(y \cdot y - x \cdot x\right) \cdot \left(y - \frac{1}{2}\right) + \left(y - x\right) \cdot \left(\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(y \cdot y - \frac{1}{2} \cdot \frac{1}{2}\right)\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)}} - z \]
              6. Applied rewrites58.3%

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

                \[\leadsto \frac{\color{blue}{-1 \cdot \left({x}^{2} \cdot \left(y - \frac{1}{2}\right)\right)}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
              8. Step-by-step derivation
                1. associate-*r*N/A

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

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

                  \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left({x}^{2}\right)\right)} \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                4. unpow2N/A

                  \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{x \cdot x}\right)\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                5. distribute-lft-neg-inN/A

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

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

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

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

                  \[\leadsto \frac{\left(\color{blue}{\left(-x\right)} \cdot x\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                10. lower--.f6463.3

                  \[\leadsto \frac{\left(\left(-x\right) \cdot x\right) \cdot \color{blue}{\left(y - 0.5\right)}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
              9. Applied rewrites63.3%

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

                \[\leadsto \frac{\frac{1}{2} \cdot \color{blue}{{x}^{2}}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
              11. Step-by-step derivation
                1. Applied rewrites64.8%

                  \[\leadsto \frac{\left(x \cdot x\right) \cdot \color{blue}{0.5}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
              12. Recombined 3 regimes into one program.
              13. Add Preprocessing

              Alternative 4: 48.0% accurate, 0.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2200000:\\ \;\;\;\;\frac{\frac{\left(\left(y - 0.5\right) \cdot x\right) \cdot \left(-x\right)}{y - x}}{y - 0.5} - z\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+20} \lor \neg \left(x \leq 1.35 \cdot 10^{+154}\right):\\ \;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot 0.5}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (<= x -2200000.0)
                 (- (/ (/ (* (* (- y 0.5) x) (- x)) (- y x)) (- y 0.5)) z)
                 (if (or (<= x 7.2e+20) (not (<= x 1.35e+154)))
                   (fma -0.5 (log y) (- z))
                   (- (/ (* (* x x) 0.5) (* (- y x) (- y 0.5))) z))))
              double code(double x, double y, double z) {
              	double tmp;
              	if (x <= -2200000.0) {
              		tmp = (((((y - 0.5) * x) * -x) / (y - x)) / (y - 0.5)) - z;
              	} else if ((x <= 7.2e+20) || !(x <= 1.35e+154)) {
              		tmp = fma(-0.5, log(y), -z);
              	} else {
              		tmp = (((x * x) * 0.5) / ((y - x) * (y - 0.5))) - z;
              	}
              	return tmp;
              }
              
              function code(x, y, z)
              	tmp = 0.0
              	if (x <= -2200000.0)
              		tmp = Float64(Float64(Float64(Float64(Float64(Float64(y - 0.5) * x) * Float64(-x)) / Float64(y - x)) / Float64(y - 0.5)) - z);
              	elseif ((x <= 7.2e+20) || !(x <= 1.35e+154))
              		tmp = fma(-0.5, log(y), Float64(-z));
              	else
              		tmp = Float64(Float64(Float64(Float64(x * x) * 0.5) / Float64(Float64(y - x) * Float64(y - 0.5))) - z);
              	end
              	return tmp
              end
              
              code[x_, y_, z_] := If[LessEqual[x, -2200000.0], N[(N[(N[(N[(N[(N[(y - 0.5), $MachinePrecision] * x), $MachinePrecision] * (-x)), $MachinePrecision] / N[(y - x), $MachinePrecision]), $MachinePrecision] / N[(y - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[Or[LessEqual[x, 7.2e+20], N[Not[LessEqual[x, 1.35e+154]], $MachinePrecision]], N[(-0.5 * N[Log[y], $MachinePrecision] + (-z)), $MachinePrecision], N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] / N[(N[(y - x), $MachinePrecision] * N[(y - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;x \leq -2200000:\\
              \;\;\;\;\frac{\frac{\left(\left(y - 0.5\right) \cdot x\right) \cdot \left(-x\right)}{y - x}}{y - 0.5} - z\\
              
              \mathbf{elif}\;x \leq 7.2 \cdot 10^{+20} \lor \neg \left(x \leq 1.35 \cdot 10^{+154}\right):\\
              \;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{\left(x \cdot x\right) \cdot 0.5}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if x < -2.2e6

                1. Initial program 99.9%

                  \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-+.f64N/A

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

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

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

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

                    \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - z \]
                  6. lower-+.f6499.9

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

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

                    \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)}\right) - z \]
                  9. lower-*.f6499.9

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

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

                    \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)}\right) - z \]
                  12. lower-+.f6499.9

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

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

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

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

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

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

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

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

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

                    \[\leadsto \left(\frac{y \cdot y - x \cdot x}{y - x} + \left(\mathsf{neg}\left(\color{blue}{\log y \cdot \left(\frac{1}{2} + y\right)}\right)\right)\right) - z \]
                  9. distribute-lft-neg-outN/A

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\frac{\left(y \cdot y - x \cdot x\right) \cdot \left(y - \frac{1}{2}\right) + \left(y - x\right) \cdot \left(\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(y \cdot y - \frac{1}{2} \cdot \frac{1}{2}\right)\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)}} - z \]
                6. Applied rewrites29.5%

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

                  \[\leadsto \frac{\color{blue}{-1 \cdot \left({x}^{2} \cdot \left(y - \frac{1}{2}\right)\right)}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                8. Step-by-step derivation
                  1. associate-*r*N/A

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

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

                    \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left({x}^{2}\right)\right)} \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                  4. unpow2N/A

                    \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{x \cdot x}\right)\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                  5. distribute-lft-neg-inN/A

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

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

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

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

                    \[\leadsto \frac{\left(\color{blue}{\left(-x\right)} \cdot x\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                  10. lower--.f6428.9

                    \[\leadsto \frac{\left(\left(-x\right) \cdot x\right) \cdot \color{blue}{\left(y - 0.5\right)}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
                9. Applied rewrites28.9%

                  \[\leadsto \frac{\color{blue}{\left(\left(-x\right) \cdot x\right) \cdot \left(y - 0.5\right)}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
                10. Step-by-step derivation
                  1. lift-/.f64N/A

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

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

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

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

                    \[\leadsto \color{blue}{\frac{\frac{\left(\left(-x\right) \cdot x\right) \cdot \left(y - \frac{1}{2}\right)}{y - x}}{y - \frac{1}{2}}} - z \]
                11. Applied rewrites33.2%

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

                if -2.2e6 < x < 7.2e20 or 1.35000000000000003e154 < x

                1. Initial program 99.8%

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

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

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

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

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

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

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

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

                    \[\leadsto y - \mathsf{fma}\left(\color{blue}{\frac{1}{2} + y}, \log y, z\right) \]
                  8. lower-log.f6486.7

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

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

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

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

                  if 7.2e20 < x < 1.35000000000000003e154

                  1. Initial program 99.9%

                    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                  2. Add Preprocessing
                  3. Step-by-step derivation
                    1. lift-+.f64N/A

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

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

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

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

                      \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - z \]
                    6. lower-+.f6499.9

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

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

                      \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)}\right) - z \]
                    9. lower-*.f6499.9

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

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

                      \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)}\right) - z \]
                    12. lower-+.f6499.9

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

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

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

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

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

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

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

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

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

                      \[\leadsto \left(\frac{y \cdot y - x \cdot x}{y - x} + \left(\mathsf{neg}\left(\color{blue}{\log y \cdot \left(\frac{1}{2} + y\right)}\right)\right)\right) - z \]
                    9. distribute-lft-neg-outN/A

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

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

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

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

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

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

                      \[\leadsto \color{blue}{\frac{\left(y \cdot y - x \cdot x\right) \cdot \left(y - \frac{1}{2}\right) + \left(y - x\right) \cdot \left(\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(y \cdot y - \frac{1}{2} \cdot \frac{1}{2}\right)\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)}} - z \]
                  6. Applied rewrites59.9%

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

                    \[\leadsto \frac{\color{blue}{-1 \cdot \left({x}^{2} \cdot \left(y - \frac{1}{2}\right)\right)}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                  8. Step-by-step derivation
                    1. associate-*r*N/A

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

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

                      \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left({x}^{2}\right)\right)} \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                    4. unpow2N/A

                      \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{x \cdot x}\right)\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                    5. distribute-lft-neg-inN/A

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

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

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

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

                      \[\leadsto \frac{\left(\color{blue}{\left(-x\right)} \cdot x\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                    10. lower--.f6460.5

                      \[\leadsto \frac{\left(\left(-x\right) \cdot x\right) \cdot \color{blue}{\left(y - 0.5\right)}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
                  9. Applied rewrites60.5%

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

                    \[\leadsto \frac{\frac{1}{2} \cdot \color{blue}{{x}^{2}}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                  11. Step-by-step derivation
                    1. Applied rewrites67.4%

                      \[\leadsto \frac{\left(x \cdot x\right) \cdot \color{blue}{0.5}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
                  12. Recombined 3 regimes into one program.
                  13. Final simplification54.8%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2200000:\\ \;\;\;\;\frac{\frac{\left(\left(y - 0.5\right) \cdot x\right) \cdot \left(-x\right)}{y - x}}{y - 0.5} - z\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+20} \lor \neg \left(x \leq 1.35 \cdot 10^{+154}\right):\\ \;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot 0.5}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z\\ \end{array} \]
                  14. Add Preprocessing

                  Alternative 5: 99.2% accurate, 1.0× speedup?

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

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{2}, \log y, x\right)} - z \]
                      8. lower-log.f6499.6

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

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

                    if 5.8000000000000003e-8 < y

                    1. Initial program 99.8%

                      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. lift-+.f64N/A

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

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

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

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

                        \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - z \]
                      6. lower-+.f6499.8

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

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

                        \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)}\right) - z \]
                      9. lower-*.f6499.8

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

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

                        \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)}\right) - z \]
                      12. lower-+.f6499.8

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

                      \[\leadsto \color{blue}{\left(\left(y + x\right) - \log y \cdot \left(0.5 + y\right)\right) - z} \]
                    5. Taylor expanded in y around inf

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

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

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

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

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

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

                        \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot y}\right) - z \]
                      7. lower-log.f6498.7

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

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

                  Alternative 6: 99.2% accurate, 1.0× speedup?

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

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{2}, \log y, x\right)} - z \]
                      8. lower-log.f6499.6

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

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

                    if 5.8000000000000003e-8 < y

                    1. Initial program 99.8%

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

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

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

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

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

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

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

                        \[\leadsto \left(\left(x - \color{blue}{\log y \cdot y}\right) + y\right) - z \]
                      7. lower-log.f6498.7

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

                      \[\leadsto \left(\left(x - \color{blue}{\log y \cdot y}\right) + y\right) - z \]
                  3. Recombined 2 regimes into one program.
                  4. Final simplification99.1%

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

                  Alternative 7: 89.1% accurate, 1.0× speedup?

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

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{2}, \log y, x\right)} - z \]
                      8. lower-log.f6499.6

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

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

                    if 0.680000000000000049 < y

                    1. Initial program 99.8%

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

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

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

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

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

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

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

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

                        \[\leadsto y - \mathsf{fma}\left(\color{blue}{\frac{1}{2} + y}, \log y, z\right) \]
                      8. lower-log.f6480.4

                        \[\leadsto y - \mathsf{fma}\left(0.5 + y, \color{blue}{\log y}, z\right) \]
                    5. Applied rewrites80.4%

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

                  Alternative 8: 89.7% accurate, 1.0× speedup?

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

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{2}, \log y, x\right)} - z \]
                      8. lower-log.f6497.8

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

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

                    if 7.49999999999999941e26 < y

                    1. Initial program 99.7%

                      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. lift-+.f64N/A

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

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

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

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

                        \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - z \]
                      6. lower-+.f6499.7

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

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

                        \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)}\right) - z \]
                      9. lower-*.f6499.7

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

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

                        \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)}\right) - z \]
                      12. lower-+.f6499.7

                        \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(0.5 + y\right)}\right) - z \]
                    4. Applied rewrites99.7%

                      \[\leadsto \color{blue}{\left(\left(y + x\right) - \log y \cdot \left(0.5 + y\right)\right) - z} \]
                    5. Taylor expanded in y around inf

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\left(1 - \log y\right)} \cdot y - z \]
                      7. lower-log.f6480.3

                        \[\leadsto \left(1 - \color{blue}{\log y}\right) \cdot y - z \]
                    7. Applied rewrites80.3%

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

                  Alternative 9: 99.8% accurate, 1.0× speedup?

                  \[\begin{array}{l} \\ \left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \end{array} \]
                  (FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
                  double code(double x, double y, double z) {
                  	return ((x - ((y + 0.5) * log(y))) + y) - z;
                  }
                  
                  module fmin_fmax_functions
                      implicit none
                      private
                      public fmax
                      public fmin
                  
                      interface fmax
                          module procedure fmax88
                          module procedure fmax44
                          module procedure fmax84
                          module procedure fmax48
                      end interface
                      interface fmin
                          module procedure fmin88
                          module procedure fmin44
                          module procedure fmin84
                          module procedure fmin48
                      end interface
                  contains
                      real(8) function fmax88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmax44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmax84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmax48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                      end function
                      real(8) function fmin88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmin44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmin84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmin48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                      end function
                  end module
                  
                  real(8) function code(x, y, z)
                  use fmin_fmax_functions
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8), intent (in) :: z
                      code = ((x - ((y + 0.5d0) * log(y))) + y) - z
                  end function
                  
                  public static double code(double x, double y, double z) {
                  	return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
                  }
                  
                  def code(x, y, z):
                  	return ((x - ((y + 0.5) * math.log(y))) + y) - z
                  
                  function code(x, y, z)
                  	return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z)
                  end
                  
                  function tmp = code(x, y, z)
                  	tmp = ((x - ((y + 0.5) * log(y))) + y) - z;
                  end
                  
                  code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  \left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
                  \end{array}
                  
                  Derivation
                  1. Initial program 99.9%

                    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                  2. Add Preprocessing
                  3. Add Preprocessing

                  Alternative 10: 84.1% accurate, 1.0× speedup?

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

                    1. Initial program 99.9%

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{2}, \log y, x\right)} - z \]
                      8. lower-log.f6488.1

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

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

                    if 7.20000000000000011e136 < y

                    1. Initial program 99.6%

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\left(1 - \log y\right)} \cdot y \]
                      7. lower-log.f6482.1

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

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

                  Alternative 11: 39.1% accurate, 2.0× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6.5 \cdot 10^{+215} \lor \neg \left(z \leq 1.5 \cdot 10^{+121}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(\left(y - 0.5\right) \cdot x\right) \cdot \left(-x\right)}{y - x}}{y - 0.5} - z\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (if (or (<= z -6.5e+215) (not (<= z 1.5e+121)))
                     (- z)
                     (- (/ (/ (* (* (- y 0.5) x) (- x)) (- y x)) (- y 0.5)) z)))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if ((z <= -6.5e+215) || !(z <= 1.5e+121)) {
                  		tmp = -z;
                  	} else {
                  		tmp = (((((y - 0.5) * x) * -x) / (y - x)) / (y - 0.5)) - z;
                  	}
                  	return tmp;
                  }
                  
                  module fmin_fmax_functions
                      implicit none
                      private
                      public fmax
                      public fmin
                  
                      interface fmax
                          module procedure fmax88
                          module procedure fmax44
                          module procedure fmax84
                          module procedure fmax48
                      end interface
                      interface fmin
                          module procedure fmin88
                          module procedure fmin44
                          module procedure fmin84
                          module procedure fmin48
                      end interface
                  contains
                      real(8) function fmax88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmax44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmax84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmax48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                      end function
                      real(8) function fmin88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmin44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmin84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmin48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                      end function
                  end module
                  
                  real(8) function code(x, y, z)
                  use fmin_fmax_functions
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8), intent (in) :: z
                      real(8) :: tmp
                      if ((z <= (-6.5d+215)) .or. (.not. (z <= 1.5d+121))) then
                          tmp = -z
                      else
                          tmp = (((((y - 0.5d0) * x) * -x) / (y - x)) / (y - 0.5d0)) - z
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double y, double z) {
                  	double tmp;
                  	if ((z <= -6.5e+215) || !(z <= 1.5e+121)) {
                  		tmp = -z;
                  	} else {
                  		tmp = (((((y - 0.5) * x) * -x) / (y - x)) / (y - 0.5)) - z;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y, z):
                  	tmp = 0
                  	if (z <= -6.5e+215) or not (z <= 1.5e+121):
                  		tmp = -z
                  	else:
                  		tmp = (((((y - 0.5) * x) * -x) / (y - x)) / (y - 0.5)) - z
                  	return tmp
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if ((z <= -6.5e+215) || !(z <= 1.5e+121))
                  		tmp = Float64(-z);
                  	else
                  		tmp = Float64(Float64(Float64(Float64(Float64(Float64(y - 0.5) * x) * Float64(-x)) / Float64(y - x)) / Float64(y - 0.5)) - z);
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y, z)
                  	tmp = 0.0;
                  	if ((z <= -6.5e+215) || ~((z <= 1.5e+121)))
                  		tmp = -z;
                  	else
                  		tmp = (((((y - 0.5) * x) * -x) / (y - x)) / (y - 0.5)) - z;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_, z_] := If[Or[LessEqual[z, -6.5e+215], N[Not[LessEqual[z, 1.5e+121]], $MachinePrecision]], (-z), N[(N[(N[(N[(N[(N[(y - 0.5), $MachinePrecision] * x), $MachinePrecision] * (-x)), $MachinePrecision] / N[(y - x), $MachinePrecision]), $MachinePrecision] / N[(y - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;z \leq -6.5 \cdot 10^{+215} \lor \neg \left(z \leq 1.5 \cdot 10^{+121}\right):\\
                  \;\;\;\;-z\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\frac{\frac{\left(\left(y - 0.5\right) \cdot x\right) \cdot \left(-x\right)}{y - x}}{y - 0.5} - z\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if z < -6.4999999999999997e215 or 1.5000000000000001e121 < z

                    1. Initial program 99.9%

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

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

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

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

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

                    if -6.4999999999999997e215 < z < 1.5000000000000001e121

                    1. Initial program 99.8%

                      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. lift-+.f64N/A

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

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

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

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

                        \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - z \]
                      6. lower-+.f6499.8

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

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

                        \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)}\right) - z \]
                      9. lower-*.f6499.8

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

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

                        \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)}\right) - z \]
                      12. lower-+.f6499.8

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

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

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

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

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

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

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

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

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

                        \[\leadsto \left(\frac{y \cdot y - x \cdot x}{y - x} + \left(\mathsf{neg}\left(\color{blue}{\log y \cdot \left(\frac{1}{2} + y\right)}\right)\right)\right) - z \]
                      9. distribute-lft-neg-outN/A

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{\color{blue}{-1 \cdot \left({x}^{2} \cdot \left(y - \frac{1}{2}\right)\right)}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                    8. Step-by-step derivation
                      1. associate-*r*N/A

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

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

                        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left({x}^{2}\right)\right)} \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                      4. unpow2N/A

                        \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{x \cdot x}\right)\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                      5. distribute-lft-neg-inN/A

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

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

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

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

                        \[\leadsto \frac{\left(\color{blue}{\left(-x\right)} \cdot x\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                      10. lower--.f6428.2

                        \[\leadsto \frac{\left(\left(-x\right) \cdot x\right) \cdot \color{blue}{\left(y - 0.5\right)}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
                    9. Applied rewrites28.2%

                      \[\leadsto \frac{\color{blue}{\left(\left(-x\right) \cdot x\right) \cdot \left(y - 0.5\right)}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
                    10. Step-by-step derivation
                      1. lift-/.f64N/A

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

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

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

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

                        \[\leadsto \color{blue}{\frac{\frac{\left(\left(-x\right) \cdot x\right) \cdot \left(y - \frac{1}{2}\right)}{y - x}}{y - \frac{1}{2}}} - z \]
                    11. Applied rewrites29.7%

                      \[\leadsto \color{blue}{\frac{\frac{\left(\left(y - 0.5\right) \cdot x\right) \cdot \left(-x\right)}{y - x}}{y - 0.5}} - z \]
                  3. Recombined 2 regimes into one program.
                  4. Final simplification41.2%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.5 \cdot 10^{+215} \lor \neg \left(z \leq 1.5 \cdot 10^{+121}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(\left(y - 0.5\right) \cdot x\right) \cdot \left(-x\right)}{y - x}}{y - 0.5} - z\\ \end{array} \]
                  5. Add Preprocessing

                  Alternative 12: 36.7% accurate, 2.5× speedup?

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

                    1. Initial program 100.0%

                      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. lift-+.f64N/A

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

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

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

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

                        \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - z \]
                      6. lower-+.f64100.0

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

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

                        \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)}\right) - z \]
                      9. lower-*.f64100.0

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

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

                        \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)}\right) - z \]
                      12. lower-+.f64100.0

                        \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(0.5 + y\right)}\right) - z \]
                    4. Applied rewrites100.0%

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

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

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

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

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

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

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

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

                        \[\leadsto \left(\frac{y \cdot y - x \cdot x}{y - x} + \left(\mathsf{neg}\left(\color{blue}{\log y \cdot \left(\frac{1}{2} + y\right)}\right)\right)\right) - z \]
                      9. distribute-lft-neg-outN/A

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\frac{\left(y \cdot y - x \cdot x\right) \cdot \left(y - \frac{1}{2}\right) + \left(y - x\right) \cdot \left(\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(y \cdot y - \frac{1}{2} \cdot \frac{1}{2}\right)\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)}} - z \]
                    6. Applied rewrites79.4%

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

                      \[\leadsto \frac{\color{blue}{-1 \cdot \left({x}^{2} \cdot \left(y - \frac{1}{2}\right)\right)}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                    8. Step-by-step derivation
                      1. associate-*r*N/A

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

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

                        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left({x}^{2}\right)\right)} \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                      4. unpow2N/A

                        \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{x \cdot x}\right)\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                      5. distribute-lft-neg-inN/A

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

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

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

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

                        \[\leadsto \frac{\left(\color{blue}{\left(-x\right)} \cdot x\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                      10. lower--.f6450.2

                        \[\leadsto \frac{\left(\left(-x\right) \cdot x\right) \cdot \color{blue}{\left(y - 0.5\right)}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
                    9. Applied rewrites50.2%

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

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

                      if 4.40000000000000021e55 < y

                      1. Initial program 99.7%

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

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

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

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

                        \[\leadsto \color{blue}{-z} \]
                    11. Recombined 2 regimes into one program.
                    12. Final simplification38.8%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.4 \cdot 10^{+55}:\\ \;\;\;\;\frac{\left(\left(y - 0.5\right) \cdot x\right) \cdot \left(-x\right)}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
                    13. Add Preprocessing

                    Alternative 13: 36.6% accurate, 2.5× speedup?

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

                      1. Initial program 100.0%

                        \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                      2. Add Preprocessing
                      3. Step-by-step derivation
                        1. lift-+.f64N/A

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

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

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

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

                          \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - z \]
                        6. lower-+.f64100.0

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

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

                          \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)}\right) - z \]
                        9. lower-*.f64100.0

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

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

                          \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)}\right) - z \]
                        12. lower-+.f64100.0

                          \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(0.5 + y\right)}\right) - z \]
                      4. Applied rewrites100.0%

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

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

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

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

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

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

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

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

                          \[\leadsto \left(\frac{y \cdot y - x \cdot x}{y - x} + \left(\mathsf{neg}\left(\color{blue}{\log y \cdot \left(\frac{1}{2} + y\right)}\right)\right)\right) - z \]
                        9. distribute-lft-neg-outN/A

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\frac{\left(y \cdot y - x \cdot x\right) \cdot \left(y - \frac{1}{2}\right) + \left(y - x\right) \cdot \left(\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(y \cdot y - \frac{1}{2} \cdot \frac{1}{2}\right)\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)}} - z \]
                      6. Applied rewrites79.4%

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

                        \[\leadsto \frac{\color{blue}{-1 \cdot \left({x}^{2} \cdot \left(y - \frac{1}{2}\right)\right)}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                      8. Step-by-step derivation
                        1. associate-*r*N/A

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

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

                          \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left({x}^{2}\right)\right)} \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                        4. unpow2N/A

                          \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{x \cdot x}\right)\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                        5. distribute-lft-neg-inN/A

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

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

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

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

                          \[\leadsto \frac{\left(\color{blue}{\left(-x\right)} \cdot x\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                        10. lower--.f6450.2

                          \[\leadsto \frac{\left(\left(-x\right) \cdot x\right) \cdot \color{blue}{\left(y - 0.5\right)}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
                      9. Applied rewrites50.2%

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

                      if 4.40000000000000021e55 < y

                      1. Initial program 99.7%

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

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

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

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

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

                    Alternative 14: 35.3% accurate, 2.8× speedup?

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

                      1. Initial program 99.9%

                        \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                      2. Add Preprocessing
                      3. Step-by-step derivation
                        1. lift-+.f64N/A

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

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

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

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

                          \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - z \]
                        6. lower-+.f6499.9

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

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

                          \[\leadsto \left(\left(y + x\right) - \color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)}\right) - z \]
                        9. lower-*.f6499.9

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

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

                          \[\leadsto \left(\left(y + x\right) - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)}\right) - z \]
                        12. lower-+.f6499.9

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

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

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

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

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

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

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

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

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

                          \[\leadsto \left(\frac{y \cdot y - x \cdot x}{y - x} + \left(\mathsf{neg}\left(\color{blue}{\log y \cdot \left(\frac{1}{2} + y\right)}\right)\right)\right) - z \]
                        9. distribute-lft-neg-outN/A

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\frac{\left(y \cdot y - x \cdot x\right) \cdot \left(y - \frac{1}{2}\right) + \left(y - x\right) \cdot \left(\left(\mathsf{neg}\left(\log y\right)\right) \cdot \left(y \cdot y - \frac{1}{2} \cdot \frac{1}{2}\right)\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)}} - z \]
                      6. Applied rewrites60.6%

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

                        \[\leadsto \frac{\color{blue}{-1 \cdot \left({x}^{2} \cdot \left(y - \frac{1}{2}\right)\right)}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                      8. Step-by-step derivation
                        1. associate-*r*N/A

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

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

                          \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left({x}^{2}\right)\right)} \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                        4. unpow2N/A

                          \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{x \cdot x}\right)\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                        5. distribute-lft-neg-inN/A

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

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

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

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

                          \[\leadsto \frac{\left(\color{blue}{\left(-x\right)} \cdot x\right) \cdot \left(y - \frac{1}{2}\right)}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                        10. lower--.f6440.2

                          \[\leadsto \frac{\left(\left(-x\right) \cdot x\right) \cdot \color{blue}{\left(y - 0.5\right)}}{\left(y - x\right) \cdot \left(y - 0.5\right)} - z \]
                      9. Applied rewrites40.2%

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

                        \[\leadsto \frac{\frac{1}{2} \cdot \color{blue}{{x}^{2}}}{\left(y - x\right) \cdot \left(y - \frac{1}{2}\right)} - z \]
                      11. Step-by-step derivation
                        1. Applied rewrites40.8%

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

                        if 1.35000000000000003e154 < x

                        1. Initial program 99.9%

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

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

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

                            \[\leadsto \color{blue}{-z} \]
                        5. Applied rewrites18.1%

                          \[\leadsto \color{blue}{-z} \]
                      12. Recombined 2 regimes into one program.
                      13. Add Preprocessing

                      Alternative 15: 30.0% accurate, 39.3× speedup?

                      \[\begin{array}{l} \\ -z \end{array} \]
                      (FPCore (x y z) :precision binary64 (- z))
                      double code(double x, double y, double z) {
                      	return -z;
                      }
                      
                      module fmin_fmax_functions
                          implicit none
                          private
                          public fmax
                          public fmin
                      
                          interface fmax
                              module procedure fmax88
                              module procedure fmax44
                              module procedure fmax84
                              module procedure fmax48
                          end interface
                          interface fmin
                              module procedure fmin88
                              module procedure fmin44
                              module procedure fmin84
                              module procedure fmin48
                          end interface
                      contains
                          real(8) function fmax88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmax44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmax84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmax48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                          end function
                          real(8) function fmin88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmin44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmin84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmin48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                          end function
                      end module
                      
                      real(8) function code(x, y, z)
                      use fmin_fmax_functions
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8), intent (in) :: z
                          code = -z
                      end function
                      
                      public static double code(double x, double y, double z) {
                      	return -z;
                      }
                      
                      def code(x, y, z):
                      	return -z
                      
                      function code(x, y, z)
                      	return Float64(-z)
                      end
                      
                      function tmp = code(x, y, z)
                      	tmp = -z;
                      end
                      
                      code[x_, y_, z_] := (-z)
                      
                      \begin{array}{l}
                      
                      \\
                      -z
                      \end{array}
                      
                      Derivation
                      1. Initial program 99.9%

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

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

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

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

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

                      Developer Target 1: 99.8% accurate, 1.0× speedup?

                      \[\begin{array}{l} \\ \left(\left(y + x\right) - z\right) - \left(y + 0.5\right) \cdot \log y \end{array} \]
                      (FPCore (x y z) :precision binary64 (- (- (+ y x) z) (* (+ y 0.5) (log y))))
                      double code(double x, double y, double z) {
                      	return ((y + x) - z) - ((y + 0.5) * log(y));
                      }
                      
                      module fmin_fmax_functions
                          implicit none
                          private
                          public fmax
                          public fmin
                      
                          interface fmax
                              module procedure fmax88
                              module procedure fmax44
                              module procedure fmax84
                              module procedure fmax48
                          end interface
                          interface fmin
                              module procedure fmin88
                              module procedure fmin44
                              module procedure fmin84
                              module procedure fmin48
                          end interface
                      contains
                          real(8) function fmax88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmax44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmax84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmax48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                          end function
                          real(8) function fmin88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmin44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmin84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmin48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                          end function
                      end module
                      
                      real(8) function code(x, y, z)
                      use fmin_fmax_functions
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8), intent (in) :: z
                          code = ((y + x) - z) - ((y + 0.5d0) * log(y))
                      end function
                      
                      public static double code(double x, double y, double z) {
                      	return ((y + x) - z) - ((y + 0.5) * Math.log(y));
                      }
                      
                      def code(x, y, z):
                      	return ((y + x) - z) - ((y + 0.5) * math.log(y))
                      
                      function code(x, y, z)
                      	return Float64(Float64(Float64(y + x) - z) - Float64(Float64(y + 0.5) * log(y)))
                      end
                      
                      function tmp = code(x, y, z)
                      	tmp = ((y + x) - z) - ((y + 0.5) * log(y));
                      end
                      
                      code[x_, y_, z_] := N[(N[(N[(y + x), $MachinePrecision] - z), $MachinePrecision] - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                      
                      \begin{array}{l}
                      
                      \\
                      \left(\left(y + x\right) - z\right) - \left(y + 0.5\right) \cdot \log y
                      \end{array}
                      

                      Reproduce

                      ?
                      herbie shell --seed 2025006 
                      (FPCore (x y z)
                        :name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
                        :precision binary64
                      
                        :alt
                        (! :herbie-platform default (- (- (+ y x) z) (* (+ y 1/2) (log y))))
                      
                        (- (+ (- x (* (+ y 0.5) (log y))) y) z))