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

Percentage Accurate: 77.1% → 99.7%
Time: 13.5s
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.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 79.1%

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

      \[\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. associate-*l*79.1%

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

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

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

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

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

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

    \[\leadsto x \cdot \color{blue}{\left(\log \left(\sqrt[3]{\frac{x}{y}}\right) + 2 \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right)\right)} - z \]
  4. Step-by-step derivation
    1. distribute-rgt1-in79.0%

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

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

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

    \[\leadsto x \cdot \color{blue}{\left(\log \left(\sqrt[3]{\frac{x}{y}}\right) \cdot 3\right)} - z \]
  6. 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 \]
  7. 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 \]
  8. 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 \]
  9. Simplified99.7%

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

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

Alternative 2: 88.1% 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 10^{+301}\right):\\ \;\;\;\;x \cdot \log \left(x \cdot y\right) - z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t_0, x, -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 1e+301)))
     (- (* x (log (* x y))) z)
     (fma t_0 x (- 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 <= 1e+301)) {
		tmp = (x * log((x * y))) - z;
	} else {
		tmp = fma(t_0, x, -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 <= 1e+301))
		tmp = Float64(Float64(x * log(Float64(x * y))) - z);
	else
		tmp = fma(t_0, x, 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, 1e+301]], $MachinePrecision]], N[(N[(x * N[Log[N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(t$95$0 * x + (-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 10^{+301}\right):\\
\;\;\;\;x \cdot \log \left(x \cdot y\right) - z\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t_0, x, -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 1.00000000000000005e301 < (*.f64 x (log.f64 (/.f64 x y)))

    1. Initial program 7.0%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(\log x - \log y\right)} - z \]
      3. diff-log7.0%

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

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

        \[\leadsto \log \color{blue}{\left(\frac{1}{\frac{y}{x}}\right)} \cdot x - z \]
      6. associate-/r/7.0%

        \[\leadsto \log \color{blue}{\left(\frac{1}{y} \cdot x\right)} \cdot x - z \]
      7. add-exp-log3.1%

        \[\leadsto \log \left(\color{blue}{e^{\log \left(\frac{1}{y}\right)}} \cdot x\right) \cdot x - z \]
      8. neg-log3.1%

        \[\leadsto \log \left(e^{\color{blue}{-\log y}} \cdot x\right) \cdot x - z \]
      9. add-sqr-sqrt2.7%

        \[\leadsto \log \left(e^{\color{blue}{\sqrt{-\log y} \cdot \sqrt{-\log y}}} \cdot x\right) \cdot x - z \]
      10. sqrt-unprod23.8%

        \[\leadsto \log \left(e^{\color{blue}{\sqrt{\left(-\log y\right) \cdot \left(-\log y\right)}}} \cdot x\right) \cdot x - z \]
      11. sqr-neg23.8%

        \[\leadsto \log \left(e^{\sqrt{\color{blue}{\log y \cdot \log y}}} \cdot x\right) \cdot x - z \]
      12. sqrt-unprod21.1%

        \[\leadsto \log \left(e^{\color{blue}{\sqrt{\log y} \cdot \sqrt{\log y}}} \cdot x\right) \cdot x - z \]
      13. add-sqr-sqrt24.8%

        \[\leadsto \log \left(e^{\color{blue}{\log y}} \cdot x\right) \cdot x - z \]
      14. add-exp-log51.0%

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

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

    if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1.00000000000000005e301

    1. Initial program 99.8%

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

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

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

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

    \[\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^{+301}\right):\\ \;\;\;\;x \cdot \log \left(x \cdot y\right) - z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log \left(\frac{x}{y}\right), x, -z\right)\\ \end{array} \]

Alternative 3: 88.1% 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^{+301}\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+301)))
     (- (* 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+301)) {
		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+301)) {
		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+301):
		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+301))
		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+301)))
		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+301]], $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^{+301}\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 1.00000000000000005e301 < (*.f64 x (log.f64 (/.f64 x y)))

    1. Initial program 7.0%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(\log x - \log y\right)} - z \]
      3. diff-log7.0%

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

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

        \[\leadsto \log \color{blue}{\left(\frac{1}{\frac{y}{x}}\right)} \cdot x - z \]
      6. associate-/r/7.0%

        \[\leadsto \log \color{blue}{\left(\frac{1}{y} \cdot x\right)} \cdot x - z \]
      7. add-exp-log3.1%

        \[\leadsto \log \left(\color{blue}{e^{\log \left(\frac{1}{y}\right)}} \cdot x\right) \cdot x - z \]
      8. neg-log3.1%

        \[\leadsto \log \left(e^{\color{blue}{-\log y}} \cdot x\right) \cdot x - z \]
      9. add-sqr-sqrt2.7%

        \[\leadsto \log \left(e^{\color{blue}{\sqrt{-\log y} \cdot \sqrt{-\log y}}} \cdot x\right) \cdot x - z \]
      10. sqrt-unprod23.8%

        \[\leadsto \log \left(e^{\color{blue}{\sqrt{\left(-\log y\right) \cdot \left(-\log y\right)}}} \cdot x\right) \cdot x - z \]
      11. sqr-neg23.8%

        \[\leadsto \log \left(e^{\sqrt{\color{blue}{\log y \cdot \log y}}} \cdot x\right) \cdot x - z \]
      12. sqrt-unprod21.1%

        \[\leadsto \log \left(e^{\color{blue}{\sqrt{\log y} \cdot \sqrt{\log y}}} \cdot x\right) \cdot x - z \]
      13. add-sqr-sqrt24.8%

        \[\leadsto \log \left(e^{\color{blue}{\log y}} \cdot x\right) \cdot x - z \]
      14. add-exp-log51.0%

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

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

    if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1.00000000000000005e301

    1. Initial program 99.8%

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

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

