Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.8%
Time: 3.6s
Alternatives: 10
Speedup: N/A×

Specification

?
\[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
(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]
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
  2. 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. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 89.1% accurate, 0.8× speedup?

\[\begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{+122}:\\ \;\;\;\;y - \mathsf{fma}\left(\log y, y - -0.5, z\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+41}:\\ \;\;\;\;y - \left(\left(y - -0.5\right) \cdot \log y - x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - 0.5 \cdot \log y\right) - z\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -1.25e+122)
   (- y (fma (log y) (- y -0.5) z))
   (if (<= z 1.8e+41)
     (- y (- (* (- y -0.5) (log y)) x))
     (- (- x (* 0.5 (log y))) z))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.25e+122) {
		tmp = y - fma(log(y), (y - -0.5), z);
	} else if (z <= 1.8e+41) {
		tmp = y - (((y - -0.5) * log(y)) - x);
	} else {
		tmp = (x - (0.5 * log(y))) - z;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (z <= -1.25e+122)
		tmp = Float64(y - fma(log(y), Float64(y - -0.5), z));
	elseif (z <= 1.8e+41)
		tmp = Float64(y - Float64(Float64(Float64(y - -0.5) * log(y)) - x));
	else
		tmp = Float64(Float64(x - Float64(0.5 * log(y))) - z);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[z, -1.25e+122], N[(y - N[(N[Log[y], $MachinePrecision] * N[(y - -0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e+41], N[(y - N[(N[(N[(y - -0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(0.5 * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+122}:\\
\;\;\;\;y - \mathsf{fma}\left(\log y, y - -0.5, z\right)\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{+41}:\\
\;\;\;\;y - \left(\left(y - -0.5\right) \cdot \log y - x\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x - 0.5 \cdot \log y\right) - z\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.24999999999999997e122

    1. Initial program 99.8%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. 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. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y - \mathsf{fma}\left(\log y, y - -0.5, \color{blue}{z}\right) \]
    5. Step-by-step derivation
      1. Applied rewrites70.9%

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

      if -1.24999999999999997e122 < z < 1.80000000000000013e41

      1. Initial program 99.8%

        \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
      2. 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. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto y - \left(\log y \cdot \left(\frac{1}{2} + y\right) - x\right) \]
        4. lower-+.f6471.1%

          \[\leadsto y - \left(\log y \cdot \left(0.5 + y\right) - x\right) \]
      6. Applied rewrites71.1%

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

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

          \[\leadsto y - \left(\left(\frac{1}{2} + y\right) \cdot \log y - x\right) \]
        3. lower-*.f6471.1%

          \[\leadsto y - \left(\left(0.5 + y\right) \cdot \log y - x\right) \]
        4. lift-+.f64N/A

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

          \[\leadsto y - \left(\left(y + \frac{1}{2}\right) \cdot \log y - x\right) \]
        6. add-flipN/A

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

          \[\leadsto y - \left(\left(y - \frac{-1}{2}\right) \cdot \log y - x\right) \]
        8. lower--.f6471.1%

          \[\leadsto y - \left(\left(y - -0.5\right) \cdot \log y - x\right) \]
      8. Applied rewrites71.1%

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

      if 1.80000000000000013e41 < z

      1. Initial program 99.8%

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

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

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

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

          \[\leadsto \left(x - 0.5 \cdot \log y\right) - z \]
      4. Applied rewrites70.5%

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

    Alternative 3: 88.9% accurate, 0.8× speedup?

    \[\begin{array}{l} t_0 := x \cdot 1 - z\\ \mathbf{if}\;x \leq -6.9 \cdot 10^{+44}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{+102}:\\ \;\;\;\;y - \mathsf{fma}\left(\log y, y - -0.5, z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (- (* x 1.0) z)))
       (if (<= x -6.9e+44)
         t_0
         (if (<= x 4.2e+102) (- y (fma (log y) (- y -0.5) z)) t_0))))
    double code(double x, double y, double z) {
    	double t_0 = (x * 1.0) - z;
    	double tmp;
    	if (x <= -6.9e+44) {
    		tmp = t_0;
    	} else if (x <= 4.2e+102) {
    		tmp = y - fma(log(y), (y - -0.5), z);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = Float64(Float64(x * 1.0) - z)
    	tmp = 0.0
    	if (x <= -6.9e+44)
    		tmp = t_0;
    	elseif (x <= 4.2e+102)
    		tmp = Float64(y - fma(log(y), Float64(y - -0.5), z));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * 1.0), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[x, -6.9e+44], t$95$0, If[LessEqual[x, 4.2e+102], N[(y - N[(N[Log[y], $MachinePrecision] * N[(y - -0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    t_0 := x \cdot 1 - z\\
    \mathbf{if}\;x \leq -6.9 \cdot 10^{+44}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 4.2 \cdot 10^{+102}:\\
    \;\;\;\;y - \mathsf{fma}\left(\log y, y - -0.5, z\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -6.8999999999999997e44 or 4.20000000000000003e102 < x

      1. Initial program 99.8%

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

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

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

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

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

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

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

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

          \[\leadsto x \cdot \left(\left(1 + \frac{y}{x}\right) - \frac{\log y \cdot \left(\frac{1}{2} + y\right)}{x}\right) - z \]
        8. lower-+.f6487.2%

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

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

        \[\leadsto x \cdot 1 - z \]
      6. Step-by-step derivation
        1. Applied rewrites57.9%

          \[\leadsto x \cdot 1 - z \]

        if -6.8999999999999997e44 < x < 4.20000000000000003e102

        1. Initial program 99.8%

          \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
        2. 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. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto y - \mathsf{fma}\left(\log y, y - -0.5, \color{blue}{z}\right) \]
        5. Step-by-step derivation
          1. Applied rewrites70.9%

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

        Alternative 4: 83.1% accurate, 1.1× speedup?

        \[\begin{array}{l} \mathbf{if}\;y \leq 6.6 \cdot 10^{+168}:\\ \;\;\;\;\left(x - 0.5 \cdot \log y\right) - z\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \log y\right) \cdot y\\ \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y 6.6e+168) (- (- x (* 0.5 (log y))) z) (* (- 1.0 (log y)) y)))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= 6.6e+168) {
        		tmp = (x - (0.5 * log(y))) - 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 <= 6.6d+168) then
                tmp = (x - (0.5d0 * log(y))) - 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 <= 6.6e+168) {
        		tmp = (x - (0.5 * Math.log(y))) - z;
        	} else {
        		tmp = (1.0 - Math.log(y)) * y;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if y <= 6.6e+168:
        		tmp = (x - (0.5 * math.log(y))) - z
        	else:
        		tmp = (1.0 - math.log(y)) * y
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= 6.6e+168)
        		tmp = Float64(Float64(x - Float64(0.5 * log(y))) - 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 <= 6.6e+168)
        		tmp = (x - (0.5 * log(y))) - z;
        	else
        		tmp = (1.0 - log(y)) * y;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[y, 6.6e+168], N[(N[(x - N[(0.5 * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
        
        \begin{array}{l}
        \mathbf{if}\;y \leq 6.6 \cdot 10^{+168}:\\
        \;\;\;\;\left(x - 0.5 \cdot \log y\right) - z\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(1 - \log y\right) \cdot y\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < 6.5999999999999997e168

          1. Initial program 99.8%

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

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

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

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

              \[\leadsto \left(x - 0.5 \cdot \log y\right) - z \]
          4. Applied rewrites70.5%

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

          if 6.5999999999999997e168 < y

          1. Initial program 99.8%

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

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

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

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

              \[\leadsto y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right) \]
            4. lower-/.f6431.0%

              \[\leadsto y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right) \]
          4. Applied rewrites31.0%

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

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

              \[\leadsto \left(1 + \log \left(\frac{1}{y}\right)\right) \cdot \color{blue}{y} \]
            3. lower-*.f6431.0%

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

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

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

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

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

              \[\leadsto \left(1 + \left(\mathsf{neg}\left(\log y\right)\right)\right) \cdot y \]
            9. sub-flip-reverseN/A

              \[\leadsto \left(1 - \log y\right) \cdot y \]
            10. lower--.f6431.0%

              \[\leadsto \left(1 - \log y\right) \cdot y \]
          6. Applied rewrites31.0%

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

        Alternative 5: 70.6% accurate, 0.2× speedup?

        \[\begin{array}{l} t_0 := \left(1 - \log y\right) \cdot y\\ t_1 := \left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z\\ t_2 := x \cdot 1 - z\\ \mathbf{if}\;t\_1 \leq -8 \cdot 10^{+247}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq -5 \cdot 10^{+44}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq -10000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 500:\\ \;\;\;\;y - \log y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (let* ((t_0 (* (- 1.0 (log y)) y))
                (t_1 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
                (t_2 (- (* x 1.0) z)))
           (if (<= t_1 -8e+247)
             t_0
             (if (<= t_1 -5e+44)
               t_2
               (if (<= t_1 -10000.0)
                 t_0
                 (if (<= t_1 500.0) (- y (* (log y) 0.5)) t_2))))))
        double code(double x, double y, double z) {
        	double t_0 = (1.0 - log(y)) * y;
        	double t_1 = ((x - ((y + 0.5) * log(y))) + y) - z;
        	double t_2 = (x * 1.0) - z;
        	double tmp;
        	if (t_1 <= -8e+247) {
        		tmp = t_0;
        	} else if (t_1 <= -5e+44) {
        		tmp = t_2;
        	} else if (t_1 <= -10000.0) {
        		tmp = t_0;
        	} else if (t_1 <= 500.0) {
        		tmp = y - (log(y) * 0.5);
        	} else {
        		tmp = t_2;
        	}
        	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) :: t_1
            real(8) :: t_2
            real(8) :: tmp
            t_0 = (1.0d0 - log(y)) * y
            t_1 = ((x - ((y + 0.5d0) * log(y))) + y) - z
            t_2 = (x * 1.0d0) - z
            if (t_1 <= (-8d+247)) then
                tmp = t_0
            else if (t_1 <= (-5d+44)) then
                tmp = t_2
            else if (t_1 <= (-10000.0d0)) then
                tmp = t_0
            else if (t_1 <= 500.0d0) then
                tmp = y - (log(y) * 0.5d0)
            else
                tmp = t_2
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double t_0 = (1.0 - Math.log(y)) * y;
        	double t_1 = ((x - ((y + 0.5) * Math.log(y))) + y) - z;
        	double t_2 = (x * 1.0) - z;
        	double tmp;
        	if (t_1 <= -8e+247) {
        		tmp = t_0;
        	} else if (t_1 <= -5e+44) {
        		tmp = t_2;
        	} else if (t_1 <= -10000.0) {
        		tmp = t_0;
        	} else if (t_1 <= 500.0) {
        		tmp = y - (Math.log(y) * 0.5);
        	} else {
        		tmp = t_2;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	t_0 = (1.0 - math.log(y)) * y
        	t_1 = ((x - ((y + 0.5) * math.log(y))) + y) - z
        	t_2 = (x * 1.0) - z
        	tmp = 0
        	if t_1 <= -8e+247:
        		tmp = t_0
        	elif t_1 <= -5e+44:
        		tmp = t_2
        	elif t_1 <= -10000.0:
        		tmp = t_0
        	elif t_1 <= 500.0:
        		tmp = y - (math.log(y) * 0.5)
        	else:
        		tmp = t_2
        	return tmp
        
        function code(x, y, z)
        	t_0 = Float64(Float64(1.0 - log(y)) * y)
        	t_1 = Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z)
        	t_2 = Float64(Float64(x * 1.0) - z)
        	tmp = 0.0
        	if (t_1 <= -8e+247)
        		tmp = t_0;
        	elseif (t_1 <= -5e+44)
        		tmp = t_2;
        	elseif (t_1 <= -10000.0)
        		tmp = t_0;
        	elseif (t_1 <= 500.0)
        		tmp = Float64(y - Float64(log(y) * 0.5));
        	else
        		tmp = t_2;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	t_0 = (1.0 - log(y)) * y;
        	t_1 = ((x - ((y + 0.5) * log(y))) + y) - z;
        	t_2 = (x * 1.0) - z;
        	tmp = 0.0;
        	if (t_1 <= -8e+247)
        		tmp = t_0;
        	elseif (t_1 <= -5e+44)
        		tmp = t_2;
        	elseif (t_1 <= -10000.0)
        		tmp = t_0;
        	elseif (t_1 <= 500.0)
        		tmp = y - (log(y) * 0.5);
        	else
        		tmp = t_2;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 1.0), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$1, -8e+247], t$95$0, If[LessEqual[t$95$1, -5e+44], t$95$2, If[LessEqual[t$95$1, -10000.0], t$95$0, If[LessEqual[t$95$1, 500.0], N[(y - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
        
        \begin{array}{l}
        t_0 := \left(1 - \log y\right) \cdot y\\
        t_1 := \left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z\\
        t_2 := x \cdot 1 - z\\
        \mathbf{if}\;t\_1 \leq -8 \cdot 10^{+247}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;t\_1 \leq -5 \cdot 10^{+44}:\\
        \;\;\;\;t\_2\\
        
        \mathbf{elif}\;t\_1 \leq -10000:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;t\_1 \leq 500:\\
        \;\;\;\;y - \log y \cdot 0.5\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_2\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < -7.99999999999999962e247 or -4.9999999999999996e44 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < -1e4

          1. Initial program 99.8%

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

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

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

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

              \[\leadsto y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right) \]
            4. lower-/.f6431.0%

              \[\leadsto y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right) \]
          4. Applied rewrites31.0%

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

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

              \[\leadsto \left(1 + \log \left(\frac{1}{y}\right)\right) \cdot \color{blue}{y} \]
            3. lower-*.f6431.0%

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

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

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

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

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

              \[\leadsto \left(1 + \left(\mathsf{neg}\left(\log y\right)\right)\right) \cdot y \]
            9. sub-flip-reverseN/A

              \[\leadsto \left(1 - \log y\right) \cdot y \]
            10. lower--.f6431.0%

              \[\leadsto \left(1 - \log y\right) \cdot y \]
          6. Applied rewrites31.0%

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

          if -7.99999999999999962e247 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < -4.9999999999999996e44 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. Taylor expanded in x around inf

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

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

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

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

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

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

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

              \[\leadsto x \cdot \left(\left(1 + \frac{y}{x}\right) - \frac{\log y \cdot \left(\frac{1}{2} + y\right)}{x}\right) - z \]
            8. lower-+.f6487.2%

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

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

            \[\leadsto x \cdot 1 - z \]
          6. Step-by-step derivation
            1. Applied rewrites57.9%

              \[\leadsto x \cdot 1 - z \]

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

            1. Initial program 99.8%

              \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
            2. 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. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto y - \left(\log y \cdot \left(\frac{1}{2} + y\right) - x\right) \]
              4. lower-+.f6471.1%

                \[\leadsto y - \left(\log y \cdot \left(0.5 + y\right) - x\right) \]
            6. Applied rewrites71.1%

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

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

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

                \[\leadsto y - \log y \cdot \left(\frac{1}{2} + y\right) \]
              3. lower-+.f6442.7%

                \[\leadsto y - \log y \cdot \left(0.5 + y\right) \]
            9. Applied rewrites42.7%

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

              \[\leadsto y - \log y \cdot \frac{1}{2} \]
            11. Step-by-step derivation
              1. Applied rewrites13.7%

                \[\leadsto y - \log y \cdot 0.5 \]
            12. Recombined 3 regimes into one program.
            13. Add Preprocessing

            Alternative 6: 69.3% accurate, 0.9× speedup?

            \[\begin{array}{l} t_0 := x \cdot 1 - z\\ \mathbf{if}\;x \leq -7.5 \cdot 10^{-93}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 0.029:\\ \;\;\;\;y - \left(y - -0.5\right) \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (- (* x 1.0) z)))
               (if (<= x -7.5e-93)
                 t_0
                 (if (<= x 0.029) (- y (* (- y -0.5) (log y))) t_0))))
            double code(double x, double y, double z) {
            	double t_0 = (x * 1.0) - z;
            	double tmp;
            	if (x <= -7.5e-93) {
            		tmp = t_0;
            	} else if (x <= 0.029) {
            		tmp = y - ((y - -0.5) * log(y));
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y, z)
            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 * 1.0d0) - z
                if (x <= (-7.5d-93)) then
                    tmp = t_0
                else if (x <= 0.029d0) then
                    tmp = y - ((y - (-0.5d0)) * log(y))
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = (x * 1.0) - z;
            	double tmp;
            	if (x <= -7.5e-93) {
            		tmp = t_0;
            	} else if (x <= 0.029) {
            		tmp = y - ((y - -0.5) * Math.log(y));
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = (x * 1.0) - z
            	tmp = 0
            	if x <= -7.5e-93:
            		tmp = t_0
            	elif x <= 0.029:
            		tmp = y - ((y - -0.5) * math.log(y))
            	else:
            		tmp = t_0
            	return tmp
            
            function code(x, y, z)
            	t_0 = Float64(Float64(x * 1.0) - z)
            	tmp = 0.0
            	if (x <= -7.5e-93)
            		tmp = t_0;
            	elseif (x <= 0.029)
            		tmp = Float64(y - Float64(Float64(y - -0.5) * log(y)));
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = (x * 1.0) - z;
            	tmp = 0.0;
            	if (x <= -7.5e-93)
            		tmp = t_0;
            	elseif (x <= 0.029)
            		tmp = y - ((y - -0.5) * log(y));
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * 1.0), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[x, -7.5e-93], t$95$0, If[LessEqual[x, 0.029], N[(y - N[(N[(y - -0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            t_0 := x \cdot 1 - z\\
            \mathbf{if}\;x \leq -7.5 \cdot 10^{-93}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;x \leq 0.029:\\
            \;\;\;\;y - \left(y - -0.5\right) \cdot \log y\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if x < -7.50000000000000034e-93 or 0.0290000000000000015 < x

              1. Initial program 99.8%

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

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

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

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

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

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

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

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

                  \[\leadsto x \cdot \left(\left(1 + \frac{y}{x}\right) - \frac{\log y \cdot \left(\frac{1}{2} + y\right)}{x}\right) - z \]
                8. lower-+.f6487.2%

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

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

                \[\leadsto x \cdot 1 - z \]
              6. Step-by-step derivation
                1. Applied rewrites57.9%

                  \[\leadsto x \cdot 1 - z \]

                if -7.50000000000000034e-93 < x < 0.0290000000000000015

                1. Initial program 99.8%

                  \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                2. 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. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto y - \left(\log y \cdot \left(\frac{1}{2} + y\right) - x\right) \]
                  4. lower-+.f6471.1%

                    \[\leadsto y - \left(\log y \cdot \left(0.5 + y\right) - x\right) \]
                6. Applied rewrites71.1%

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

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

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

                    \[\leadsto y - \log y \cdot \left(\frac{1}{2} + y\right) \]
                  3. lower-+.f6442.7%

                    \[\leadsto y - \log y \cdot \left(0.5 + y\right) \]
                9. Applied rewrites42.7%

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

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

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

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

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

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

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

                    \[\leadsto y - \left(y - \frac{-1}{2}\right) \cdot \log y \]
                  8. lower--.f6442.7%

                    \[\leadsto y - \left(y - -0.5\right) \cdot \log y \]
                11. Applied rewrites42.7%

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

              Alternative 7: 68.5% accurate, 1.3× speedup?

              \[\begin{array}{l} \mathbf{if}\;y \leq 6.6 \cdot 10^{+168}:\\ \;\;\;\;x \cdot 1 - z\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \log y\right) \cdot y\\ \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (<= y 6.6e+168) (- (* x 1.0) z) (* (- 1.0 (log y)) y)))
              double code(double x, double y, double z) {
              	double tmp;
              	if (y <= 6.6e+168) {
              		tmp = (x * 1.0) - 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 <= 6.6d+168) then
                      tmp = (x * 1.0d0) - 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 <= 6.6e+168) {
              		tmp = (x * 1.0) - z;
              	} else {
              		tmp = (1.0 - Math.log(y)) * y;
              	}
              	return tmp;
              }
              
              def code(x, y, z):
              	tmp = 0
              	if y <= 6.6e+168:
              		tmp = (x * 1.0) - z
              	else:
              		tmp = (1.0 - math.log(y)) * y
              	return tmp
              
              function code(x, y, z)
              	tmp = 0.0
              	if (y <= 6.6e+168)
              		tmp = Float64(Float64(x * 1.0) - 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 <= 6.6e+168)
              		tmp = (x * 1.0) - z;
              	else
              		tmp = (1.0 - log(y)) * y;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_] := If[LessEqual[y, 6.6e+168], N[(N[(x * 1.0), $MachinePrecision] - z), $MachinePrecision], N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
              
              \begin{array}{l}
              \mathbf{if}\;y \leq 6.6 \cdot 10^{+168}:\\
              \;\;\;\;x \cdot 1 - z\\
              
              \mathbf{else}:\\
              \;\;\;\;\left(1 - \log y\right) \cdot y\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if y < 6.5999999999999997e168

                1. Initial program 99.8%

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

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

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

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

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

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

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

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

                    \[\leadsto x \cdot \left(\left(1 + \frac{y}{x}\right) - \frac{\log y \cdot \left(\frac{1}{2} + y\right)}{x}\right) - z \]
                  8. lower-+.f6487.2%

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

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

                  \[\leadsto x \cdot 1 - z \]
                6. Step-by-step derivation
                  1. Applied rewrites57.9%

                    \[\leadsto x \cdot 1 - z \]

                  if 6.5999999999999997e168 < y

                  1. Initial program 99.8%

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

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

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

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

                      \[\leadsto y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right) \]
                    4. lower-/.f6431.0%

                      \[\leadsto y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right) \]
                  4. Applied rewrites31.0%

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

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

                      \[\leadsto \left(1 + \log \left(\frac{1}{y}\right)\right) \cdot \color{blue}{y} \]
                    3. lower-*.f6431.0%

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

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

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

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

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

                      \[\leadsto \left(1 + \left(\mathsf{neg}\left(\log y\right)\right)\right) \cdot y \]
                    9. sub-flip-reverseN/A

                      \[\leadsto \left(1 - \log y\right) \cdot y \]
                    10. lower--.f6431.0%

                      \[\leadsto \left(1 - \log y\right) \cdot y \]
                  6. Applied rewrites31.0%

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

                Alternative 8: 57.9% accurate, 3.1× speedup?

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

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

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

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

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

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

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

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

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

                    \[\leadsto x \cdot \left(\left(1 + \frac{y}{x}\right) - \frac{\log y \cdot \left(\frac{1}{2} + y\right)}{x}\right) - z \]
                  8. lower-+.f6487.2%

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

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

                  \[\leadsto x \cdot 1 - z \]
                6. Step-by-step derivation
                  1. Applied rewrites57.9%

                    \[\leadsto x \cdot 1 - z \]
                  2. Add Preprocessing

                  Alternative 9: 47.8% accurate, 1.7× speedup?

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

                    1. Initial program 99.8%

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

                      \[\leadsto \color{blue}{-1 \cdot z} \]
                    3. Step-by-step derivation
                      1. lower-*.f6429.9%

                        \[\leadsto -1 \cdot \color{blue}{z} \]
                    4. Applied rewrites29.9%

                      \[\leadsto \color{blue}{-1 \cdot z} \]
                    5. Step-by-step derivation
                      1. lift-*.f64N/A

                        \[\leadsto -1 \cdot \color{blue}{z} \]
                      2. mul-1-negN/A

                        \[\leadsto \mathsf{neg}\left(z\right) \]
                      3. lower-neg.f6429.9%

                        \[\leadsto -z \]
                    6. Applied rewrites29.9%

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

                    if -1.24999999999999997e122 < z < 6.5000000000000001e39

                    1. Initial program 99.8%

                      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                    2. 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. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto y - \color{blue}{-1 \cdot x} \]
                    5. Step-by-step derivation
                      1. lower-*.f6429.7%

                        \[\leadsto y - -1 \cdot \color{blue}{x} \]
                    6. Applied rewrites29.7%

                      \[\leadsto y - \color{blue}{-1 \cdot x} \]
                    7. Step-by-step derivation
                      1. lift-*.f64N/A

                        \[\leadsto y - -1 \cdot \color{blue}{x} \]
                      2. mul-1-negN/A

                        \[\leadsto y - \left(\mathsf{neg}\left(x\right)\right) \]
                      3. lower-neg.f6429.7%

                        \[\leadsto y - \left(-x\right) \]
                    8. Applied rewrites29.7%

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

                  Alternative 10: 29.9% accurate, 10.4× speedup?

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

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

                    \[\leadsto \color{blue}{-1 \cdot z} \]
                  3. Step-by-step derivation
                    1. lower-*.f6429.9%

                      \[\leadsto -1 \cdot \color{blue}{z} \]
                  4. Applied rewrites29.9%

                    \[\leadsto \color{blue}{-1 \cdot z} \]
                  5. Step-by-step derivation
                    1. lift-*.f64N/A

                      \[\leadsto -1 \cdot \color{blue}{z} \]
                    2. mul-1-negN/A

                      \[\leadsto \mathsf{neg}\left(z\right) \]
                    3. lower-neg.f6429.9%

                      \[\leadsto -z \]
                  6. Applied rewrites29.9%

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

                  Reproduce

                  ?
                  herbie shell --seed 2025187 
                  (FPCore (x y z)
                    :name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
                    :precision binary64
                    (- (+ (- x (* (+ y 0.5) (log y))) y) z))