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

Percentage Accurate: 78.0% → 99.7%
Time: 13.3s
Alternatives: 10
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 10 alternatives:

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot \left(\color{blue}{2 \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right)} + \log \left(\sqrt[3]{\frac{x}{y}}\right)\right) - z \]
    2. distribute-lft1-in77.5%

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

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

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

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

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

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

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

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

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

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

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

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

\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;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.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 89.7%

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

    if +inf.0 < (*.f64 x (log.f64 (/.f64 x y)))

    1. Initial program 77.5%

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

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

      \[\leadsto x \cdot \color{blue}{\left(\log x - \log y\right)} - z \]
    5. Taylor expanded in z around 0 27.5%

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

    \[\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 \infty:\\ \;\;\;\;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: 83.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 \infty\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 INFINITY))) (- 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 <= ((double) INFINITY))) {
		tmp = -z;
	} else {
		tmp = t_0 - z;
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	double t_0 = x * Math.log((x / y));
	double tmp;
	if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= Double.POSITIVE_INFINITY)) {
		tmp = -z;
	} else {
		tmp = t_0 - z;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * math.log((x / y))
	tmp = 0
	if (t_0 <= -math.inf) or not (t_0 <= math.inf):
		tmp = -z
	else:
		tmp = t_0 - z
	return tmp
function code(x, y, z)
	t_0 = Float64(x * log(Float64(x / y)))
	tmp = 0.0
	if ((t_0 <= Float64(-Inf)) || !(t_0 <= Inf))
		tmp = Float64(-z);
	else
		tmp = Float64(t_0 - z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * log((x / y));
	tmp = 0.0;
	if ((t_0 <= -Inf) || ~((t_0 <= Inf)))
		tmp = -z;
	else
		tmp = t_0 - z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, Infinity]], $MachinePrecision]], (-z), N[(t$95$0 - z), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{if}\;t\_0 \leq -\infty \lor \neg \left(t\_0 \leq \infty\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 +inf.0 < (*.f64 x (log.f64 (/.f64 x y)))

    1. Initial program 5.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 89.7%

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

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

Alternative 4: 94.1% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 47.1%

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

        \[\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-num2.5%

        \[\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-def2.5%

        \[\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. pow22.5%

        \[\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}} \]
      5. pow22.5%

        \[\leadsto \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} - \color{blue}{{z}^{2}}}} \]
    4. Applied egg-rr2.5%

      \[\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}^{2}}}} \]
    5. Taylor expanded in z around 0 44.5%

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

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

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

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

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

    if -3.75000000000000023e152 < x < -5.0000000000000002e-136

    1. Initial program 96.1%

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

    if -5.0000000000000002e-136 < x < -4.9999999999999995e-309

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e-309 < x

    1. Initial program 79.6%

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

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

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

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

