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

Percentage Accurate: 76.8% → 99.7%
Time: 12.7s
Alternatives: 8
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 8 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: 76.8% 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.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ x \cdot \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right) \cdot 3\right) - z \end{array} \]
(FPCore (x y z)
 :precision binary64
 (- (* x (* (log (/ (cbrt x) (cbrt y))) 3.0)) z))
double code(double x, double y, double z) {
	return (x * (log((cbrt(x) / cbrt(y))) * 3.0)) - z;
}
public static double code(double x, double y, double z) {
	return (x * (Math.log((Math.cbrt(x) / Math.cbrt(y))) * 3.0)) - z;
}
function code(x, y, z)
	return Float64(Float64(x * Float64(log(Float64(cbrt(x) / cbrt(y))) * 3.0)) - z)
end
code[x_, y_, z_] := N[(N[(x * N[(N[Log[N[(N[Power[x, 1/3], $MachinePrecision] / N[Power[y, 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right) \cdot 3\right) - z
\end{array}
Derivation
  1. Initial program 82.7%

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

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

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

      \[\leadsto x \cdot \left(\log \color{blue}{\left({\left(\sqrt[3]{\frac{x}{y}}\right)}^{2}\right)} + \log \left(\sqrt[3]{\frac{x}{y}}\right)\right) - z \]
    4. metadata-eval82.6%

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

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

      \[\leadsto x \cdot \left(\color{blue}{2} \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right) + \log \left(\sqrt[3]{\frac{x}{y}}\right)\right) - z \]
  4. Applied egg-rr82.6%

    \[\leadsto x \cdot \color{blue}{\left(2 \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right) + \log \left(\sqrt[3]{\frac{x}{y}}\right)\right)} - z \]
  5. Step-by-step derivation
    1. distribute-lft1-in82.6%

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

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

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

    \[\leadsto x \cdot \color{blue}{\left(\log \left(\sqrt[3]{\frac{x}{y}}\right) \cdot 3\right)} - z \]
  7. Step-by-step derivation
    1. cbrt-div99.7%

      \[\leadsto x \cdot \left(\log \color{blue}{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right)} \cdot 3\right) - z \]
    2. div-inv99.7%

      \[\leadsto x \cdot \left(\log \color{blue}{\left(\sqrt[3]{x} \cdot \frac{1}{\sqrt[3]{y}}\right)} \cdot 3\right) - z \]
  8. Applied egg-rr99.7%

    \[\leadsto x \cdot \left(\log \color{blue}{\left(\sqrt[3]{x} \cdot \frac{1}{\sqrt[3]{y}}\right)} \cdot 3\right) - z \]
  9. Step-by-step derivation
    1. associate-*r/99.7%

      \[\leadsto x \cdot \left(\log \color{blue}{\left(\frac{\sqrt[3]{x} \cdot 1}{\sqrt[3]{y}}\right)} \cdot 3\right) - z \]
    2. *-rgt-identity99.7%

      \[\leadsto x \cdot \left(\log \left(\frac{\color{blue}{\sqrt[3]{x}}}{\sqrt[3]{y}}\right) \cdot 3\right) - z \]
  10. Simplified99.7%

    \[\leadsto x \cdot \left(\log \color{blue}{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right)} \cdot 3\right) - z \]
  11. Final simplification99.7%

    \[\leadsto x \cdot \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right) \cdot 3\right) - z \]
  12. Add Preprocessing

Alternative 2: 87.2% 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 10^{+308}\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 1e+308))) (- 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 <= 1e+308)) {
		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 <= 1e+308)) {
		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 <= 1e+308):
		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 <= 1e+308))
		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 <= 1e+308)))
		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, 1e+308]], $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 10^{+308}\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 1e308 < (*.f64 x (log.f64 (/.f64 x y)))

    1. Initial program 8.7%

      \[x \cdot \log \left(\frac{x}{y}\right) - z \]
    2. Step-by-step derivation
      1. remove-double-neg8.7%

        \[\leadsto \color{blue}{-\left(-\left(x \cdot \log \left(\frac{x}{y}\right) - z\right)\right)} \]
      2. sub-neg8.7%

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

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

        \[\leadsto -\left(\color{blue}{x \cdot \left(-\log \left(\frac{x}{y}\right)\right)} + \left(-\left(-z\right)\right)\right) \]
      5. remove-double-neg8.7%

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

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

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

        \[\leadsto -\mathsf{fma}\left(x, -\color{blue}{\left(\log x + \left(-\log y\right)\right)}, z\right) \]
      9. distribute-neg-in43.7%

        \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\left(-\log x\right) + \left(-\left(-\log y\right)\right)}, z\right) \]
      10. remove-double-neg43.7%

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

        \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log y + \left(-\log x\right)}, z\right) \]
      12. sub-neg43.7%

        \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log y - \log x}, z\right) \]
      13. log-div17.7%

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

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

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

    if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1e308

    1. Initial program 99.7%

      \[x \cdot \log \left(\frac{x}{y}\right) - z \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification90.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 10^{+308}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 88.4% 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 10^{+308}\right):\\ \;\;\;\;x \cdot \log \left(x \cdot y\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 1e+308)))
     (- (* x (log (* x y))) 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 <= 1e+308)) {
		tmp = (x * log((x * y))) - 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 <= 1e+308)) {
		tmp = (x * Math.log((x * y))) - 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 <= 1e+308):
		tmp = (x * math.log((x * y))) - 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 <= 1e+308))
		tmp = Float64(Float64(x * log(Float64(x * y))) - 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 <= 1e+308)))
		tmp = (x * log((x * y))) - 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, 1e+308]], $MachinePrecision]], N[(N[(x * N[Log[N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], 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 10^{+308}\right):\\
\;\;\;\;x \cdot \log \left(x \cdot y\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 1e308 < (*.f64 x (log.f64 (/.f64 x y)))

    1. Initial program 8.7%

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

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

      \[\leadsto x \cdot \color{blue}{\left(\log x - \log y\right)} - z \]
    5. Step-by-step derivation
      1. sub-neg43.7%

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

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

      \[\leadsto \color{blue}{\left(\log x \cdot x + \left(-\log y\right) \cdot x\right)} - z \]
    7. Step-by-step derivation
      1. distribute-rgt-out43.7%

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

        \[\leadsto x \cdot \left(\log \color{blue}{\left({x}^{1}\right)} + \left(-\log y\right)\right) - z \]
      3. pow143.7%

        \[\leadsto x \cdot \left(\log \color{blue}{x} + \left(-\log y\right)\right) - z \]
      4. rem-cube-cbrt43.7%

        \[\leadsto x \cdot \left(\log \color{blue}{\left({\left(\sqrt[3]{x}\right)}^{3}\right)} + \left(-\log y\right)\right) - z \]
      5. exp-to-pow43.7%

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

        \[\leadsto x \cdot \color{blue}{\left(\log \left(e^{\log \left(\sqrt[3]{x}\right) \cdot 3}\right) - \log y\right)} - z \]
      7. *-commutative43.7%

        \[\leadsto \color{blue}{\left(\log \left(e^{\log \left(\sqrt[3]{x}\right) \cdot 3}\right) - \log y\right) \cdot x} - z \]
    8. Applied egg-rr53.7%

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

    if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1e308

    1. Initial program 99.7%

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

    \[\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 10^{+308}\right):\\ \;\;\;\;x \cdot \log \left(x \cdot y\right) - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 99.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2 \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 -2e-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 <= -2e-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 <= (-2d-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 <= -2e-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 <= -2e-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 <= -2e-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 <= -2e-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, -2e-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 -2 \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 < -1.999999999999994e-310

    1. Initial program 81.4%

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

        \[\leadsto x \cdot \log \color{blue}{\left(\frac{-x}{-y}\right)} - z \]
      2. log-div99.4%

        \[\leadsto x \cdot \color{blue}{\left(\log \left(-x\right) - \log \left(-y\right)\right)} - z \]
    4. Applied egg-rr99.4%

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

    if -1.999999999999994e-310 < y

    1. Initial program 84.1%

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

        \[\leadsto x \cdot \color{blue}{\left(\log x - \log y\right)} - z \]
    4. Applied egg-rr99.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 -2 \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 5: 88.1% accurate, 0.5× speedup?

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

\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 < -1.999999999999994e-310

    1. Initial program 81.4%

      \[x \cdot \log \left(\frac{x}{y}\right) - z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num80.9%

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

        \[\leadsto x \cdot \color{blue}{\left(-\log \left(\frac{y}{x}\right)\right)} - z \]
    4. Applied egg-rr84.0%

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

    if -1.999999999999994e-310 < y

    1. Initial program 84.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(-z\right) - x \cdot \log \left(\frac{y}{x}\right)\\ \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 -2.3 \cdot 10^{-43} \lor \neg \left(z \leq 8.6 \cdot 10^{-44}\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 -2.3e-43) (not (<= z 8.6e-44))) (- z) (* x (- (log (/ y x))))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -2.3e-43) || !(z <= 8.6e-44)) {
		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 <= (-2.3d-43)) .or. (.not. (z <= 8.6d-44))) 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 <= -2.3e-43) || !(z <= 8.6e-44)) {
		tmp = -z;
	} else {
		tmp = x * -Math.log((y / x));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -2.3e-43) or not (z <= 8.6e-44):
		tmp = -z
	else:
		tmp = x * -math.log((y / x))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -2.3e-43) || !(z <= 8.6e-44))
		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 <= -2.3e-43) || ~((z <= 8.6e-44)))
		tmp = -z;
	else
		tmp = x * -log((y / x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.3e-43], N[Not[LessEqual[z, 8.6e-44]], $MachinePrecision]], (-z), N[(x * (-N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{-43} \lor \neg \left(z \leq 8.6 \cdot 10^{-44}\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 < -2.2999999999999999e-43 or 8.60000000000000027e-44 < z

    1. Initial program 79.8%

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

        \[\leadsto \color{blue}{-\left(-\left(x \cdot \log \left(\frac{x}{y}\right) - z\right)\right)} \]
      2. sub-neg79.8%

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

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

        \[\leadsto -\left(\color{blue}{x \cdot \left(-\log \left(\frac{x}{y}\right)\right)} + \left(-\left(-z\right)\right)\right) \]
      5. remove-double-neg79.8%

        \[\leadsto -\left(x \cdot \left(-\log \left(\frac{x}{y}\right)\right) + \color{blue}{z}\right) \]
      6. fma-udef79.8%

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

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

        \[\leadsto -\mathsf{fma}\left(x, -\color{blue}{\left(\log x + \left(-\log y\right)\right)}, z\right) \]
      9. distribute-neg-in50.8%

        \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\left(-\log x\right) + \left(-\left(-\log y\right)\right)}, z\right) \]
      10. remove-double-neg50.8%

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

        \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log y + \left(-\log x\right)}, z\right) \]
      12. sub-neg50.8%

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

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

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

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

    if -2.2999999999999999e-43 < z < 8.60000000000000027e-44

    1. Initial program 86.8%

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

        \[\leadsto \color{blue}{-\left(-\left(x \cdot \log \left(\frac{x}{y}\right) - z\right)\right)} \]
      2. sub-neg86.8%

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

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

        \[\leadsto -\left(\color{blue}{x \cdot \left(-\log \left(\frac{x}{y}\right)\right)} + \left(-\left(-z\right)\right)\right) \]
      5. remove-double-neg86.8%

        \[\leadsto -\left(x \cdot \left(-\log \left(\frac{x}{y}\right)\right) + \color{blue}{z}\right) \]
      6. fma-udef86.8%

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

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

        \[\leadsto -\mathsf{fma}\left(x, -\color{blue}{\left(\log x + \left(-\log y\right)\right)}, z\right) \]
      9. distribute-neg-in40.7%

        \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\left(-\log x\right) + \left(-\left(-\log y\right)\right)}, z\right) \]
      10. remove-double-neg40.7%

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

        \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log y + \left(-\log x\right)}, z\right) \]
      12. sub-neg40.7%

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

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

      \[\leadsto \color{blue}{-\mathsf{fma}\left(x, \log \left(\frac{y}{x}\right), z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 31.8%

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

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

        \[\leadsto -x \cdot \color{blue}{\left(\log y - \log x\right)} \]
      3. log-div72.4%

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

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

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

Alternative 7: 50.3% 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 82.7%

    \[x \cdot \log \left(\frac{x}{y}\right) - z \]
  2. Step-by-step derivation
    1. remove-double-neg82.7%

      \[\leadsto \color{blue}{-\left(-\left(x \cdot \log \left(\frac{x}{y}\right) - z\right)\right)} \]
    2. sub-neg82.7%

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

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

      \[\leadsto -\left(\color{blue}{x \cdot \left(-\log \left(\frac{x}{y}\right)\right)} + \left(-\left(-z\right)\right)\right) \]
    5. remove-double-neg82.7%

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

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

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

      \[\leadsto -\mathsf{fma}\left(x, -\color{blue}{\left(\log x + \left(-\log y\right)\right)}, z\right) \]
    9. distribute-neg-in46.7%

      \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\left(-\log x\right) + \left(-\left(-\log y\right)\right)}, z\right) \]
    10. remove-double-neg46.7%

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

      \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log y + \left(-\log x\right)}, z\right) \]
    12. sub-neg46.7%

      \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log y - \log x}, z\right) \]
    13. log-div84.0%

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

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

    \[\leadsto -\color{blue}{z} \]
  6. Final simplification52.9%

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

