Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.9%
Time: 3.7s
Alternatives: 12
Speedup: 1.0×

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

\[\mathsf{fma}\left(-0.5 - y, \log y, y - \left(z - x\right)\right) \]
(FPCore (x y z) :precision binary64 (fma (- -0.5 y) (log y) (- y (- z x))))
double code(double x, double y, double z) {
	return fma((-0.5 - y), log(y), (y - (z - x)));
}
function code(x, y, z)
	return fma(Float64(-0.5 - y), log(y), Float64(y - Float64(z - x)))
end
code[x_, y_, z_] := N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(y - N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(-0.5 - y, \log y, y - \left(z - x\right)\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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 1.0× speedup?

\[\mathsf{fma}\left(-0.5 - y, \log y, x\right) - \left(z - y\right) \]
(FPCore (x y z) :precision binary64 (- (fma (- -0.5 y) (log y) x) (- z y)))
double code(double x, double y, double z) {
	return fma((-0.5 - y), log(y), x) - (z - y);
}
function code(x, y, z)
	return Float64(fma(Float64(-0.5 - y), log(y), x) - Float64(z - y))
end
code[x_, y_, z_] := N[(N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + x), $MachinePrecision] - N[(z - y), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(-0.5 - y, \log y, x\right) - \left(z - y\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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 92.0% accurate, 0.8× speedup?

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

\mathbf{elif}\;x \leq 2.5 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 - y, \log y, y - z\right)\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.3e41

    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-*.f6430.1%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    5. Taylor expanded in z around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x + y\right) + \left(\mathsf{neg}\left(\left(y - \frac{-1}{2}\right)\right)\right) \cdot \log y \]
      9. sub-negate-revN/A

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

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

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

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

        \[\leadsto \left(\frac{-1}{2} - y\right) \cdot \log y + \left(x + y\right) \]
      14. lower-fma.f6470.9%

        \[\leadsto \mathsf{fma}\left(-0.5 - y, \color{blue}{\log y}, x + y\right) \]
      15. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, x + y\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, y + x\right) \]
      17. lower-+.f6470.9%

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

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

    if -3.3e41 < x < 2.50000000000000008e39

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 2.50000000000000008e39 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 4: 90.7% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -3.3e41 < x < 2.50000000000000008e39

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 5: 90.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1.4e53 < y

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto y \cdot \log \left(\frac{1}{y}\right) - \left(z - y\right) \]
          3. lower-/.f6458.9%

            \[\leadsto y \cdot \log \left(\frac{1}{y}\right) - \left(z - y\right) \]
        6. Applied rewrites58.9%

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

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

            \[\leadsto \log \left(\frac{1}{y}\right) \cdot \color{blue}{y} - \left(z - y\right) \]
          3. lower-*.f6458.9%

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

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

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

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

            \[\leadsto \left(\mathsf{neg}\left(\log y\right)\right) \cdot y - \left(z - y\right) \]
          8. lower-neg.f6459.0%

            \[\leadsto \left(-\log y\right) \cdot y - \left(z - y\right) \]
        8. Applied rewrites59.0%

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

      Alternative 6: 89.5% accurate, 1.0× speedup?

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

        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.3%

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(x - \log \left(\frac{1}{{y}^{\frac{-1}{2}}}\right)\right) - z \]
          10. lower-pow.f32N/A

            \[\leadsto \left(x - \log \left(\frac{1}{{y}^{\frac{-1}{2}}}\right)\right) - z \]
          11. lower-unsound-pow.f32N/A

            \[\leadsto \left(x - \log \left(\frac{1}{{y}^{\frac{-1}{2}}}\right)\right) - z \]
          12. lower-/.f32N/A

            \[\leadsto \left(x - \log \left(\frac{1}{{y}^{\frac{-1}{2}}}\right)\right) - z \]
          13. lower-unsound-/.f32N/A

            \[\leadsto \left(x - \log \left(\frac{1}{{y}^{\frac{-1}{2}}}\right)\right) - z \]
          14. pow-negN/A

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

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

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

            \[\leadsto \left(x - \log \left(\sqrt{y}\right)\right) - z \]
          18. lower-sqrt.f6470.3%

            \[\leadsto \left(x - \log \left(\sqrt{y}\right)\right) - z \]
        6. Applied rewrites70.3%

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

        if 1.4e53 < y

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto y \cdot \log \left(\frac{1}{y}\right) - \left(z - y\right) \]
          3. lower-/.f6458.9%

            \[\leadsto y \cdot \log \left(\frac{1}{y}\right) - \left(z - y\right) \]
        6. Applied rewrites58.9%

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

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

            \[\leadsto \log \left(\frac{1}{y}\right) \cdot \color{blue}{y} - \left(z - y\right) \]
          3. lower-*.f6458.9%

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

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

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

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

            \[\leadsto \left(\mathsf{neg}\left(\log y\right)\right) \cdot y - \left(z - y\right) \]
          8. lower-neg.f6459.0%

            \[\leadsto \left(-\log y\right) \cdot y - \left(z - y\right) \]
        8. Applied rewrites59.0%

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

      Alternative 7: 83.7% accurate, 1.2× speedup?

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

        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.3%

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(x - \log \left(\frac{1}{{y}^{\frac{-1}{2}}}\right)\right) - z \]
          10. lower-pow.f32N/A

            \[\leadsto \left(x - \log \left(\frac{1}{{y}^{\frac{-1}{2}}}\right)\right) - z \]
          11. lower-unsound-pow.f32N/A

            \[\leadsto \left(x - \log \left(\frac{1}{{y}^{\frac{-1}{2}}}\right)\right) - z \]
          12. lower-/.f32N/A

            \[\leadsto \left(x - \log \left(\frac{1}{{y}^{\frac{-1}{2}}}\right)\right) - z \]
          13. lower-unsound-/.f32N/A

            \[\leadsto \left(x - \log \left(\frac{1}{{y}^{\frac{-1}{2}}}\right)\right) - z \]
          14. pow-negN/A

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

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

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

            \[\leadsto \left(x - \log \left(\sqrt{y}\right)\right) - z \]
          18. lower-sqrt.f6470.3%

            \[\leadsto \left(x - \log \left(\sqrt{y}\right)\right) - z \]
        6. Applied rewrites70.3%

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

        if 4.6000000000000001e79 < 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 \left(1 - \log y\right) \cdot \color{blue}{y} \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 8: 72.2% accurate, 0.2× speedup?

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

        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 \left(1 - \log y\right) \cdot \color{blue}{y} \]

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

        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-flipN/A

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

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

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

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

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

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

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

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

          \[\leadsto \left(1 - \color{blue}{\frac{z}{x}}\right) \cdot x \]
        5. Step-by-step derivation
          1. lower-/.f6448.3%

            \[\leadsto \left(1 - \frac{z}{\color{blue}{x}}\right) \cdot x \]
        6. Applied rewrites48.3%

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

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

        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.3%

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

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

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

            \[\leadsto \frac{-1}{2} \cdot \log y - z \]
          2. lower-log.f6442.5%

            \[\leadsto -0.5 \cdot \log y - z \]
        7. Applied rewrites42.5%

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

            \[\leadsto \frac{-1}{2} \cdot \log y - z \]
          2. metadata-evalN/A

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

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

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

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

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

            \[\leadsto \left(-\log \left({y}^{\frac{1}{2}}\right)\right) - z \]
          8. unpow1/2N/A

            \[\leadsto \left(-\log \left(\sqrt{y}\right)\right) - z \]
          9. lower-sqrt.f6442.5%

            \[\leadsto \left(-\log \left(\sqrt{y}\right)\right) - z \]
        9. Applied rewrites42.5%

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

      Alternative 9: 69.8% accurate, 1.0× speedup?

      \[\begin{array}{l} t_0 := \left(1 - \frac{z}{x}\right) \cdot x\\ \mathbf{if}\;x \leq -3450:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 42000000:\\ \;\;\;\;\left(-\log \left(\sqrt{y}\right)\right) - z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (* (- 1.0 (/ z x)) x)))
         (if (<= x -3450.0)
           t_0
           (if (<= x 42000000.0) (- (- (log (sqrt y))) z) t_0))))
      double code(double x, double y, double z) {
      	double t_0 = (1.0 - (z / x)) * x;
      	double tmp;
      	if (x <= -3450.0) {
      		tmp = t_0;
      	} else if (x <= 42000000.0) {
      		tmp = -log(sqrt(y)) - z;
      	} 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 = (1.0d0 - (z / x)) * x
          if (x <= (-3450.0d0)) then
              tmp = t_0
          else if (x <= 42000000.0d0) then
              tmp = -log(sqrt(y)) - z
          else
              tmp = t_0
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double t_0 = (1.0 - (z / x)) * x;
      	double tmp;
      	if (x <= -3450.0) {
      		tmp = t_0;
      	} else if (x <= 42000000.0) {
      		tmp = -Math.log(Math.sqrt(y)) - z;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	t_0 = (1.0 - (z / x)) * x
      	tmp = 0
      	if x <= -3450.0:
      		tmp = t_0
      	elif x <= 42000000.0:
      		tmp = -math.log(math.sqrt(y)) - z
      	else:
      		tmp = t_0
      	return tmp
      
      function code(x, y, z)
      	t_0 = Float64(Float64(1.0 - Float64(z / x)) * x)
      	tmp = 0.0
      	if (x <= -3450.0)
      		tmp = t_0;
      	elseif (x <= 42000000.0)
      		tmp = Float64(Float64(-log(sqrt(y))) - z);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = (1.0 - (z / x)) * x;
      	tmp = 0.0;
      	if (x <= -3450.0)
      		tmp = t_0;
      	elseif (x <= 42000000.0)
      		tmp = -log(sqrt(y)) - z;
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 - N[(z / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -3450.0], t$95$0, If[LessEqual[x, 42000000.0], N[((-N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]) - z), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      t_0 := \left(1 - \frac{z}{x}\right) \cdot x\\
      \mathbf{if}\;x \leq -3450:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 42000000:\\
      \;\;\;\;\left(-\log \left(\sqrt{y}\right)\right) - z\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < -3450 or 4.2e7 < x

        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-flipN/A

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

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

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

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

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

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

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

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

          \[\leadsto \left(1 - \color{blue}{\frac{z}{x}}\right) \cdot x \]
        5. Step-by-step derivation
          1. lower-/.f6448.3%

            \[\leadsto \left(1 - \frac{z}{\color{blue}{x}}\right) \cdot x \]
        6. Applied rewrites48.3%

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

        if -3450 < x < 4.2e7

        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.3%

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

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

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

            \[\leadsto \frac{-1}{2} \cdot \log y - z \]
          2. lower-log.f6442.5%

            \[\leadsto -0.5 \cdot \log y - z \]
        7. Applied rewrites42.5%

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

            \[\leadsto \frac{-1}{2} \cdot \log y - z \]
          2. metadata-evalN/A

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

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

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

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

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

            \[\leadsto \left(-\log \left({y}^{\frac{1}{2}}\right)\right) - z \]
          8. unpow1/2N/A

            \[\leadsto \left(-\log \left(\sqrt{y}\right)\right) - z \]
          9. lower-sqrt.f6442.5%

            \[\leadsto \left(-\log \left(\sqrt{y}\right)\right) - z \]
        9. Applied rewrites42.5%

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

      Alternative 10: 57.4% accurate, 1.2× speedup?

      \[\begin{array}{l} t_0 := \left(1 - \frac{z}{x}\right) \cdot x\\ \mathbf{if}\;x \leq -1520:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{-75}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (* (- 1.0 (/ z x)) x)))
         (if (<= x -1520.0) t_0 (if (<= x 7.5e-75) (- z) t_0))))
      double code(double x, double y, double z) {
      	double t_0 = (1.0 - (z / x)) * x;
      	double tmp;
      	if (x <= -1520.0) {
      		tmp = t_0;
      	} else if (x <= 7.5e-75) {
      		tmp = -z;
      	} 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 = (1.0d0 - (z / x)) * x
          if (x <= (-1520.0d0)) then
              tmp = t_0
          else if (x <= 7.5d-75) then
              tmp = -z
          else
              tmp = t_0
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double t_0 = (1.0 - (z / x)) * x;
      	double tmp;
      	if (x <= -1520.0) {
      		tmp = t_0;
      	} else if (x <= 7.5e-75) {
      		tmp = -z;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	t_0 = (1.0 - (z / x)) * x
      	tmp = 0
      	if x <= -1520.0:
      		tmp = t_0
      	elif x <= 7.5e-75:
      		tmp = -z
      	else:
      		tmp = t_0
      	return tmp
      
      function code(x, y, z)
      	t_0 = Float64(Float64(1.0 - Float64(z / x)) * x)
      	tmp = 0.0
      	if (x <= -1520.0)
      		tmp = t_0;
      	elseif (x <= 7.5e-75)
      		tmp = Float64(-z);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = (1.0 - (z / x)) * x;
      	tmp = 0.0;
      	if (x <= -1520.0)
      		tmp = t_0;
      	elseif (x <= 7.5e-75)
      		tmp = -z;
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 - N[(z / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1520.0], t$95$0, If[LessEqual[x, 7.5e-75], (-z), t$95$0]]]
      
      \begin{array}{l}
      t_0 := \left(1 - \frac{z}{x}\right) \cdot x\\
      \mathbf{if}\;x \leq -1520:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 7.5 \cdot 10^{-75}:\\
      \;\;\;\;-z\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < -1520 or 7.50000000000000017e-75 < x

        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-flipN/A

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

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

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

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

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

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

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

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

          \[\leadsto \left(1 - \color{blue}{\frac{z}{x}}\right) \cdot x \]
        5. Step-by-step derivation
          1. lower-/.f6448.3%

            \[\leadsto \left(1 - \frac{z}{\color{blue}{x}}\right) \cdot x \]
        6. Applied rewrites48.3%

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

        if -1520 < x < 7.50000000000000017e-75

        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-*.f6430.1%

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

          \[\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. lift-neg.f6430.1%

            \[\leadsto -z \]
        6. Applied rewrites30.1%

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

      Alternative 11: 48.3% accurate, 1.8× speedup?

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

        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-flipN/A

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{1} \cdot x \]
        5. Step-by-step derivation
          1. Applied rewrites29.7%

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

          if -5.9999999999999999e39 < x < 2.65000000000000014e42

          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-*.f6430.1%

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

            \[\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. lift-neg.f6430.1%

              \[\leadsto -z \]
          6. Applied rewrites30.1%

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

        Alternative 12: 30.1% 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-*.f6430.1%

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

          \[\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. lift-neg.f6430.1%

            \[\leadsto -z \]
        6. Applied rewrites30.1%

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

        Reproduce

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