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

Percentage Accurate: 77.1% → 99.5%
Time: 10.7s
Alternatives: 9
Speedup: 0.5×

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;
}
real(8) function code(x, y, z)
    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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 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.1% 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;
}
real(8) function code(x, y, z)
    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 -4 \cdot 10^{-310}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -4e-310)
   (- (* x (- (log (- x)) (log (- y)))) z)
   (- (* x (- (log x) (log y))) z)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -4e-310) {
		tmp = (x * (log(-x) - log(-y))) - z;
	} else {
		tmp = (x * (log(x) - log(y))) - z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-4d-310)) then
        tmp = (x * (log(-x) - log(-y))) - 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 (y <= -4e-310) {
		tmp = (x * (Math.log(-x) - Math.log(-y))) - z;
	} else {
		tmp = (x * (Math.log(x) - Math.log(y))) - z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -4e-310:
		tmp = (x * (math.log(-x) - math.log(-y))) - z
	else:
		tmp = (x * (math.log(x) - math.log(y))) - z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -4e-310)
		tmp = Float64(Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))) - 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 (y <= -4e-310)
		tmp = (x * (log(-x) - log(-y))) - z;
	else
		tmp = (x * (log(x) - log(y))) - z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -4e-310], N[(N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 74.9%

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

      \[\leadsto x \cdot \color{blue}{\left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right)} - z \]
    4. Step-by-step derivation
      1. metadata-eval99.6%

        \[\leadsto x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{\color{blue}{-1}}{y}\right)\right) - z \]
      2. distribute-neg-frac99.6%

        \[\leadsto x \cdot \left(\log \left(-1 \cdot x\right) + \log \color{blue}{\left(-\frac{1}{y}\right)}\right) - z \]
      3. distribute-frac-neg299.6%

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

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

        \[\leadsto x \cdot \left(\log \left(-x\right) + \color{blue}{\left(-\log \left(-y\right)\right)}\right) - z \]
      6. sub-neg99.6%

        \[\leadsto x \cdot \color{blue}{\left(\log \left(-x\right) - \log \left(-y\right)\right)} - z \]
    5. Simplified99.6%

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

    if -3.999999999999988e-310 < y

    1. Initial program 77.8%

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

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

        \[\leadsto x \cdot \left(\log x + \color{blue}{\left(-\log y\right)}\right) - z \]
      2. sub-neg99.5%

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

      \[\leadsto x \cdot \color{blue}{\left(\log x - \log y\right)} - z \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4 \cdot 10^{-310}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 87.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(\frac{x}{y}\right)\\ t_1 := x \cdot t\_0\\ \mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+306}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, t\_0, -z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (log (/ x y))) (t_1 (* x t_0)))
   (if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+306)))
     (- z)
     (fma x t_0 (- z)))))
double code(double x, double y, double z) {
	double t_0 = log((x / y));
	double t_1 = x * t_0;
	double tmp;
	if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 5e+306)) {
		tmp = -z;
	} else {
		tmp = fma(x, t_0, -z);
	}
	return tmp;
}
function code(x, y, z)
	t_0 = log(Float64(x / y))
	t_1 = Float64(x * t_0)
	tmp = 0.0
	if ((t_1 <= Float64(-Inf)) || !(t_1 <= 5e+306))
		tmp = Float64(-z);
	else
		tmp = fma(x, t_0, Float64(-z));
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(x * t$95$0), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+306]], $MachinePrecision]], (-z), N[(x * t$95$0 + (-z)), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \log \left(\frac{x}{y}\right)\\
t_1 := x \cdot t\_0\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+306}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 4.99999999999999993e306 < (*.f64 x (log.f64 (/.f64 x y)))

    1. Initial program 5.6%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-neg48.6%

        \[\leadsto \color{blue}{-z} \]
    5. Simplified48.6%

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

    if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 4.99999999999999993e306

    1. Initial program 99.8%

      \[x \cdot \log \left(\frac{x}{y}\right) - z \]
    2. Step-by-step derivation
      1. fma-neg99.8%

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

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

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

