Average Error: 14.5 → 0.2
Time: 14.0s
Precision: binary64
\[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 + 2 \cdot t_0\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 (* 2.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 + (2.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 + (2.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(2.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[(2.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 + 2 \cdot t_0\right) - z
\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original14.5
Target7.6
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 14.5

    \[x \cdot \log \left(\frac{x}{y}\right) - z \]
  2. Applied add-cube-cbrt_binary6414.5

    \[\leadsto x \cdot \log \left(\frac{x}{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}\right) - z \]
  3. Applied add-cube-cbrt_binary6414.5

    \[\leadsto x \cdot \log \left(\frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}\right) - z \]
  4. Applied times-frac_binary6414.5

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

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

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

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

Reproduce

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