Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.9%
Time: 3.9s
Alternatives: 13
Speedup: 0.5×

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}

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 13 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.9% accurate, 0.5× speedup?

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

\\
\left(\left(\left(1 - \log y\right) \cdot y + x\right) - \log y \cdot 0.5\right) - z
\end{array}
Derivation
  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 0

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

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

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

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

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

      \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \frac{1}{2} \cdot \log y\right) - z \]
    6. lift-log.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \frac{1}{2} \cdot \log y\right) - z \]
    7. log-pow-revN/A

      \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left({y}^{\frac{1}{2}}\right)\right) - z \]
    8. lower-log.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left({y}^{\frac{1}{2}}\right)\right) - z \]
    9. unpow1/2N/A

      \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left(\sqrt{y}\right)\right) - z \]
    10. lower-sqrt.f6499.9

      \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left(\sqrt{y}\right)\right) - z \]
  5. Applied rewrites99.9%

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left(\sqrt{y}\right)\right)} - z \]
  6. Step-by-step derivation
    1. lift-fma.f64N/A

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

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

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

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

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

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

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

      \[\leadsto \left(\left(\left(1 - \log y\right) \cdot y + x\right) - \log \left(\sqrt{y}\right)\right) - z \]
    9. lift--.f6499.9

      \[\leadsto \left(\left(\left(1 - \log y\right) \cdot y + x\right) - \log \left(\sqrt{y}\right)\right) - z \]
  7. Applied rewrites99.9%

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

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

      \[\leadsto \left(\left(\left(1 - \log y\right) \cdot y + x\right) - \log \left(\sqrt{y}\right)\right) - z \]
    3. pow1/2N/A

      \[\leadsto \left(\left(\left(1 - \log y\right) \cdot y + x\right) - \log \left({y}^{\frac{1}{2}}\right)\right) - z \]
    4. log-pow-revN/A

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

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

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

      \[\leadsto \left(\left(\left(1 - \log y\right) \cdot y + x\right) - \log y \cdot 0.5\right) - z \]
  9. Applied rewrites99.9%

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