Alternative 4: 86.9% 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^{+301}:\\ \;\;\;\;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+301) (- 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+301) {
		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+301) {
		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+301:
		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+301)
		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+301)
		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+301], 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^{+301}:\\
\;\;\;\;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.00000000000000005e301 < (*.f64 x (log.f64 (/.f64 x y)))

    1. Initial program 7.0%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    3. Step-by-step derivation
      1. neg-mul-145.6%

        \[\leadsto \color{blue}{-z} \]
    4. Simplified45.6%

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

    if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1.00000000000000005e301

    1. Initial program 99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot \log \left(\frac{x}{y}\right) \leq -\infty:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \cdot \log \left(\frac{x}{y}\right) \leq 10^{+301}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]

Alternative 5: 90.8% accurate, 0.5× speedup?

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

\mathbf{elif}\;x \leq -1 \cdot 10^{-305}:\\
\;\;\;\;-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 < -3.6000000000000003e-170

    1. Initial program 85.3%

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

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

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

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

    if -3.6000000000000003e-170 < x < -9.99999999999999996e-306

    1. Initial program 59.3%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    3. Step-by-step derivation
      1. neg-mul-196.5%

        \[\leadsto \color{blue}{-z} \]
    4. Simplified96.5%

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

    if -9.99999999999999996e-306 < x

    1. Initial program 78.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.6 \cdot 10^{-170}:\\ \;\;\;\;x \cdot \left(-\log \left(\frac{y}{x}\right)\right) - z\\ \mathbf{elif}\;x \leq -1 \cdot 10^{-305}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \]