Alternative 8: 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 82.7%

    \[x \cdot \log \left(\frac{x}{y}\right) - z \]
  2. Step-by-step derivation
    1. remove-double-neg82.7%

      \[\leadsto \color{blue}{-\left(-\left(x \cdot \log \left(\frac{x}{y}\right) - z\right)\right)} \]
    2. sub-neg82.7%

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

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

      \[\leadsto -\left(\color{blue}{x \cdot \left(-\log \left(\frac{x}{y}\right)\right)} + \left(-\left(-z\right)\right)\right) \]
    5. remove-double-neg82.7%

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

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

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

      \[\leadsto -\mathsf{fma}\left(x, -\color{blue}{\left(\log x + \left(-\log y\right)\right)}, z\right) \]
    9. distribute-neg-in46.7%

      \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\left(-\log x\right) + \left(-\left(-\log y\right)\right)}, z\right) \]
    10. remove-double-neg46.7%

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

      \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log y + \left(-\log x\right)}, z\right) \]
    12. sub-neg46.7%

      \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log y - \log x}, z\right) \]
    13. log-div84.0%

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

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

    \[\leadsto -\color{blue}{z} \]
  6. Step-by-step derivation
    1. add-sqr-sqrt27.0%

      \[\leadsto -\color{blue}{\sqrt{z} \cdot \sqrt{z}} \]
    2. sqrt-unprod13.9%

      \[\leadsto -\color{blue}{\sqrt{z \cdot z}} \]
    3. sqr-neg13.9%

      \[\leadsto -\sqrt{\color{blue}{\left(-z\right) \cdot \left(-z\right)}} \]
    4. sqrt-unprod1.0%

      \[\leadsto -\color{blue}{\sqrt{-z} \cdot \sqrt{-z}} \]
    5. add-sqr-sqrt1.9%

      \[\leadsto -\color{blue}{\left(-z\right)} \]
    6. neg-sub01.9%

      \[\leadsto -\color{blue}{\left(0 - z\right)} \]
  7. Applied egg-rr1.9%

    \[\leadsto -\color{blue}{\left(0 - z\right)} \]
  8. Taylor expanded in z around 0 1.9%

    \[\leadsto \color{blue}{z} \]
  9. Final simplification1.9%

    \[\leadsto z \]
  10. Add Preprocessing

Developer target: 88.3% 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 2024096 
(FPCore (x y z)
  :name "Numeric.SpecFunctions.Extra:bd0 from math-functions-0.1.5.2"
  :precision binary64

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

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