Alternative 5: 94.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+147}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\\ \mathbf{elif}\;x \leq -3.6 \cdot 10^{-136}:\\ \;\;\;\;x \cdot \left(3 \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right)\right) - z\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-309}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -9.5e+147)
   (* x (+ (log (- x)) (log (/ -1.0 y))))
   (if (<= x -3.6e-136)
     (- (* x (* 3.0 (log (cbrt (/ x y))))) z)
     (if (<= x -5e-309) (- z) (- (* x (- (log x) (log y))) z)))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -9.5e+147) {
		tmp = x * (log(-x) + log((-1.0 / y)));
	} else if (x <= -3.6e-136) {
		tmp = (x * (3.0 * log(cbrt((x / y))))) - z;
	} else if (x <= -5e-309) {
		tmp = -z;
	} else {
		tmp = (x * (log(x) - log(y))) - z;
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -9.5e+147) {
		tmp = x * (Math.log(-x) + Math.log((-1.0 / y)));
	} else if (x <= -3.6e-136) {
		tmp = (x * (3.0 * Math.log(Math.cbrt((x / y))))) - z;
	} else if (x <= -5e-309) {
		tmp = -z;
	} else {
		tmp = (x * (Math.log(x) - Math.log(y))) - z;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (x <= -9.5e+147)
		tmp = Float64(x * Float64(log(Float64(-x)) + log(Float64(-1.0 / y))));
	elseif (x <= -3.6e-136)
		tmp = Float64(Float64(x * Float64(3.0 * log(cbrt(Float64(x / y))))) - z);
	elseif (x <= -5e-309)
		tmp = Float64(-z);
	else
		tmp = Float64(Float64(x * Float64(log(x) - log(y))) - z);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[x, -9.5e+147], N[(x * N[(N[Log[(-x)], $MachinePrecision] + N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.6e-136], N[(N[(x * N[(3.0 * N[Log[N[Power[N[(x / y), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, -5e-309], (-z), N[(N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -3.6 \cdot 10^{-136}:\\
\;\;\;\;x \cdot \left(3 \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right)\right) - z\\

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

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


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

    1. Initial program 47.1%

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

        \[\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-num2.5%

        \[\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-def2.5%

        \[\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. pow22.5%

        \[\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}} \]
      5. pow22.5%

        \[\leadsto \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} - \color{blue}{{z}^{2}}}} \]
    4. Applied egg-rr2.5%

      \[\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}^{2}}}} \]
    5. Taylor expanded in z around 0 44.5%

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

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

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

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

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

    if -9.4999999999999996e147 < x < -3.5999999999999998e-136

    1. Initial program 96.1%

      \[x \cdot \log \left(\frac{x}{y}\right) - z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt96.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. log-prod96.1%

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

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

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

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

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

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

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

    if -3.5999999999999998e-136 < x < -4.9999999999999995e-309

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e-309 < x

    1. Initial program 79.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+147}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\\ \mathbf{elif}\;x \leq -3.6 \cdot 10^{-136}:\\ \;\;\;\;x \cdot \left(3 \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right)\right) - z\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-309}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 91.7% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.5999999999999998e-136

    1. Initial program 75.9%

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

    if -3.5999999999999998e-136 < x < -4.9999999999999995e-309

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e-309 < x

    1. Initial program 79.6%

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

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

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

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

Alternative 7: 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 75.2%

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

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

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

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

      \[\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 8: 66.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{-84} \lor \neg \left(z \leq 3.6 \cdot 10^{-72}\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 < -1.95000000000000011e-84 or 3.6e-72 < z

    1. Initial program 78.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.95000000000000011e-84 < z < 3.6e-72

    1. Initial program 76.3%

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

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

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

Alternative 9: 49.5% 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 77.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 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 77.5%

    \[x \cdot \log \left(\frac{x}{y}\right) - z \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--45.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-num44.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-def44.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. pow244.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}} \]
    5. pow244.9%

      \[\leadsto \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} - \color{blue}{{z}^{2}}}} \]
  4. Applied egg-rr44.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}^{2}}}} \]
  5. Taylor expanded in x around 0 47.9%

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

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\frac{-1}{z}}} \cdot \sqrt{\frac{1}{\frac{-1}{z}}}} \]
    2. sqrt-unprod15.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\frac{-1}{z}} \cdot \frac{1}{\frac{-1}{z}}}} \]
    3. associate-/r/15.1%

      \[\leadsto \sqrt{\color{blue}{\left(\frac{1}{-1} \cdot z\right)} \cdot \frac{1}{\frac{-1}{z}}} \]
    4. metadata-eval15.1%

      \[\leadsto \sqrt{\left(\color{blue}{-1} \cdot z\right) \cdot \frac{1}{\frac{-1}{z}}} \]
    5. associate-/r/15.1%

      \[\leadsto \sqrt{\left(-1 \cdot z\right) \cdot \color{blue}{\left(\frac{1}{-1} \cdot z\right)}} \]
    6. metadata-eval15.1%

      \[\leadsto \sqrt{\left(-1 \cdot z\right) \cdot \left(\color{blue}{-1} \cdot z\right)} \]
    7. swap-sqr15.1%

      \[\leadsto \sqrt{\color{blue}{\left(-1 \cdot -1\right) \cdot \left(z \cdot z\right)}} \]
    8. metadata-eval15.1%

      \[\leadsto \sqrt{\color{blue}{1} \cdot \left(z \cdot z\right)} \]
    9. *-un-lft-identity15.1%

      \[\leadsto \sqrt{\color{blue}{z \cdot z}} \]
    10. sqrt-unprod1.2%

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

      \[\leadsto \color{blue}{z} \]
    12. expm1-log1p-u2.1%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(z\right)\right)} \]
    13. expm1-udef2.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(z\right)} - 1} \]
  7. Applied egg-rr2.0%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(z\right)} - 1} \]
  8. Step-by-step derivation
    1. expm1-def2.1%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(z\right)\right)} \]
    2. expm1-log1p2.5%

      \[\leadsto \color{blue}{z} \]
  9. Simplified2.5%

    \[\leadsto \color{blue}{z} \]
  10. Final simplification2.5%

    \[\leadsto z \]
  11. Add Preprocessing

Developer target: 89.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 2024027 
(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))