Numeric.SpecFunctions.Extra:bd0 from math-functions-0.1.5.2

Percentage Accurate: 77.4% → 99.5%
Time: 6.9s
Alternatives: 10
Speedup: 0.6×

Specification

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

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

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

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 77.4% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 99.5% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-310}:\\
\;\;\;\;x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right) - z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.999999999999985e-310

    1. Initial program 77.4%

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

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

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

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

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

        \[\leadsto x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right) - z \]
      5. lower-/.f6449.9

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

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

    if -4.999999999999985e-310 < y

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 92.6% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{+149}:\\
\;\;\;\;\log \left(-x\right) \cdot x - \log \left(-y\right) \cdot x\\

\mathbf{elif}\;x \leq -4.5 \cdot 10^{-82}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\

\mathbf{elif}\;x \leq -5 \cdot 10^{-309}:\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.50000000000000002e149

    1. Initial program 77.4%

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

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

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

        \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
      3. lower-/.f6439.6

        \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
    4. Applied rewrites39.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\log \left(\frac{x}{y}\right)}{z} \cdot x\right) \cdot z \]
      10. associate-*l*N/A

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

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

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

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

        \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot \left(z + \color{blue}{0} \cdot z\right)\right) \]
      15. distribute-lft-inN/A

        \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + \color{blue}{x \cdot \left(0 \cdot z\right)}\right) \]
      16. mul0-lftN/A

        \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot 0\right) \]
      17. div0N/A

        \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot \frac{0}{\color{blue}{z}}\right) \]
      18. div0N/A

        \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot 0\right) \]
      19. div0N/A

        \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot \frac{0}{\color{blue}{y}}\right) \]
      20. div0N/A

        \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot 0\right) \]
      21. mul0-rgtN/A

        \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + 0\right) \]
      22. mul0-lftN/A

        \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + 0 \cdot \color{blue}{z}\right) \]
      23. div0N/A

        \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + \frac{0}{z} \cdot z\right) \]
      24. div0N/A

        \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + 0 \cdot z\right) \]
      25. mul0-lftN/A

        \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + \left(0 \cdot x\right) \cdot z\right) \]
      26. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\frac{\log \left(\frac{x}{y}\right)}{z} \cdot z\right) \]
      8. mult-flipN/A

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

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

        \[\leadsto x \cdot \left(\log \left(\frac{x}{y}\right) \cdot 1\right) \]
      11. *-rgt-identityN/A

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

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

        \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
      14. mult-flipN/A

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

        \[\leadsto x \cdot \log \left(x \cdot \frac{\mathsf{neg}\left(-1\right)}{y}\right) \]
      16. distribute-frac-negN/A

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

        \[\leadsto x \cdot \log \left(x \cdot \left(\mathsf{neg}\left(\frac{-1}{y}\right)\right)\right) \]
      18. distribute-rgt-neg-outN/A

        \[\leadsto x \cdot \log \left(\mathsf{neg}\left(x \cdot \frac{-1}{y}\right)\right) \]
      19. mul-1-negN/A

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

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

        \[\leadsto x \cdot \log \left(\left(-1 \cdot x\right) \cdot \frac{-1}{y}\right) \]
      22. sum-logN/A

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

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

        \[\leadsto x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right) \]
    8. Applied rewrites25.5%

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

    if -1.50000000000000002e149 < x < -4.4999999999999998e-82

    1. Initial program 77.4%

      \[x \cdot \log \left(\frac{x}{y}\right) - z \]

    if -4.4999999999999998e-82 < x < -4.9999999999999995e-309

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -4.9999999999999995e-309 < x

      1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 3: 92.5% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{+149}:\\ \;\;\;\;\log \left(-x\right) \cdot x - \log \left(-y\right) \cdot x\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{-82}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-309}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;\log x \cdot x - \mathsf{fma}\left(x, \log y, z\right)\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= x -1.5e+149)
       (- (* (log (- x)) x) (* (log (- y)) x))
       (if (<= x -4.5e-82)
         (- (* x (log (/ x y))) z)
         (if (<= x -5e-309) (- z) (- (* (log x) x) (fma x (log y) z))))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (x <= -1.5e+149) {
    		tmp = (log(-x) * x) - (log(-y) * x);
    	} else if (x <= -4.5e-82) {
    		tmp = (x * log((x / y))) - z;
    	} else if (x <= -5e-309) {
    		tmp = -z;
    	} else {
    		tmp = (log(x) * x) - fma(x, log(y), z);
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	tmp = 0.0
    	if (x <= -1.5e+149)
    		tmp = Float64(Float64(log(Float64(-x)) * x) - Float64(log(Float64(-y)) * x));
    	elseif (x <= -4.5e-82)
    		tmp = Float64(Float64(x * log(Float64(x / y))) - z);
    	elseif (x <= -5e-309)
    		tmp = Float64(-z);
    	else
    		tmp = Float64(Float64(log(x) * x) - fma(x, log(y), z));
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := If[LessEqual[x, -1.5e+149], N[(N[(N[Log[(-x)], $MachinePrecision] * x), $MachinePrecision] - N[(N[Log[(-y)], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.5e-82], N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, -5e-309], (-z), N[(N[(N[Log[x], $MachinePrecision] * x), $MachinePrecision] - N[(x * N[Log[y], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq -1.5 \cdot 10^{+149}:\\
    \;\;\;\;\log \left(-x\right) \cdot x - \log \left(-y\right) \cdot x\\
    
    \mathbf{elif}\;x \leq -4.5 \cdot 10^{-82}:\\
    \;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
    
    \mathbf{elif}\;x \leq -5 \cdot 10^{-309}:\\
    \;\;\;\;-z\\
    
    \mathbf{else}:\\
    \;\;\;\;\log x \cdot x - \mathsf{fma}\left(x, \log y, z\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if x < -1.50000000000000002e149

      1. Initial program 77.4%

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

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

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

          \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
        3. lower-/.f6439.6

          \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
      4. Applied rewrites39.6%

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\frac{\log \left(\frac{x}{y}\right)}{z} \cdot x\right) \cdot z \]
        10. associate-*l*N/A

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

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

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

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

          \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot \left(z + \color{blue}{0} \cdot z\right)\right) \]
        15. distribute-lft-inN/A

          \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + \color{blue}{x \cdot \left(0 \cdot z\right)}\right) \]
        16. mul0-lftN/A

          \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot 0\right) \]
        17. div0N/A

          \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot \frac{0}{\color{blue}{z}}\right) \]
        18. div0N/A

          \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot 0\right) \]
        19. div0N/A

          \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot \frac{0}{\color{blue}{y}}\right) \]
        20. div0N/A

          \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot 0\right) \]
        21. mul0-rgtN/A

          \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + 0\right) \]
        22. mul0-lftN/A

          \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + 0 \cdot \color{blue}{z}\right) \]
        23. div0N/A

          \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + \frac{0}{z} \cdot z\right) \]
        24. div0N/A

          \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + 0 \cdot z\right) \]
        25. mul0-lftN/A

          \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + \left(0 \cdot x\right) \cdot z\right) \]
        26. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

          \[\leadsto x \cdot \left(\frac{\log \left(\frac{x}{y}\right)}{z} \cdot z\right) \]
        8. mult-flipN/A

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

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

          \[\leadsto x \cdot \left(\log \left(\frac{x}{y}\right) \cdot 1\right) \]
        11. *-rgt-identityN/A

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

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

          \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
        14. mult-flipN/A

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

          \[\leadsto x \cdot \log \left(x \cdot \frac{\mathsf{neg}\left(-1\right)}{y}\right) \]
        16. distribute-frac-negN/A

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

          \[\leadsto x \cdot \log \left(x \cdot \left(\mathsf{neg}\left(\frac{-1}{y}\right)\right)\right) \]
        18. distribute-rgt-neg-outN/A

          \[\leadsto x \cdot \log \left(\mathsf{neg}\left(x \cdot \frac{-1}{y}\right)\right) \]
        19. mul-1-negN/A

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

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

          \[\leadsto x \cdot \log \left(\left(-1 \cdot x\right) \cdot \frac{-1}{y}\right) \]
        22. sum-logN/A

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

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

          \[\leadsto x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right) \]
      8. Applied rewrites25.5%

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

      if -1.50000000000000002e149 < x < -4.4999999999999998e-82

      1. Initial program 77.4%

        \[x \cdot \log \left(\frac{x}{y}\right) - z \]

      if -4.4999999999999998e-82 < x < -4.9999999999999995e-309

      1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -4.9999999999999995e-309 < x

        1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y \cdot x\right)\right) + \left(\mathsf{neg}\left(\mathsf{fma}\left(-x, \log x, z\right)\right)\right)} \]
          4. distribute-lft-neg-outN/A

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

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

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

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

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

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

      Alternative 4: 92.5% accurate, 0.5× speedup?

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

        1. Initial program 77.4%

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

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

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

            \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
          3. lower-/.f6439.6

            \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
        4. Applied rewrites39.6%

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\frac{\log \left(\frac{x}{y}\right)}{z} \cdot x\right) \cdot z \]
          10. associate-*l*N/A

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

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

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

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

            \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot \left(z + \color{blue}{0} \cdot z\right)\right) \]
          15. distribute-lft-inN/A

            \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + \color{blue}{x \cdot \left(0 \cdot z\right)}\right) \]
          16. mul0-lftN/A

            \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot 0\right) \]
          17. div0N/A

            \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot \frac{0}{\color{blue}{z}}\right) \]
          18. div0N/A

            \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot 0\right) \]
          19. div0N/A

            \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot \frac{0}{\color{blue}{y}}\right) \]
          20. div0N/A

            \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + x \cdot 0\right) \]
          21. mul0-rgtN/A

            \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + 0\right) \]
          22. mul0-lftN/A

            \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + 0 \cdot \color{blue}{z}\right) \]
          23. div0N/A

            \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + \frac{0}{z} \cdot z\right) \]
          24. div0N/A

            \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + 0 \cdot z\right) \]
          25. mul0-lftN/A

            \[\leadsto \frac{\log \left(\frac{x}{y}\right)}{z} \cdot \left(x \cdot z + \left(0 \cdot x\right) \cdot z\right) \]
          26. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

            \[\leadsto x \cdot \left(\frac{\log \left(\frac{x}{y}\right)}{z} \cdot z\right) \]
          8. mult-flipN/A

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

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

            \[\leadsto x \cdot \left(\log \left(\frac{x}{y}\right) \cdot 1\right) \]
          11. *-rgt-identityN/A

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

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

            \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
          14. mult-flipN/A

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

            \[\leadsto x \cdot \log \left(x \cdot \frac{\mathsf{neg}\left(-1\right)}{y}\right) \]
          16. distribute-frac-negN/A

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

            \[\leadsto x \cdot \log \left(x \cdot \left(\mathsf{neg}\left(\frac{-1}{y}\right)\right)\right) \]
          18. distribute-rgt-neg-outN/A

            \[\leadsto x \cdot \log \left(\mathsf{neg}\left(x \cdot \frac{-1}{y}\right)\right) \]
          19. mul-1-negN/A

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

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

            \[\leadsto x \cdot \log \left(\left(-1 \cdot x\right) \cdot \frac{-1}{y}\right) \]
          22. sum-logN/A

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

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

            \[\leadsto x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right) \]
        8. Applied rewrites25.5%

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

        if -1.50000000000000002e149 < x < -4.4999999999999998e-82

        1. Initial program 77.4%

          \[x \cdot \log \left(\frac{x}{y}\right) - z \]

        if -4.4999999999999998e-82 < x < -4.9999999999999995e-309

        1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -4.9999999999999995e-309 < x

          1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto -\mathsf{fma}\left(\log \color{blue}{\left(\frac{y}{x}\right)}, x, z\right) \]
            3. mult-flipN/A

              \[\leadsto -\mathsf{fma}\left(\log \color{blue}{\left(y \cdot \frac{1}{x}\right)}, x, z\right) \]
            4. sum-logN/A

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

              \[\leadsto -\mathsf{fma}\left(\color{blue}{\log y} + \log \left(\frac{1}{x}\right), x, z\right) \]
            6. *-lft-identityN/A

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

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

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

              \[\leadsto -\mathsf{fma}\left(\left(\mathsf{neg}\left(-1\right)\right) \cdot \log y + \left(\mathsf{neg}\left(\color{blue}{\log x}\right)\right), x, z\right) \]
            10. sub-flipN/A

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

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

              \[\leadsto -\mathsf{fma}\left(\color{blue}{1} \cdot \log y - \log x, x, z\right) \]
            13. *-lft-identity49.6

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

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

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

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

              \[\leadsto x \cdot \left(\log x - \log y\right) - z \]
            3. lower--.f64N/A

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

              \[\leadsto x \cdot \left(\log x - \log y\right) - z \]
            5. lower-log.f6449.6

              \[\leadsto x \cdot \left(\log x - \log y\right) - z \]
          8. Applied rewrites49.6%

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

        Alternative 5: 92.3% accurate, 0.5× speedup?

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

          1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto -x \cdot \log \left(\frac{\mathsf{neg}\left(y\right)}{-x}\right) \]
            5. diff-logN/A

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

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

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

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

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

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

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

              \[\leadsto -x \cdot \left(\left(\mathsf{neg}\left(\log \left(\frac{-1}{y}\right)\right)\right) - \log \left(\mathsf{neg}\left(x\right)\right)\right) \]
            13. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

              \[\leadsto -x \cdot \left(\log \left(\mathsf{neg}\left(y\right)\right) - \log \color{blue}{\left(-1 \cdot x\right)}\right) \]
            24. lower-neg.f6425.6

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

              \[\leadsto -x \cdot \left(\log \left(-y\right) - \log \left(-1 \cdot x\right)\right) \]
            26. mul-1-negN/A

              \[\leadsto -x \cdot \left(\log \left(-y\right) - \log \left(\mathsf{neg}\left(x\right)\right)\right) \]
            27. lift-neg.f6425.6

              \[\leadsto -x \cdot \left(\log \left(-y\right) - \log \left(-x\right)\right) \]
          8. Applied rewrites25.6%

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

          if -1.50000000000000002e149 < x < -4.4999999999999998e-82

          1. Initial program 77.4%

            \[x \cdot \log \left(\frac{x}{y}\right) - z \]

          if -4.4999999999999998e-82 < x < -4.9999999999999995e-309

          1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if -4.9999999999999995e-309 < x

            1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto -\mathsf{fma}\left(\log \color{blue}{\left(\frac{y}{x}\right)}, x, z\right) \]
              3. mult-flipN/A

                \[\leadsto -\mathsf{fma}\left(\log \color{blue}{\left(y \cdot \frac{1}{x}\right)}, x, z\right) \]
              4. sum-logN/A

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

                \[\leadsto -\mathsf{fma}\left(\color{blue}{\log y} + \log \left(\frac{1}{x}\right), x, z\right) \]
              6. *-lft-identityN/A

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

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

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

                \[\leadsto -\mathsf{fma}\left(\left(\mathsf{neg}\left(-1\right)\right) \cdot \log y + \left(\mathsf{neg}\left(\color{blue}{\log x}\right)\right), x, z\right) \]
              10. sub-flipN/A

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

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

                \[\leadsto -\mathsf{fma}\left(\color{blue}{1} \cdot \log y - \log x, x, z\right) \]
              13. *-lft-identity49.6

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

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

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

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

                \[\leadsto x \cdot \left(\log x - \log y\right) - z \]
              3. lower--.f64N/A

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

                \[\leadsto x \cdot \left(\log x - \log y\right) - z \]
              5. lower-log.f6449.6

                \[\leadsto x \cdot \left(\log x - \log y\right) - z \]
            8. Applied rewrites49.6%

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

          Alternative 6: 90.0% accurate, 0.6× speedup?

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

            1. Initial program 77.4%

              \[x \cdot \log \left(\frac{x}{y}\right) - z \]

            if -4.4999999999999998e-82 < x < -4.9999999999999995e-309

            1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if -4.9999999999999995e-309 < x

              1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto -\mathsf{fma}\left(\log \color{blue}{\left(\frac{y}{x}\right)}, x, z\right) \]
                3. mult-flipN/A

                  \[\leadsto -\mathsf{fma}\left(\log \color{blue}{\left(y \cdot \frac{1}{x}\right)}, x, z\right) \]
                4. sum-logN/A

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

                  \[\leadsto -\mathsf{fma}\left(\color{blue}{\log y} + \log \left(\frac{1}{x}\right), x, z\right) \]
                6. *-lft-identityN/A

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

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

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

                  \[\leadsto -\mathsf{fma}\left(\left(\mathsf{neg}\left(-1\right)\right) \cdot \log y + \left(\mathsf{neg}\left(\color{blue}{\log x}\right)\right), x, z\right) \]
                10. sub-flipN/A

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

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

                  \[\leadsto -\mathsf{fma}\left(\color{blue}{1} \cdot \log y - \log x, x, z\right) \]
                13. *-lft-identity49.6

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

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

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

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

                  \[\leadsto x \cdot \left(\log x - \log y\right) - z \]
                3. lower--.f64N/A

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

                  \[\leadsto x \cdot \left(\log x - \log y\right) - z \]
                5. lower-log.f6449.6

                  \[\leadsto x \cdot \left(\log x - \log y\right) - z \]
              8. Applied rewrites49.6%

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

            Alternative 7: 86.6% accurate, 0.3× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \log \left(\frac{x}{y}\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;-z\\ \mathbf{elif}\;t\_0 \leq 10^{+290}:\\ \;\;\;\;t\_0 - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right)\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (* x (log (/ x y)))))
               (if (<= t_0 (- INFINITY))
                 (- z)
                 (if (<= t_0 1e+290) (- t_0 z) (* x (- (log x) (log y)))))))
            double code(double x, double y, double z) {
            	double t_0 = x * log((x / y));
            	double tmp;
            	if (t_0 <= -((double) INFINITY)) {
            		tmp = -z;
            	} else if (t_0 <= 1e+290) {
            		tmp = t_0 - z;
            	} else {
            		tmp = x * (log(x) - log(y));
            	}
            	return tmp;
            }
            
            public static double code(double x, double y, double z) {
            	double t_0 = x * Math.log((x / y));
            	double tmp;
            	if (t_0 <= -Double.POSITIVE_INFINITY) {
            		tmp = -z;
            	} else if (t_0 <= 1e+290) {
            		tmp = t_0 - z;
            	} else {
            		tmp = x * (Math.log(x) - Math.log(y));
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = x * math.log((x / y))
            	tmp = 0
            	if t_0 <= -math.inf:
            		tmp = -z
            	elif t_0 <= 1e+290:
            		tmp = t_0 - z
            	else:
            		tmp = x * (math.log(x) - math.log(y))
            	return tmp
            
            function code(x, y, z)
            	t_0 = Float64(x * log(Float64(x / y)))
            	tmp = 0.0
            	if (t_0 <= Float64(-Inf))
            		tmp = Float64(-z);
            	elseif (t_0 <= 1e+290)
            		tmp = Float64(t_0 - z);
            	else
            		tmp = Float64(x * Float64(log(x) - log(y)));
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = x * log((x / y));
            	tmp = 0.0;
            	if (t_0 <= -Inf)
            		tmp = -z;
            	elseif (t_0 <= 1e+290)
            		tmp = t_0 - z;
            	else
            		tmp = x * (log(x) - log(y));
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], (-z), If[LessEqual[t$95$0, 1e+290], N[(t$95$0 - z), $MachinePrecision], N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
            \mathbf{if}\;t\_0 \leq -\infty:\\
            \;\;\;\;-z\\
            
            \mathbf{elif}\;t\_0 \leq 10^{+290}:\\
            \;\;\;\;t\_0 - z\\
            
            \mathbf{else}:\\
            \;\;\;\;x \cdot \left(\log x - \log y\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0

              1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1.00000000000000006e290

                1. Initial program 77.4%

                  \[x \cdot \log \left(\frac{x}{y}\right) - z \]

                if 1.00000000000000006e290 < (*.f64 x (log.f64 (/.f64 x y)))

                1. Initial program 77.4%

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

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

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

                    \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
                  3. lower-/.f6439.6

                    \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
                4. Applied rewrites39.6%

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

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

                    \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
                  3. diff-logN/A

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

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

                    \[\leadsto x \cdot \left(\log x - \log y\right) \]
                  6. sub-flip-reverseN/A

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

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

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

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

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

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

                    \[\leadsto x \cdot \left(\log x - 1 \cdot \log \color{blue}{y}\right) \]
                  13. *-lft-identity25.2

                    \[\leadsto x \cdot \left(\log x - \log y\right) \]
                6. Applied rewrites25.2%

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

              Alternative 8: 86.6% accurate, 0.3× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \log \left(\frac{x}{y}\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;-z\\ \mathbf{elif}\;t\_0 \leq 10^{+294}:\\ \;\;\;\;t\_0 - z\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (let* ((t_0 (* x (log (/ x y)))))
                 (if (<= t_0 (- INFINITY)) (- z) (if (<= t_0 1e+294) (- t_0 z) (- z)))))
              double code(double x, double y, double z) {
              	double t_0 = x * log((x / y));
              	double tmp;
              	if (t_0 <= -((double) INFINITY)) {
              		tmp = -z;
              	} else if (t_0 <= 1e+294) {
              		tmp = t_0 - z;
              	} else {
              		tmp = -z;
              	}
              	return tmp;
              }
              
              public static double code(double x, double y, double z) {
              	double t_0 = x * Math.log((x / y));
              	double tmp;
              	if (t_0 <= -Double.POSITIVE_INFINITY) {
              		tmp = -z;
              	} else if (t_0 <= 1e+294) {
              		tmp = t_0 - z;
              	} else {
              		tmp = -z;
              	}
              	return tmp;
              }
              
              def code(x, y, z):
              	t_0 = x * math.log((x / y))
              	tmp = 0
              	if t_0 <= -math.inf:
              		tmp = -z
              	elif t_0 <= 1e+294:
              		tmp = t_0 - z
              	else:
              		tmp = -z
              	return tmp
              
              function code(x, y, z)
              	t_0 = Float64(x * log(Float64(x / y)))
              	tmp = 0.0
              	if (t_0 <= Float64(-Inf))
              		tmp = Float64(-z);
              	elseif (t_0 <= 1e+294)
              		tmp = Float64(t_0 - z);
              	else
              		tmp = Float64(-z);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z)
              	t_0 = x * log((x / y));
              	tmp = 0.0;
              	if (t_0 <= -Inf)
              		tmp = -z;
              	elseif (t_0 <= 1e+294)
              		tmp = t_0 - z;
              	else
              		tmp = -z;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], (-z), If[LessEqual[t$95$0, 1e+294], N[(t$95$0 - z), $MachinePrecision], (-z)]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
              \mathbf{if}\;t\_0 \leq -\infty:\\
              \;\;\;\;-z\\
              
              \mathbf{elif}\;t\_0 \leq 10^{+294}:\\
              \;\;\;\;t\_0 - z\\
              
              \mathbf{else}:\\
              \;\;\;\;-z\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 1.00000000000000007e294 < (*.f64 x (log.f64 (/.f64 x y)))

                1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1.00000000000000007e294

                  1. Initial program 77.4%

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

                Alternative 9: 66.8% accurate, 0.8× speedup?

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

                  1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    if -7.6e-87 < z < 6.29999999999999969e35

                    1. Initial program 77.4%

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

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

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

                        \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
                      3. lower-/.f6439.6

                        \[\leadsto x \cdot \log \left(\frac{x}{y}\right) \]
                    4. Applied rewrites39.6%

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

                  Alternative 10: 50.1% accurate, 8.0× 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 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Reproduce

                    ?
                    herbie shell --seed 2025149 
                    (FPCore (x y z)
                      :name "Numeric.SpecFunctions.Extra:bd0 from math-functions-0.1.5.2"
                      :precision binary64
                      (- (* x (log (/ x y))) z))