Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.8%
Time: 5.1s
Alternatives: 13
Speedup: N/A×

Specification

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

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

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x + y\right) - \mathsf{fma}\left(0.5 + y, \log y, z\right) \end{array} \]
(FPCore (x y z) :precision binary64 (- (+ x y) (fma (+ 0.5 y) (log y) z)))
double code(double x, double y, double z) {
	return (x + y) - fma((0.5 + y), log(y), z);
}
function code(x, y, z)
	return Float64(Float64(x + y) - fma(Float64(0.5 + y), log(y), z))
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] - N[(N[(0.5 + y), $MachinePrecision] * N[Log[y], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + y\right) - \mathsf{fma}\left(0.5 + y, \log y, z\right)
\end{array}
Derivation
  1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 73.4% accurate, 0.3× speedup?

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

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

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

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


\end{array}
\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) < -2e27

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(-x\right) \cdot -1 + y\right) - z \]
      7. Step-by-step derivation
        1. Applied rewrites99.4%

          \[\leadsto \left(\left(-x\right) \cdot -1 + y\right) - z \]
      8. Recombined 3 regimes into one program.
      9. Add Preprocessing

      Alternative 3: 73.4% accurate, 0.3× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x - \left(y + 0.5\right) \cdot \log y\right) + y\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{+27}:\\ \;\;\;\;\left(1 - \log y\right) \cdot y\\ \mathbf{elif}\;t\_0 \leq 349.5:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-x\right) \cdot -1 + y\right) - z\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (+ (- x (* (+ y 0.5) (log y))) y)))
         (if (<= t_0 -2e+27)
           (* (- 1.0 (log y)) y)
           (if (<= t_0 349.5) (fma -0.5 (log y) (- z)) (- (+ (* (- x) -1.0) y) z)))))
      double code(double x, double y, double z) {
      	double t_0 = (x - ((y + 0.5) * log(y))) + y;
      	double tmp;
      	if (t_0 <= -2e+27) {
      		tmp = (1.0 - log(y)) * y;
      	} else if (t_0 <= 349.5) {
      		tmp = fma(-0.5, log(y), -z);
      	} else {
      		tmp = ((-x * -1.0) + y) - z;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	t_0 = Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y)
      	tmp = 0.0
      	if (t_0 <= -2e+27)
      		tmp = Float64(Float64(1.0 - log(y)) * y);
      	elseif (t_0 <= 349.5)
      		tmp = fma(-0.5, log(y), Float64(-z));
      	else
      		tmp = Float64(Float64(Float64(Float64(-x) * -1.0) + y) - z);
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+27], N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$0, 349.5], N[(-0.5 * N[Log[y], $MachinePrecision] + (-z)), $MachinePrecision], N[(N[(N[((-x) * -1.0), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \left(x - \left(y + 0.5\right) \cdot \log y\right) + y\\
      \mathbf{if}\;t\_0 \leq -2 \cdot 10^{+27}:\\
      \;\;\;\;\left(1 - \log y\right) \cdot y\\
      
      \mathbf{elif}\;t\_0 \leq 349.5:\\
      \;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(\left(-x\right) \cdot -1 + y\right) - z\\
      
      
      \end{array}
      \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) < -2e27

        1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\left(-x\right) \cdot -1 + y\right) - z \]
          7. Step-by-step derivation
            1. Applied rewrites99.4%

              \[\leadsto \left(\left(-x\right) \cdot -1 + y\right) - z \]
          8. Recombined 3 regimes into one program.
          9. Add Preprocessing

          Alternative 4: 89.8% accurate, 0.9× speedup?

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

            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if 8.9999999999999998e27 < y < 5.1999999999999996e130

              1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if 5.1999999999999996e130 < y

              1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 5: 69.5% accurate, 1.0× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4000000 \lor \neg \left(x \leq 1650\right):\\ \;\;\;\;\left(\left(-x\right) \cdot -1 + y\right) - z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (or (<= x -4000000.0) (not (<= x 1650.0)))
               (- (+ (* (- x) -1.0) y) z)
               (fma -0.5 (log y) (- z))))
            double code(double x, double y, double z) {
            	double tmp;
            	if ((x <= -4000000.0) || !(x <= 1650.0)) {
            		tmp = ((-x * -1.0) + y) - z;
            	} else {
            		tmp = fma(-0.5, log(y), -z);
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if ((x <= -4000000.0) || !(x <= 1650.0))
            		tmp = Float64(Float64(Float64(Float64(-x) * -1.0) + y) - z);
            	else
            		tmp = fma(-0.5, log(y), Float64(-z));
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[Or[LessEqual[x, -4000000.0], N[Not[LessEqual[x, 1650.0]], $MachinePrecision]], N[(N[(N[((-x) * -1.0), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision], N[(-0.5 * N[Log[y], $MachinePrecision] + (-z)), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;x \leq -4000000 \lor \neg \left(x \leq 1650\right):\\
            \;\;\;\;\left(\left(-x\right) \cdot -1 + y\right) - z\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if x < -4e6 or 1650 < x

              1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(\left(-x\right) \cdot -1 + y\right) - z \]
              7. Step-by-step derivation
                1. Applied rewrites74.9%

                  \[\leadsto \left(\left(-x\right) \cdot -1 + y\right) - z \]

                if -4e6 < x < 1650

                1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(-0.5, \color{blue}{\log y}, -z\right) \]
                8. Recombined 2 regimes into one program.
                9. Final simplification70.1%

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

                Alternative 6: 99.3% accurate, 1.0× speedup?

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

                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    if 0.17999999999999999 < y

                    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 7: 89.8% accurate, 1.0× speedup?

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

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      if 8.9999999999999998e27 < y

                      1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 8: 89.9% accurate, 1.0× speedup?

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

                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

                      if 8.9999999999999998e27 < y

                      1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 9: 84.7% accurate, 1.0× speedup?

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

                      1. Initial program 99.9%

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

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

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

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

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

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

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

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

                      if 8.49999999999999969e132 < y

                      1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      Alternative 10: 84.8% accurate, 1.0× speedup?

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

                        1. Initial program 99.9%

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

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

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

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

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

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

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

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

                        if 8.49999999999999969e132 < y

                        1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

                      Alternative 11: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      Alternative 12: 56.9% accurate, 8.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \left(\left(-x\right) \cdot -1 + y\right) - z \]
                      7. Step-by-step derivation
                        1. Applied rewrites57.5%

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

                        Alternative 13: 29.4% accurate, 39.3× speedup?

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

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

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

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

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

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

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

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

                        Reproduce

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