Alternative 3: 86.6% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := \log \left(\frac{x}{y}\right)\\
t_1 := x \cdot t\_0\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(x, t\_0, -z\right)\\

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


\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 4.3%

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

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

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

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

        \[\leadsto x \cdot \left(\log \left(-1 \cdot x\right) + \log \color{blue}{\left(-\frac{1}{y}\right)}\right) - z \]
      3. distribute-frac-neg255.4%

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

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

        \[\leadsto x \cdot \left(\log \left(-x\right) + \color{blue}{\left(-\log \left(-y\right)\right)}\right) - z \]
      6. sub-neg55.4%

        \[\leadsto x \cdot \color{blue}{\left(\log \left(-x\right) - \log \left(-y\right)\right)} - z \]
    6. Simplified45.7%

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

    if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 4.99999999999999993e306

    1. Initial program 99.8%

      \[x \cdot \log \left(\frac{x}{y}\right) - z \]
    2. Step-by-step derivation
      1. fma-neg99.8%

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

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

    if 4.99999999999999993e306 < (*.f64 x (log.f64 (/.f64 x y)))

    1. Initial program 7.2%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-neg59.6%

        \[\leadsto \color{blue}{-z} \]
    5. Simplified59.6%

      \[\leadsto \color{blue}{-z} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification87.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot \log \left(\frac{x}{y}\right) \leq -\infty:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\ \mathbf{elif}\;x \cdot \log \left(\frac{x}{y}\right) \leq 5 \cdot 10^{+306}:\\ \;\;\;\;\mathsf{fma}\left(x, \log \left(\frac{x}{y}\right), -z\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 87.5% 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 \lor \neg \left(t\_0 \leq 5 \cdot 10^{+306}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;t\_0 - z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (log (/ x y)))))
   (if (or (<= t_0 (- INFINITY)) (not (<= t_0 5e+306))) (- z) (- t_0 z))))
