Average Error: 15.0 → 0.2
Time: 11.7s
Precision: binary64
Cost: 58560
\[x \cdot \log \left(\frac{x}{y}\right) - z \]
\[\begin{array}{l} t_0 := \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right)\\ x \cdot \left(t_0 + \left(t_0 + t_0\right)\right) - z \end{array} \]
(FPCore (x y z) :precision binary64 (- (* x (log (/ x y))) z))
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (log (/ (cbrt x) (cbrt y))))) (- (* x (+ t_0 (+ t_0 t_0))) z)))
double code(double x, double y, double z) {
	return (x * log((x / y))) - z;
}
double code(double x, double y, double z) {
	double t_0 = log((cbrt(x) / cbrt(y)));
	return (x * (t_0 + (t_0 + t_0))) - z;
}
public static double code(double x, double y, double z) {
	return (x * Math.log((x / y))) - z;
}
public static double code(double x, double y, double z) {
	double t_0 = Math.log((Math.cbrt(x) / Math.cbrt(y)));
	return (x * (t_0 + (t_0 + t_0))) - z;
}
function code(x, y, z)
	return Float64(Float64(x * log(Float64(x / y))) - z)
end
function code(x, y, z)
	t_0 = log(Float64(cbrt(x) / cbrt(y)))
	return Float64(Float64(x * Float64(t_0 + Float64(t_0 + t_0))) - z)
end
code[x_, y_, z_] := N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[Log[N[(N[Power[x, 1/3], $MachinePrecision] / N[Power[y, 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[(x * N[(t$95$0 + N[(t$95$0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
x \cdot \log \left(\frac{x}{y}\right) - z
\begin{array}{l}
t_0 := \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right)\\
x \cdot \left(t_0 + \left(t_0 + t_0\right)\right) - z
\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original15.0
Target7.8
Herbie0.2
\[\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} \]

Derivation

  1. Initial program 15.0

    \[x \cdot \log \left(\frac{x}{y}\right) - z \]
  2. Applied egg-rr32.7

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

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

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

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

Alternatives

Alternative 1
Error7.8
Cost20424
\[\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 5 \cdot 10^{+302}:\\ \;\;\;\;t_0 - z\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
Alternative 2
Error0.4
Cost19908
\[\begin{array}{l} \mathbf{if}\;x \leq 0:\\ \;\;\;\;\mathsf{fma}\left(x, \log \left(\frac{-1}{y}\right) + \log \left(-x\right), -z\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \log x - x \cdot \log y\right) - z\\ \end{array} \]
Alternative 3
Error5.9
Cost13512
\[\begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-168}:\\ \;\;\;\;\left(-z\right) - x \cdot \log \left(\frac{y}{x}\right)\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{-308}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \]
Alternative 4
Error0.3
Cost13508
\[\begin{array}{l} \mathbf{if}\;y \leq 0:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \]
Alternative 5
Error0.3
Cost13508
\[\begin{array}{l} \mathbf{if}\;y \leq 0:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \log x - x \cdot \log y\right) - z\\ \end{array} \]
Alternative 6
Error21.4
Cost7312
\[\begin{array}{l} \mathbf{if}\;z \leq -5.548096587988062 \cdot 10^{+34}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq -1.937295576961193 \cdot 10^{-23}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\ \mathbf{elif}\;z \leq -1.4325113804953457 \cdot 10^{-64}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 3.737836133362085 \cdot 10^{-99}:\\ \;\;\;\;x \cdot \left(-\log \left(\frac{y}{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
Alternative 7
Error21.4
Cost7248
\[\begin{array}{l} t_0 := x \cdot \log \left(\frac{x}{y}\right)\\ \mathbf{if}\;z \leq -5.548096587988062 \cdot 10^{+34}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq -1.937295576961193 \cdot 10^{-23}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.4325113804953457 \cdot 10^{-64}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 3.737836133362085 \cdot 10^{-99}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
Alternative 8
Error31.4
Cost128
\[-z \]
Alternative 9
Error62.6
Cost64
\[z \]

Error

Reproduce

herbie shell --seed 2022300 
(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))