Alternative 6: 99.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5 \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 (<= x -5e-310)
   (- (* x (- (log (- x)) (log (- y)))) z)
   (- (* x (- (log x) (log y))) z)))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -5e-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 (x <= (-5d-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 (x <= -5e-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 x <= -5e-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 (x <= -5e-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 (x <= -5e-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[x, -5e-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}\;x \leq -5 \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 x < -4.999999999999985e-310

    1. Initial program 79.5%

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

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

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

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

    if -4.999999999999985e-310 < x

    1. Initial program 78.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5 \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} \]

Alternative 7: 67.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.75 \cdot 10^{-45}:\\
\;\;\;\;-z\\

\mathbf{elif}\;z \leq 1.35 \cdot 10^{+29}:\\
\;\;\;\;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 < -2.75000000000000015e-45 or 1.35e29 < z

    1. Initial program 74.0%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    3. Step-by-step derivation
      1. neg-mul-170.6%

        \[\leadsto \color{blue}{-z} \]
    4. Simplified70.6%

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

    if -2.75000000000000015e-45 < z < 1.35e29

    1. Initial program 85.2%

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

        \[\leadsto \color{blue}{\frac{\left(x \cdot \log \left(\frac{x}{y}\right)\right) \cdot \left(x \cdot \log \left(\frac{x}{y}\right)\right) - z \cdot z}{x \cdot \log \left(\frac{x}{y}\right) + z}} \]
      2. clear-num61.9%

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

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

        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(x, \log \left(\frac{x}{y}\right), z\right)}{\color{blue}{{\left(x \cdot \log \left(\frac{x}{y}\right)\right)}^{2}} - z \cdot z}} \]
    3. Applied egg-rr61.9%

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x \cdot \left(\log \left(\frac{1}{y}\right) + -1 \cdot \log \left(\frac{1}{x}\right)\right)}}} \]
    5. Step-by-step derivation
      1. associate-/r*46.9%

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

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

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

        \[\leadsto \frac{1}{\frac{\frac{1}{x}}{\color{blue}{\left(-\log \left(\frac{1}{x}\right)\right)} + \left(-\log y\right)}} \]
      5. log-rec46.9%

        \[\leadsto \frac{1}{\frac{\frac{1}{x}}{\left(-\color{blue}{\left(-\log x\right)}\right) + \left(-\log y\right)}} \]
      6. remove-double-neg46.9%

        \[\leadsto \frac{1}{\frac{\frac{1}{x}}{\color{blue}{\log x} + \left(-\log y\right)}} \]
      7. sub-neg46.9%

        \[\leadsto \frac{1}{\frac{\frac{1}{x}}{\color{blue}{\log x - \log y}}} \]
      8. log-div70.7%

        \[\leadsto \frac{1}{\frac{\frac{1}{x}}{\color{blue}{\log \left(\frac{x}{y}\right)}}} \]
    6. Simplified70.7%

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{1}{x}}{\log \left(\frac{x}{y}\right)}}} \]
    7. Step-by-step derivation
      1. clear-num70.8%

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

        \[\leadsto \color{blue}{\log \left(\frac{x}{y}\right) \cdot \frac{1}{\frac{1}{x}}} \]
      3. remove-double-div71.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.75 \cdot 10^{-45}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+29}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]

Alternative 8: 49.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 79.1%

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

    \[\leadsto \color{blue}{-1 \cdot z} \]
  3. Step-by-step derivation
    1. neg-mul-147.8%

      \[\leadsto \color{blue}{-z} \]
  4. Simplified47.8%

    \[\leadsto \color{blue}{-z} \]
  5. Final simplification47.8%

    \[\leadsto -z \]

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 79.1%

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

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{\frac{-1}{z}}} \]
  5. Step-by-step derivation
    1. associate-/r/47.8%

      \[\leadsto \color{blue}{\frac{1}{-1} \cdot z} \]
    2. metadata-eval47.8%

      \[\leadsto \color{blue}{-1} \cdot z \]
    3. neg-mul-147.8%

      \[\leadsto \color{blue}{-z} \]
    4. neg-sub047.8%

      \[\leadsto \color{blue}{0 - z} \]
    5. metadata-eval47.8%

      \[\leadsto \color{blue}{\log 1} - z \]
    6. sub-neg47.8%

      \[\leadsto \color{blue}{\log 1 + \left(-z\right)} \]
    7. add-sqr-sqrt23.8%

      \[\leadsto \log 1 + \color{blue}{\sqrt{-z} \cdot \sqrt{-z}} \]
    8. sqrt-unprod14.7%

      \[\leadsto \log 1 + \color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}} \]
    9. sqr-neg14.7%

      \[\leadsto \log 1 + \sqrt{\color{blue}{z \cdot z}} \]
    10. sqrt-unprod1.3%

      \[\leadsto \log 1 + \color{blue}{\sqrt{z} \cdot \sqrt{z}} \]
    11. add-sqr-sqrt2.4%

      \[\leadsto \log 1 + \color{blue}{z} \]
    12. metadata-eval2.4%

      \[\leadsto \color{blue}{0} + z \]
  6. Applied egg-rr2.4%

    \[\leadsto \color{blue}{0 + z} \]
  7. Step-by-step derivation
    1. +-lft-identity2.4%

      \[\leadsto \color{blue}{z} \]
  8. Simplified2.4%

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

    \[\leadsto z \]

Developer target: 88.2% 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 2023279 
(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))