double code(double x, double y, double z) {
	double t_0 = x * log((x / y));
	double tmp;
	if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 5e+306)) {
		tmp = -z;
	} else {
		tmp = t_0 - 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) || !(t_0 <= 5e+306)) {
		tmp = -z;
	} else {
		tmp = t_0 - z;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * math.log((x / y))
	tmp = 0
	if (t_0 <= -math.inf) or not (t_0 <= 5e+306):
		tmp = -z
	else:
		tmp = t_0 - z
	return tmp
function code(x, y, z)
	t_0 = Float64(x * log(Float64(x / y)))
	tmp = 0.0
	if ((t_0 <= Float64(-Inf)) || !(t_0 <= 5e+306))
		tmp = Float64(-z);
	else
		tmp = Float64(t_0 - 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) || ~((t_0 <= 5e+306)))
		tmp = -z;
	else
		tmp = t_0 - 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[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 5e+306]], $MachinePrecision]], (-z), N[(t$95$0 - z), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{if}\;t\_0 \leq -\infty \lor \neg \left(t\_0 \leq 5 \cdot 10^{+306}\right):\\
\;\;\;\;-z\\

\mathbf{else}:\\
\;\;\;\;t\_0 - z\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 4.99999999999999993e306 < (*.f64 x (log.f64 (/.f64 x y)))

    1. Initial program 5.6%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-neg48.6%

        \[\leadsto \color{blue}{-z} \]
    5. Simplified48.6%

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

    if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 4.99999999999999993e306

    1. Initial program 99.8%

      \[x \cdot \log \left(\frac{x}{y}\right) - z \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification87.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot \log \left(\frac{x}{y}\right) \leq -\infty \lor \neg \left(x \cdot \log \left(\frac{x}{y}\right) \leq 5 \cdot 10^{+306}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 93.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.35 \cdot 10^{+111}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-115}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-308}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -2.35e+111)
   (* x (- (log (- x)) (log (- y))))
   (if (<= x -3.8e-115)
     (- (* x (log (/ x y))) z)
     (if (<= x -5e-308) (- z) (- (* x (- (log x) (log y))) z)))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -2.35e+111) {
		tmp = x * (log(-x) - log(-y));
	} else if (x <= -3.8e-115) {
		tmp = (x * log((x / y))) - z;
	} else if (x <= -5e-308) {
		tmp = -z;
	} else {
		tmp = (x * (log(x) - log(y))) - z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-2.35d+111)) then
        tmp = x * (log(-x) - log(-y))
    else if (x <= (-3.8d-115)) then
        tmp = (x * log((x / y))) - z
    else if (x <= (-5d-308)) 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 <= -2.35e+111) {
		tmp = x * (Math.log(-x) - Math.log(-y));
	} else if (x <= -3.8e-115) {
		tmp = (x * Math.log((x / y))) - z;
	} else if (x <= -5e-308) {
		tmp = -z;
	} else {
		tmp = (x * (Math.log(x) - Math.log(y))) - z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -2.35e+111:
		tmp = x * (math.log(-x) - math.log(-y))
	elif x <= -3.8e-115:
		tmp = (x * math.log((x / y))) - z
	elif x <= -5e-308:
		tmp = -z
	else:
		tmp = (x * (math.log(x) - math.log(y))) - z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -2.35e+111)
		tmp = Float64(x * Float64(log(Float64(-x)) - log(Float64(-y))));
	elseif (x <= -3.8e-115)
		tmp = Float64(Float64(x * log(Float64(x / y))) - z);
	elseif (x <= -5e-308)
		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 <= -2.35e+111)
		tmp = x * (log(-x) - log(-y));
	elseif (x <= -3.8e-115)
		tmp = (x * log((x / y))) - z;
	elseif (x <= -5e-308)
		tmp = -z;
	else
		tmp = (x * (log(x) - log(y))) - z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -2.35e+111], N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.8e-115], N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, -5e-308], (-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 -2.35 \cdot 10^{+111}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\

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

\mathbf{elif}\;x \leq -5 \cdot 10^{-308}:\\
\;\;\;\;-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 < -2.35000000000000004e111

    1. Initial program 55.3%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\log \left(-x\right) + \color{blue}{\left(-\log \left(-y\right)\right)}\right) - z \]
      6. sub-neg99.3%

        \[\leadsto x \cdot \color{blue}{\left(\log \left(-x\right) - \log \left(-y\right)\right)} - z \]
    6. Simplified83.5%

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

    if -2.35000000000000004e111 < x < -3.79999999999999992e-115

    1. Initial program 97.6%

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

    if -3.79999999999999992e-115 < x < -4.99999999999999955e-308

    1. Initial program 70.4%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-neg91.6%

        \[\leadsto \color{blue}{-z} \]
    5. Simplified91.6%

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

    if -4.99999999999999955e-308 < x

    1. Initial program 77.8%

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

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

        \[\leadsto x \cdot \left(\log x + \color{blue}{\left(-\log y\right)}\right) - z \]
      2. sub-neg99.5%

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

      \[\leadsto x \cdot \color{blue}{\left(\log x - \log y\right)} - z \]
  3. Recombined 4 regimes into one program.
  4. Final simplification95.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.35 \cdot 10^{+111}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-115}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-308}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 67.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{-51} \lor \neg \left(z \leq 10^{-54}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-\log \left(\frac{y}{x}\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -5.4e-51) (not (<= z 1e-54))) (- z) (* x (- (log (/ y x))))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -5.4e-51) || !(z <= 1e-54)) {
		tmp = -z;
	} else {
		tmp = x * -log((y / x));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-5.4d-51)) .or. (.not. (z <= 1d-54))) then
        tmp = -z
    else
        tmp = x * -log((y / x))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -5.4e-51) || !(z <= 1e-54)) {
		tmp = -z;
	} else {
		tmp = x * -Math.log((y / x));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -5.4e-51) or not (z <= 1e-54):
		tmp = -z
	else:
		tmp = x * -math.log((y / x))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -5.4e-51) || !(z <= 1e-54))
		tmp = Float64(-z);
	else
		tmp = Float64(x * Float64(-log(Float64(y / x))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -5.4e-51) || ~((z <= 1e-54)))
		tmp = -z;
	else
		tmp = x * -log((y / x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.4e-51], N[Not[LessEqual[z, 1e-54]], $MachinePrecision]], (-z), N[(x * (-N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{-51} \lor \neg \left(z \leq 10^{-54}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.3999999999999994e-51 or 1e-54 < z

    1. Initial program 78.5%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-neg76.1%

        \[\leadsto \color{blue}{-z} \]
    5. Simplified76.1%

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

    if -5.3999999999999994e-51 < z < 1e-54

    1. Initial program 72.9%

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

      \[\leadsto \color{blue}{x \cdot \log \left(\frac{x}{y}\right)} \]
    4. Step-by-step derivation
      1. clear-num64.5%

        \[\leadsto x \cdot \log \color{blue}{\left(\frac{1}{\frac{y}{x}}\right)} \]
      2. log-div64.9%

        \[\leadsto x \cdot \color{blue}{\left(\log 1 - \log \left(\frac{y}{x}\right)\right)} \]
      3. metadata-eval64.9%

        \[\leadsto x \cdot \left(\color{blue}{0} - \log \left(\frac{y}{x}\right)\right) \]
    5. Applied egg-rr64.9%

      \[\leadsto x \cdot \color{blue}{\left(0 - \log \left(\frac{y}{x}\right)\right)} \]
    6. Step-by-step derivation
      1. neg-sub064.9%

        \[\leadsto x \cdot \color{blue}{\left(-\log \left(\frac{y}{x}\right)\right)} \]
    7. Simplified64.9%

      \[\leadsto x \cdot \color{blue}{\left(-\log \left(\frac{y}{x}\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification71.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{-51} \lor \neg \left(z \leq 10^{-54}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-\log \left(\frac{y}{x}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 67.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{-52} \lor \neg \left(z \leq 2 \cdot 10^{-57}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -2.1e-52) (not (<= z 2e-57))) (- z) (* x (log (/ x y)))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -2.1e-52) || !(z <= 2e-57)) {
		tmp = -z;
	} else {
		tmp = x * log((x / y));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-2.1d-52)) .or. (.not. (z <= 2d-57))) then
        tmp = -z
    else
        tmp = x * log((x / y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -2.1e-52) || !(z <= 2e-57)) {
		tmp = -z;
	} else {
		tmp = x * Math.log((x / y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -2.1e-52) or not (z <= 2e-57):
		tmp = -z
	else:
		tmp = x * math.log((x / y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -2.1e-52) || !(z <= 2e-57))
		tmp = Float64(-z);
	else
		tmp = Float64(x * log(Float64(x / y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -2.1e-52) || ~((z <= 2e-57)))
		tmp = -z;
	else
		tmp = x * log((x / y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.1e-52], N[Not[LessEqual[z, 2e-57]], $MachinePrecision]], (-z), N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-52} \lor \neg \left(z \leq 2 \cdot 10^{-57}\right):\\
\;\;\;\;-z\\

\mathbf{else}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.0999999999999999e-52 or 1.99999999999999991e-57 < z

    1. Initial program 78.5%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-neg76.1%

        \[\leadsto \color{blue}{-z} \]
    5. Simplified76.1%

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

    if -2.0999999999999999e-52 < z < 1.99999999999999991e-57

    1. Initial program 72.9%

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

      \[\leadsto \color{blue}{x \cdot \log \left(\frac{x}{y}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification71.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{-52} \lor \neg \left(z \leq 2 \cdot 10^{-57}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 51.0% accurate, 53.5× speedup?

\[\begin{array}{l} \\ -z \end{array} \]
(FPCore (x y z) :precision binary64 (- z))
double code(double x, double y, double z) {
	return -z;
}
real(8) function code(x, y, z)
    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 76.2%

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

    \[\leadsto \color{blue}{-1 \cdot z} \]
  4. Step-by-step derivation
    1. mul-1-neg53.0%

      \[\leadsto \color{blue}{-z} \]
  5. Simplified53.0%

    \[\leadsto \color{blue}{-z} \]
  6. Final simplification53.0%

    \[\leadsto -z \]
  7. Add Preprocessing

Alternative 9: 2.3% accurate, 107.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;
}
real(8) function code(x, y, z)
    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 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 76.2%

    \[x \cdot \log \left(\frac{x}{y}\right) - z \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-sqr-sqrt36.6%

      \[\leadsto x \cdot \color{blue}{\left(\sqrt{\log \left(\frac{x}{y}\right)} \cdot \sqrt{\log \left(\frac{x}{y}\right)}\right)} - z \]
    2. associate-*r*36.6%

      \[\leadsto \color{blue}{\left(x \cdot \sqrt{\log \left(\frac{x}{y}\right)}\right) \cdot \sqrt{\log \left(\frac{x}{y}\right)}} - z \]
    3. fma-neg36.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot \sqrt{\log \left(\frac{x}{y}\right)}, \sqrt{\log \left(\frac{x}{y}\right)}, -z\right)} \]
    4. add-sqr-sqrt21.7%

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

      \[\leadsto \mathsf{fma}\left(x \cdot \sqrt{\log \left(\frac{x}{y}\right)}, \sqrt{\log \left(\frac{x}{y}\right)}, \color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}}\right) \]
    6. sqr-neg25.1%

      \[\leadsto \mathsf{fma}\left(x \cdot \sqrt{\log \left(\frac{x}{y}\right)}, \sqrt{\log \left(\frac{x}{y}\right)}, \sqrt{\color{blue}{z \cdot z}}\right) \]
    7. sqrt-unprod8.8%

      \[\leadsto \mathsf{fma}\left(x \cdot \sqrt{\log \left(\frac{x}{y}\right)}, \sqrt{\log \left(\frac{x}{y}\right)}, \color{blue}{\sqrt{z} \cdot \sqrt{z}}\right) \]
    8. add-sqr-sqrt19.7%

      \[\leadsto \mathsf{fma}\left(x \cdot \sqrt{\log \left(\frac{x}{y}\right)}, \sqrt{\log \left(\frac{x}{y}\right)}, \color{blue}{z}\right) \]
  4. Applied egg-rr19.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot \sqrt{\log \left(\frac{x}{y}\right)}, \sqrt{\log \left(\frac{x}{y}\right)}, z\right)} \]
  5. Taylor expanded in x around 0 2.0%

    \[\leadsto \color{blue}{z} \]
  6. Final simplification2.0%

    \[\leadsto z \]
  7. Add Preprocessing

Developer target: 88.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y < 7.595077799083773 \cdot 10^{-308}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (< y 7.595077799083773e-308)
   (- (* x (log (/ x y))) z)
   (- (* x (- (log x) (log y))) z)))
double code(double x, double y, double z) {
	double tmp;
	if (y < 7.595077799083773e-308) {
		tmp = (x * log((x / y))) - z;
	} else {
		tmp = (x * (log(x) - log(y))) - z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y < 7.595077799083773d-308) then
        tmp = (x * log((x / y))) - 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 (y < 7.595077799083773e-308) {
		tmp = (x * Math.log((x / y))) - z;
	} else {
		tmp = (x * (Math.log(x) - Math.log(y))) - z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y < 7.595077799083773e-308:
		tmp = (x * math.log((x / y))) - z
	else:
		tmp = (x * (math.log(x) - math.log(y))) - z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y < 7.595077799083773e-308)
		tmp = Float64(Float64(x * log(Float64(x / y))) - 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 (y < 7.595077799083773e-308)
		tmp = (x * log((x / y))) - z;
	else
		tmp = (x * (log(x) - log(y))) - z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Less[y, 7.595077799083773e-308], N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y < 7.595077799083773 \cdot 10^{-308}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\

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


\end{array}
\end{array}

Reproduce

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

  :alt
  (if (< y 7.595077799083773e-308) (- (* x (log (/ x y))) z) (- (* x (- (log x) (log y))) z))

  (- (* x (log (/ x y))) z))