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

Percentage Accurate: 76.6% → 99.5%
Time: 9.5s
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.6% 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 -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 (<= y -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 (y <= -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 (y <= (-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 (y <= -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 y <= -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 (y <= -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 (y <= -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[y, -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}\;y \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 y < -4.999999999999985e-310

    1. Initial program 79.3%

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

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

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

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

    if -4.999999999999985e-310 < y

    1. Initial program 72.2%

      \[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 -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} \]
  5. Add Preprocessing

Alternative 2: 87.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:\\ \;\;\;\;x \cdot \log \left(y \cdot x\right) - z\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+297}:\\ \;\;\;\;t\_0 - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (log (/ x y)))))
   (if (<= t_0 (- INFINITY))
     (- (* x (log (* y x))) z)
     (if (<= t_0 2e+297) (- t_0 z) (* x (- (log x) (log y)))))))
double code(double x, double y, double z) {
	double t_0 = x * log((x / y));
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = (x * log((y * x))) - z;
	} else if (t_0 <= 2e+297) {
		tmp = t_0 - z;
	} else {
		tmp = x * (log(x) - log(y));
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	double t_0 = x * Math.log((x / y));
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = (x * Math.log((y * x))) - z;
	} else if (t_0 <= 2e+297) {
		tmp = t_0 - z;
	} else {
		tmp = x * (Math.log(x) - Math.log(y));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * math.log((x / y))
	tmp = 0
	if t_0 <= -math.inf:
		tmp = (x * math.log((y * x))) - z
	elif t_0 <= 2e+297:
		tmp = t_0 - z
	else:
		tmp = x * (math.log(x) - math.log(y))
	return tmp
function code(x, y, z)
	t_0 = Float64(x * log(Float64(x / y)))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(Float64(x * log(Float64(y * x))) - z);
	elseif (t_0 <= 2e+297)
		tmp = Float64(t_0 - z);
	else
		tmp = Float64(x * Float64(log(x) - log(y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * log((x / y));
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = (x * log((y * x))) - z;
	elseif (t_0 <= 2e+297)
		tmp = t_0 - z;
	else
		tmp = x * (log(x) - log(y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(x * N[Log[N[(y * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[t$95$0, 2e+297], N[(t$95$0 - z), $MachinePrecision], N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+297}:\\
\;\;\;\;t\_0 - z\\

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


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

    1. Initial program 5.4%

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

        \[\leadsto x \cdot \color{blue}{\left(\log x - \log y\right)} - z \]
      2. add-cube-cbrt43.2%

        \[\leadsto x \cdot \left(\color{blue}{\left(\sqrt[3]{\log x} \cdot \sqrt[3]{\log x}\right) \cdot \sqrt[3]{\log x}} - \log y\right) - z \]
      3. *-un-lft-identity43.2%

        \[\leadsto x \cdot \left(\left(\sqrt[3]{\log x} \cdot \sqrt[3]{\log x}\right) \cdot \sqrt[3]{\log x} - \color{blue}{1 \cdot \log y}\right) - z \]
      4. prod-diff43.2%

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

      \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{\log x} \cdot \sqrt[3]{\log x}, \sqrt[3]{\log x}, -\log y \cdot 1\right) + \mathsf{fma}\left(-\log y, 1, \log y \cdot 1\right)\right)} - z \]
    5. Step-by-step derivation
      1. prod-diff43.2%

        \[\leadsto x \cdot \color{blue}{\left(\left(\sqrt[3]{\log x} \cdot \sqrt[3]{\log x}\right) \cdot \sqrt[3]{\log x} - 1 \cdot \log y\right)} - z \]
      2. *-un-lft-identity43.2%

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

        \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(\sqrt[3]{\log x} \cdot \sqrt[3]{\log x}, \sqrt[3]{\log x}, -\log y\right)} - z \]
      4. *-rgt-identity43.2%

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

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

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

        \[\leadsto \color{blue}{\left(x \cdot \log x + x \cdot \left(-\log y \cdot 1\right)\right)} - z \]
      8. add-sqr-sqrt0.0%

        \[\leadsto \left(x \cdot \log x + x \cdot \color{blue}{\left(\sqrt{-\log y \cdot 1} \cdot \sqrt{-\log y \cdot 1}\right)}\right) - z \]
      9. sqrt-unprod40.9%

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

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

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

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

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

    if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 2e297

    1. Initial program 99.8%

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

    if 2e297 < (*.f64 x (log.f64 (/.f64 x y)))

    1. Initial program 11.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(x, \log \left(\frac{y}{x}\right), \color{blue}{z}\right) \]
    3. Simplified14.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 inf 56.8%

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

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

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

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

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

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

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

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

Alternative 3: 87.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 \lor \neg \left(t\_0 \leq 10^{+301}\right):\\ \;\;\;\;x \cdot \log \left(y \cdot x\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 (* y x))) 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((y * x))) - 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((y * x))) - 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((y * x))) - 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(y * x))) - 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((y * x))) - 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[(y * x), $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(y \cdot x\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 6.7%

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

        \[\leadsto x \cdot \color{blue}{\left(\log x - \log y\right)} - z \]
      2. add-cube-cbrt55.8%

        \[\leadsto x \cdot \left(\color{blue}{\left(\sqrt[3]{\log x} \cdot \sqrt[3]{\log x}\right) \cdot \sqrt[3]{\log x}} - \log y\right) - z \]
      3. *-un-lft-identity55.8%

        \[\leadsto x \cdot \left(\left(\sqrt[3]{\log x} \cdot \sqrt[3]{\log x}\right) \cdot \sqrt[3]{\log x} - \color{blue}{1 \cdot \log y}\right) - z \]
      4. prod-diff55.8%

        \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{\log x} \cdot \sqrt[3]{\log x}, \sqrt[3]{\log x}, -\log y \cdot 1\right) + \mathsf{fma}\left(-\log y, 1, \log y \cdot 1\right)\right)} - z \]
    4. Applied egg-rr55.8%

      \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{\log x} \cdot \sqrt[3]{\log x}, \sqrt[3]{\log x}, -\log y \cdot 1\right) + \mathsf{fma}\left(-\log y, 1, \log y \cdot 1\right)\right)} - z \]
    5. Step-by-step derivation
      1. prod-diff55.8%

        \[\leadsto x \cdot \color{blue}{\left(\left(\sqrt[3]{\log x} \cdot \sqrt[3]{\log x}\right) \cdot \sqrt[3]{\log x} - 1 \cdot \log y\right)} - z \]
      2. *-un-lft-identity55.8%

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

        \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(\sqrt[3]{\log x} \cdot \sqrt[3]{\log x}, \sqrt[3]{\log x}, -\log y\right)} - z \]
      4. *-rgt-identity55.8%

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

        \[\leadsto x \cdot \color{blue}{\left(\left(\sqrt[3]{\log x} \cdot \sqrt[3]{\log x}\right) \cdot \sqrt[3]{\log x} + \left(-\log y \cdot 1\right)\right)} - z \]
      6. add-cube-cbrt55.9%

        \[\leadsto x \cdot \left(\color{blue}{\log x} + \left(-\log y \cdot 1\right)\right) - z \]
      7. distribute-lft-in55.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \log \left(x \cdot y\right)} - 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. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification89.6%

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