Alternative 2: 69.4% 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 -10000000000000:\\ \;\;\;\;x - z\\ \mathbf{elif}\;t\_0 \leq 500:\\ \;\;\;\;-0.5 \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;x - 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 -10000000000000.0)
     (- x z)
     (if (<= t_0 500.0) (* -0.5 (log y)) (- x 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 <= -10000000000000.0) {
		tmp = x - z;
	} else if (t_0 <= 500.0) {
		tmp = -0.5 * log(y);
	} else {
		tmp = x - 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 <= (-10000000000000.0d0)) then
        tmp = x - z
    else if (t_0 <= 500.0d0) then
        tmp = (-0.5d0) * log(y)
    else
        tmp = x - 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 <= -10000000000000.0) {
		tmp = x - z;
	} else if (t_0 <= 500.0) {
		tmp = -0.5 * Math.log(y);
	} else {
		tmp = x - z;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = ((x - ((y + 0.5) * math.log(y))) + y) - z
	tmp = 0
	if t_0 <= -10000000000000.0:
		tmp = x - z
	elif t_0 <= 500.0:
		tmp = -0.5 * math.log(y)
	else:
		tmp = x - 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 <= -10000000000000.0)
		tmp = Float64(x - z);
	elseif (t_0 <= 500.0)
		tmp = Float64(-0.5 * log(y));
	else
		tmp = Float64(x - 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 <= -10000000000000.0)
		tmp = x - z;
	elseif (t_0 <= 500.0)
		tmp = -0.5 * log(y);
	else
		tmp = x - 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, -10000000000000.0], N[(x - z), $MachinePrecision], If[LessEqual[t$95$0, 500.0], N[(-0.5 * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(x - 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 -10000000000000:\\
\;\;\;\;x - z\\

\mathbf{elif}\;t\_0 \leq 500:\\
\;\;\;\;-0.5 \cdot \log y\\

\mathbf{else}:\\
\;\;\;\;x - z\\


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

    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 inf

      \[\leadsto \color{blue}{x} - z \]
    4. Step-by-step derivation
      1. Applied rewrites66.5%

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

      if -1e13 < (-.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 y around 0

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

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

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

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

          \[\leadsto x - \mathsf{fma}\left(\log y, \color{blue}{\frac{1}{2}}, z\right) \]
        5. lift-log.f6493.9

          \[\leadsto x - \mathsf{fma}\left(\log y, 0.5, z\right) \]
      5. Applied rewrites93.9%

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

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

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

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

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

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

          \[\leadsto -\mathsf{fma}\left(\log y, \frac{1}{2}, z\right) \]
        6. lift-log.f6490.1

          \[\leadsto -\mathsf{fma}\left(\log y, 0.5, z\right) \]
      8. Applied rewrites90.1%

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

        \[\leadsto \frac{-1}{2} \cdot \log y \]
      10. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \frac{-1}{2} \cdot \log y \]
        2. lift-log.f6487.0

          \[\leadsto -0.5 \cdot \log y \]
      11. Applied rewrites87.0%

        \[\leadsto -0.5 \cdot \log y \]
    5. Recombined 2 regimes into one program.
    6. Add Preprocessing

    Alternative 3: 99.9% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log y \cdot 0.5\right) - z \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (- (- (fma (- 1.0 (log y)) y x) (* (log y) 0.5)) z))
    double code(double x, double y, double z) {
    	return (fma((1.0 - log(y)), y, x) - (log(y) * 0.5)) - z;
    }
    
    function code(x, y, z)
    	return Float64(Float64(fma(Float64(1.0 - log(y)), y, x) - Float64(log(y) * 0.5)) - z)
    end
    
    code[x_, y_, z_] := N[(N[(N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log y \cdot 0.5\right) - z
    \end{array}
    
    Derivation
    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 0

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \frac{1}{2} \cdot \log y\right) - z \]
      6. lift-log.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \frac{1}{2} \cdot \log y\right) - z \]
      7. log-pow-revN/A

        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left({y}^{\frac{1}{2}}\right)\right) - z \]
      8. lower-log.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left({y}^{\frac{1}{2}}\right)\right) - z \]
      9. unpow1/2N/A

        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left(\sqrt{y}\right)\right) - z \]
      10. lower-sqrt.f6499.9

        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left(\sqrt{y}\right)\right) - z \]
    5. Applied rewrites99.9%

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left(\sqrt{y}\right)\right)} - z \]
    6. Step-by-step derivation
      1. lift-log.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left(\sqrt{y}\right)\right) - z \]
      2. lift-sqrt.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left(\sqrt{y}\right)\right) - z \]
      3. pow1/2N/A

        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left({y}^{\frac{1}{2}}\right)\right) - z \]
      4. log-pow-revN/A

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

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

        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log y \cdot \color{blue}{\frac{1}{2}}\right) - z \]
      7. lift-log.f6499.9

        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log y \cdot 0.5\right) - z \]
    7. Applied rewrites99.9%

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

    Alternative 4: 89.8% accurate, 1.0× speedup?

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

      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. lower--.f64N/A

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

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

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

          \[\leadsto x - \mathsf{fma}\left(\log y, \color{blue}{\frac{1}{2}}, z\right) \]
        5. lift-log.f6495.3

          \[\leadsto x - \mathsf{fma}\left(\log y, 0.5, z\right) \]
      5. Applied rewrites95.3%

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

      if 5.39999999999999983e51 < y < 9.0000000000000001e114

      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 0

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

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

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

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

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

          \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \frac{1}{2} \cdot \log y\right) - z \]
        6. lift-log.f64N/A

          \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \frac{1}{2} \cdot \log y\right) - z \]
        7. log-pow-revN/A

          \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left({y}^{\frac{1}{2}}\right)\right) - z \]
        8. lower-log.f64N/A

          \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left({y}^{\frac{1}{2}}\right)\right) - z \]
        9. unpow1/2N/A

          \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left(\sqrt{y}\right)\right) - z \]
        10. lower-sqrt.f6499.8

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

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left(\sqrt{y}\right)\right)} - z \]
      6. Step-by-step derivation
        1. lift-fma.f64N/A

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

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

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

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

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

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

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

          \[\leadsto \left(\left(\left(1 - \log y\right) \cdot y + x\right) - \log \left(\sqrt{y}\right)\right) - z \]
        9. lift--.f6499.8

          \[\leadsto \left(\left(\left(1 - \log y\right) \cdot y + x\right) - \log \left(\sqrt{y}\right)\right) - z \]
      7. Applied rewrites99.8%

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

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

          \[\leadsto \left(\left(\left(1 - \log y\right) \cdot y + x\right) - \log \left(\sqrt{y}\right)\right) - z \]
        3. pow1/2N/A

          \[\leadsto \left(\left(\left(1 - \log y\right) \cdot y + x\right) - \log \left({y}^{\frac{1}{2}}\right)\right) - z \]
        4. log-pow-revN/A

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

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

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

          \[\leadsto \left(\left(\left(1 - \log y\right) \cdot y + x\right) - \log y \cdot 0.5\right) - z \]
      9. Applied rewrites99.8%

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

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

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

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

          \[\leadsto y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right) - z \]
        4. metadata-evalN/A

          \[\leadsto y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right) - z \]
        5. associate-+l-N/A

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

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

          \[\leadsto \left(1 - \left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right)\right)\right)\right) \cdot y - z \]
        8. neg-logN/A

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

          \[\leadsto \left(1 - \log y\right) \cdot y - z \]
        10. lift-log.f64N/A

          \[\leadsto \left(1 - \log y\right) \cdot y - z \]
        11. lift--.f64N/A

          \[\leadsto \left(1 - \log y\right) \cdot y - z \]
        12. lift-*.f6470.1

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

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

      if 9.0000000000000001e114 < 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 \left(\left(x - \color{blue}{y} \cdot \log y\right) + y\right) - z \]
      4. Step-by-step derivation
        1. Applied rewrites99.6%

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

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

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

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

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

            \[\leadsto \left(x - y \cdot \log y\right) + \left(y - z\right) \]
          6. metadata-evalN/A

            \[\leadsto \left(x - y \cdot \log y\right) + \left(y - z\right) \]
          7. metadata-evalN/A

            \[\leadsto \left(x - y \cdot \log y\right) + \left(y - z\right) \]
          8. metadata-evalN/A

            \[\leadsto \left(x - y \cdot \log y\right) + \mathsf{Rewrite=>}\left(lower--.f64, \left(y - z\right)\right) \]
        3. Applied rewrites99.6%

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

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

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

        Alternative 5: 69.7% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -210:\\ \;\;\;\;x - z\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{+47}:\\ \;\;\;\;-\mathsf{fma}\left(\log y, 0.5, z\right)\\ \mathbf{else}:\\ \;\;\;\;x - z\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= x -210.0)
           (- x z)
           (if (<= x 3.2e+47) (- (fma (log y) 0.5 z)) (- x z))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (x <= -210.0) {
        		tmp = x - z;
        	} else if (x <= 3.2e+47) {
        		tmp = -fma(log(y), 0.5, z);
        	} else {
        		tmp = x - z;
        	}
        	return tmp;
        }
        
        function code(x, y, z)
        	tmp = 0.0
        	if (x <= -210.0)
        		tmp = Float64(x - z);
        	elseif (x <= 3.2e+47)
        		tmp = Float64(-fma(log(y), 0.5, z));
        	else
        		tmp = Float64(x - z);
        	end
        	return tmp
        end
        
        code[x_, y_, z_] := If[LessEqual[x, -210.0], N[(x - z), $MachinePrecision], If[LessEqual[x, 3.2e+47], (-N[(N[Log[y], $MachinePrecision] * 0.5 + z), $MachinePrecision]), N[(x - z), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;x \leq -210:\\
        \;\;\;\;x - z\\
        
        \mathbf{elif}\;x \leq 3.2 \cdot 10^{+47}:\\
        \;\;\;\;-\mathsf{fma}\left(\log y, 0.5, z\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x - z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < -210 or 3.2e47 < 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 x around inf

            \[\leadsto \color{blue}{x} - z \]
          4. Step-by-step derivation
            1. Applied rewrites79.5%

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

            if -210 < x < 3.2e47

            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 0

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

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

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

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

                \[\leadsto x - \mathsf{fma}\left(\log y, \color{blue}{\frac{1}{2}}, z\right) \]
              5. lift-log.f6463.3

                \[\leadsto x - \mathsf{fma}\left(\log y, 0.5, z\right) \]
            5. Applied rewrites63.3%

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

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

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

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

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

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

                \[\leadsto -\mathsf{fma}\left(\log y, \frac{1}{2}, z\right) \]
              6. lift-log.f6461.1

                \[\leadsto -\mathsf{fma}\left(\log y, 0.5, z\right) \]
            8. Applied rewrites61.1%

              \[\leadsto -\mathsf{fma}\left(\log y, 0.5, z\right) \]
          5. Recombined 2 regimes into one program.
          6. Add Preprocessing

          Alternative 6: 99.0% accurate, 1.0× speedup?

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

            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. lower--.f64N/A

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

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

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

                \[\leadsto x - \mathsf{fma}\left(\log y, \color{blue}{\frac{1}{2}}, z\right) \]
              5. lift-log.f64100.0

                \[\leadsto x - \mathsf{fma}\left(\log y, 0.5, z\right) \]
            5. Applied rewrites100.0%

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

            if 7.6000000000000004e-14 < 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 y around inf

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

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

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

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

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

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

                  \[\leadsto \left(x - y \cdot \log y\right) + \left(y - z\right) \]
                6. metadata-evalN/A

                  \[\leadsto \left(x - y \cdot \log y\right) + \left(y - z\right) \]
                7. metadata-evalN/A

                  \[\leadsto \left(x - y \cdot \log y\right) + \left(y - z\right) \]
                8. metadata-evalN/A

                  \[\leadsto \left(x - y \cdot \log y\right) + \mathsf{Rewrite=>}\left(lower--.f64, \left(y - z\right)\right) \]
              3. Applied rewrites98.0%

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

            Alternative 7: 90.0% accurate, 1.0× speedup?

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

              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. lower--.f64N/A

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

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

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

                  \[\leadsto x - \mathsf{fma}\left(\log y, \color{blue}{\frac{1}{2}}, z\right) \]
                5. lift-log.f6495.3

                  \[\leadsto x - \mathsf{fma}\left(\log y, 0.5, z\right) \]
              5. Applied rewrites95.3%

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

              if 8e51 < 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 \left(\left(x - \color{blue}{y} \cdot \log y\right) + y\right) - z \]
              4. Step-by-step derivation
                1. Applied rewrites99.6%

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

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

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

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

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

                    \[\leadsto \left(x - y \cdot \log y\right) + \left(y - z\right) \]
                  6. metadata-evalN/A

                    \[\leadsto \left(x - y \cdot \log y\right) + \left(y - z\right) \]
                  7. metadata-evalN/A

                    \[\leadsto \left(x - y \cdot \log y\right) + \left(y - z\right) \]
                  8. metadata-evalN/A

                    \[\leadsto \left(x - y \cdot \log y\right) + \mathsf{Rewrite=>}\left(lower--.f64, \left(y - z\right)\right) \]
                3. Applied rewrites99.6%

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

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

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

                Alternative 8: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

                Alternative 9: 84.0% accurate, 1.0× speedup?

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

                  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. lower--.f64N/A

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

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

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

                      \[\leadsto x - \mathsf{fma}\left(\log y, \color{blue}{\frac{1}{2}}, z\right) \]
                    5. lift-log.f6486.4

                      \[\leadsto x - \mathsf{fma}\left(\log y, 0.5, z\right) \]
                  5. Applied rewrites86.4%

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

                  if 9.0000000000000002e153 < 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 0

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

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

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

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

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

                      \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \frac{1}{2} \cdot \log y\right) - z \]
                    6. lift-log.f64N/A

                      \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \frac{1}{2} \cdot \log y\right) - z \]
                    7. log-pow-revN/A

                      \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left({y}^{\frac{1}{2}}\right)\right) - z \]
                    8. lower-log.f64N/A

                      \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left({y}^{\frac{1}{2}}\right)\right) - z \]
                    9. unpow1/2N/A

                      \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left(\sqrt{y}\right)\right) - z \]
                    10. lower-sqrt.f6499.7

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

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

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

                      \[\leadsto y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right) \]
                    2. flip3-+N/A

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

                      \[\leadsto y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right) \]
                    4. metadata-evalN/A

                      \[\leadsto y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right) \]
                    5. associate-+l-N/A

                      \[\leadsto y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right) \]
                    6. *-commutativeN/A

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

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

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

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

                      \[\leadsto \left(1 - \left(-\left(-\log y\right)\right)\right) \cdot y \]
                    3. lift-neg.f64N/A

                      \[\leadsto \left(1 - \left(\mathsf{neg}\left(\left(-\log y\right)\right)\right)\right) \cdot y \]
                    4. lift-neg.f64N/A

                      \[\leadsto \left(1 - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y\right)\right)\right)\right)\right) \cdot y \]
                    5. lift-log.f64N/A

                      \[\leadsto \left(1 - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y\right)\right)\right)\right)\right) \cdot y \]
                    6. *-commutativeN/A

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

                      \[\leadsto y \cdot \left(1 - \log y\right) \]
                  10. Applied rewrites76.5%

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

                Alternative 10: 70.9% accurate, 1.0× speedup?

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

                  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 inf

                    \[\leadsto \color{blue}{x} - z \]
                  4. Step-by-step derivation
                    1. Applied rewrites69.1%

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

                    if 9.0000000000000002e153 < 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 0

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

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

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

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

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

                        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \frac{1}{2} \cdot \log y\right) - z \]
                      6. lift-log.f64N/A

                        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \frac{1}{2} \cdot \log y\right) - z \]
                      7. log-pow-revN/A

                        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left({y}^{\frac{1}{2}}\right)\right) - z \]
                      8. lower-log.f64N/A

                        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left({y}^{\frac{1}{2}}\right)\right) - z \]
                      9. unpow1/2N/A

                        \[\leadsto \left(\mathsf{fma}\left(1 - \log y, y, x\right) - \log \left(\sqrt{y}\right)\right) - z \]
                      10. lower-sqrt.f6499.7

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

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

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

                        \[\leadsto y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right) \]
                      2. flip3-+N/A

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

                        \[\leadsto y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right) \]
                      4. metadata-evalN/A

                        \[\leadsto y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right) \]
                      5. associate-+l-N/A

                        \[\leadsto y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right) \]
                      6. *-commutativeN/A

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

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

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

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

                        \[\leadsto \left(1 - \left(-\left(-\log y\right)\right)\right) \cdot y \]
                      3. lift-neg.f64N/A

                        \[\leadsto \left(1 - \left(\mathsf{neg}\left(\left(-\log y\right)\right)\right)\right) \cdot y \]
                      4. lift-neg.f64N/A

                        \[\leadsto \left(1 - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y\right)\right)\right)\right)\right) \cdot y \]
                      5. lift-log.f64N/A

                        \[\leadsto \left(1 - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log y\right)\right)\right)\right)\right) \cdot y \]
                      6. *-commutativeN/A

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

                        \[\leadsto y \cdot \left(1 - \log y\right) \]
                    10. Applied rewrites76.5%

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

                  Alternative 11: 48.2% accurate, 7.9× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.12 \cdot 10^{+21}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+51}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (if (<= x -1.12e+21) x (if (<= x 7e+51) (- z) x)))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if (x <= -1.12e+21) {
                  		tmp = x;
                  	} else if (x <= 7e+51) {
                  		tmp = -z;
                  	} else {
                  		tmp = x;
                  	}
                  	return tmp;
                  }
                  
                  module fmin_fmax_functions
                      implicit none
                      private
                      public fmax
                      public fmin
                  
                      interface fmax
                          module procedure fmax88
                          module procedure fmax44
                          module procedure fmax84
                          module procedure fmax48
                      end interface
                      interface fmin
                          module procedure fmin88
                          module procedure fmin44
                          module procedure fmin84
                          module procedure fmin48
                      end interface
                  contains
                      real(8) function fmax88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmax44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmax84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmax48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                      end function
                      real(8) function fmin88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmin44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmin84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmin48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                      end function
                  end module
                  
                  real(8) function code(x, y, z)
                  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.12d+21)) then
                          tmp = x
                      else if (x <= 7d+51) then
                          tmp = -z
                      else
                          tmp = x
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double y, double z) {
                  	double tmp;
                  	if (x <= -1.12e+21) {
                  		tmp = x;
                  	} else if (x <= 7e+51) {
                  		tmp = -z;
                  	} else {
                  		tmp = x;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y, z):
                  	tmp = 0
                  	if x <= -1.12e+21:
                  		tmp = x
                  	elif x <= 7e+51:
                  		tmp = -z
                  	else:
                  		tmp = x
                  	return tmp
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if (x <= -1.12e+21)
                  		tmp = x;
                  	elseif (x <= 7e+51)
                  		tmp = Float64(-z);
                  	else
                  		tmp = x;
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y, z)
                  	tmp = 0.0;
                  	if (x <= -1.12e+21)
                  		tmp = x;
                  	elseif (x <= 7e+51)
                  		tmp = -z;
                  	else
                  		tmp = x;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_, z_] := If[LessEqual[x, -1.12e+21], x, If[LessEqual[x, 7e+51], (-z), x]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;x \leq -1.12 \cdot 10^{+21}:\\
                  \;\;\;\;x\\
                  
                  \mathbf{elif}\;x \leq 7 \cdot 10^{+51}:\\
                  \;\;\;\;-z\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;x\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if x < -1.12e21 or 7e51 < 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 x around inf

                      \[\leadsto \color{blue}{x} \]
                    4. Step-by-step derivation
                      1. Applied rewrites61.7%

                        \[\leadsto \color{blue}{x} \]

                      if -1.12e21 < x < 7e51

                      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 z around inf

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

                          \[\leadsto \mathsf{neg}\left(z\right) \]
                        2. lower-neg.f6437.3

                          \[\leadsto -z \]
                      5. Applied rewrites37.3%

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

                    Alternative 12: 57.8% accurate, 29.5× speedup?

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

                      \[\leadsto \color{blue}{x} - z \]
                    4. Step-by-step derivation
                      1. Applied rewrites57.8%

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

                      Alternative 13: 30.2% accurate, 118.0× speedup?

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

                        \[\leadsto \color{blue}{x} \]
                      4. Step-by-step derivation
                        1. Applied rewrites30.2%

                          \[\leadsto \color{blue}{x} \]
                        2. 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 2025088 
                        (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))