Alternative 4: 93.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -8 \cdot 10^{+163}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-139}:\\ \;\;\;\;-\mathsf{fma}\left(x, \log \left(\frac{y}{x}\right), z\right)\\ \mathbf{elif}\;x \leq -1 \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 -8e+163)
   (* x (- (log (- x)) (log (- y))))
   (if (<= x -1.2e-139)
     (- (fma x (log (/ y x)) z))
     (if (<= x -1e-308) (- z) (- (* x (- (log x) (log y))) z)))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -8e+163) {
		tmp = x * (log(-x) - log(-y));
	} else if (x <= -1.2e-139) {
		tmp = -fma(x, log((y / x)), z);
	} else if (x <= -1e-308) {
		tmp = -z;
	} else {
		tmp = (x * (log(x) - log(y))) - z;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (x <= -8e+163)
		tmp = Float64(x * Float64(log(Float64(-x)) - log(Float64(-y))));
	elseif (x <= -1.2e-139)
		tmp = Float64(-fma(x, log(Float64(y / x)), z));
	elseif (x <= -1e-308)
		tmp = Float64(-z);
	else
		tmp = Float64(Float64(x * Float64(log(x) - log(y))) - z);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[x, -8e+163], N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.2e-139], (-N[(x * N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision] + z), $MachinePrecision]), If[LessEqual[x, -1e-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 -8 \cdot 10^{+163}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\

\mathbf{elif}\;x \leq -1.2 \cdot 10^{-139}:\\
\;\;\;\;-\mathsf{fma}\left(x, \log \left(\frac{y}{x}\right), z\right)\\

\mathbf{elif}\;x \leq -1 \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 < -7.9999999999999995e163

    1. Initial program 59.1%

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

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

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

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

        \[\leadsto -\color{blue}{\left(\left(-x \cdot \log \left(\frac{x}{y}\right)\right) - \left(-z\right)\right)} \]
      5. distribute-rgt-neg-in59.1%

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log \left(\frac{y}{x}\right)}, -\left(-z\right)\right) \]
      14. remove-double-neg60.9%

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

      \[\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 0.0%

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

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

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

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

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

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

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

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

    if -7.9999999999999995e163 < x < -1.20000000000000007e-139

    1. Initial program 88.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log \left(\frac{y}{x}\right)}, -\left(-z\right)\right) \]
      14. remove-double-neg91.2%

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

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

    if -1.20000000000000007e-139 < x < -9.9999999999999991e-309

    1. Initial program 71.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(x, \log \left(\frac{y}{x}\right), \color{blue}{z}\right) \]
    3. Simplified71.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 96.2%

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

    if -9.9999999999999991e-309 < x

    1. Initial program 72.2%

      \[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 4 regimes into one program.
  4. Final simplification95.3%

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

Alternative 5: 91.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-139}:\\ \;\;\;\;-\mathsf{fma}\left(x, \log \left(\frac{y}{x}\right), z\right)\\ \mathbf{elif}\;x \leq -1 \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 -1.5e-139)
   (- (fma x (log (/ y x)) z))
   (if (<= x -1e-308) (- z) (- (* x (- (log x) (log y))) z))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -1.5e-139) {
		tmp = -fma(x, log((y / x)), z);
	} else if (x <= -1e-308) {
		tmp = -z;
	} else {
		tmp = (x * (log(x) - log(y))) - z;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (x <= -1.5e-139)
		tmp = Float64(-fma(x, log(Float64(y / x)), z));
	elseif (x <= -1e-308)
		tmp = Float64(-z);
	else
		tmp = Float64(Float64(x * Float64(log(x) - log(y))) - z);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[x, -1.5e-139], (-N[(x * N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision] + z), $MachinePrecision]), If[LessEqual[x, -1e-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 -1.5 \cdot 10^{-139}:\\
\;\;\;\;-\mathsf{fma}\left(x, \log \left(\frac{y}{x}\right), z\right)\\

\mathbf{elif}\;x \leq -1 \cdot 10^{-308}:\\
\;\;\;\;-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 < -1.5e-139

    1. Initial program 81.0%

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

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

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

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

        \[\leadsto -\color{blue}{\left(\left(-x \cdot \log \left(\frac{x}{y}\right)\right) - \left(-z\right)\right)} \]
      5. distribute-rgt-neg-in81.0%

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log \left(\frac{y}{x}\right)}, -\left(-z\right)\right) \]
      14. remove-double-neg83.2%

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

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

    if -1.5e-139 < x < -9.9999999999999991e-309

    1. Initial program 71.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(x, \log \left(\frac{y}{x}\right), \color{blue}{z}\right) \]
    3. Simplified71.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 96.2%

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

    if -9.9999999999999991e-309 < x

    1. Initial program 72.2%

      \[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 3 regimes into one program.
  4. Final simplification92.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-139}:\\ \;\;\;\;-\mathsf{fma}\left(x, \log \left(\frac{y}{x}\right), z\right)\\ \mathbf{elif}\;x \leq -1 \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 -1.85 \cdot 10^{-53} \lor \neg \left(z \leq 2.1 \cdot 10^{-19}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;\left(-x\right) \cdot \log \left(\frac{y}{x}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -1.85e-53) (not (<= z 2.1e-19))) (- z) (* (- x) (log (/ y x)))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.85e-53) || !(z <= 2.1e-19)) {
		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 <= (-1.85d-53)) .or. (.not. (z <= 2.1d-19))) 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 <= -1.85e-53) || !(z <= 2.1e-19)) {
		tmp = -z;
	} else {
		tmp = -x * Math.log((y / x));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -1.85e-53) or not (z <= 2.1e-19):
		tmp = -z
	else:
		tmp = -x * math.log((y / x))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -1.85e-53) || !(z <= 2.1e-19))
		tmp = Float64(-z);
	else
		tmp = Float64(Float64(-x) * log(Float64(y / x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -1.85e-53) || ~((z <= 2.1e-19)))
		tmp = -z;
	else
		tmp = -x * log((y / x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.85e-53], N[Not[LessEqual[z, 2.1e-19]], $MachinePrecision]], (-z), N[((-x) * N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{-53} \lor \neg \left(z \leq 2.1 \cdot 10^{-19}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.84999999999999991e-53 or 2.0999999999999999e-19 < z

    1. Initial program 72.9%

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

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

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

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

        \[\leadsto -\color{blue}{\left(\left(-x \cdot \log \left(\frac{x}{y}\right)\right) - \left(-z\right)\right)} \]
      5. distribute-rgt-neg-in72.9%

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log \left(\frac{y}{x}\right)}, -\left(-z\right)\right) \]
      14. remove-double-neg74.1%

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

      \[\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 74.9%

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

    if -1.84999999999999991e-53 < z < 2.0999999999999999e-19

    1. Initial program 80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log \left(\frac{y}{x}\right)}, -\left(-z\right)\right) \]
      14. remove-double-neg80.9%

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

      \[\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 34.6%

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

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

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

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

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

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

Alternative 7: 67.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{-54} \lor \neg \left(z \leq 2.5 \cdot 10^{-25}\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 < -4.5999999999999998e-54 or 2.49999999999999981e-25 < z

    1. Initial program 72.9%

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

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

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

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

        \[\leadsto -\color{blue}{\left(\left(-x \cdot \log \left(\frac{x}{y}\right)\right) - \left(-z\right)\right)} \]
      5. distribute-rgt-neg-in72.9%

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(x, \color{blue}{\log \left(\frac{y}{x}\right)}, -\left(-z\right)\right) \]
      14. remove-double-neg74.1%

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

      \[\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 74.9%

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

    if -4.5999999999999998e-54 < z < 2.49999999999999981e-25

    1. Initial program 80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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 53.0%

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

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

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 2024043 
(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))