Average Error: 15.5 → 0.2
Time: 8.9s
Precision: binary64
Cost: 19776
\[x \cdot \log \left(\frac{x}{y}\right) - z \]
\[x \cdot \left(3 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right)\right) - z \]
(FPCore (x y z) :precision binary64 (- (* x (log (/ x y))) z))
(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 * log((x / 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 * Math.log((x / 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 * log(Float64(x / y))) - z)
end
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[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
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]
x \cdot \log \left(\frac{x}{y}\right) - z
x \cdot \left(3 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right)\right) - z

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original15.5
Target8.2
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.5

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

    \[\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 \]
  3. Applied egg-rr15.6

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

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

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

Alternatives

Alternative 1
Error8.7
Cost26760
\[\begin{array}{l} t_0 := \log \left(\frac{x}{y}\right)\\ t_1 := x \cdot t_0\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;-z\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+306}:\\ \;\;\;\;\mathsf{fma}\left(x, t_0, -z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right)\\ \end{array} \]
Alternative 2
Error8.7
Cost26696
\[\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 2 \cdot 10^{+306}:\\ \;\;\;\;t_0 - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right)\\ \end{array} \]
Alternative 3
Error7.9
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 2 \cdot 10^{+306}:\\ \;\;\;\;t_0 - z\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
Alternative 4
Error8.6
Cost13712
\[\begin{array}{l} t_0 := \log \left(\frac{x}{y}\right)\\ \mathbf{if}\;x \leq -1 \cdot 10^{+226}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-171}:\\ \;\;\;\;x \cdot t_0 - z\\ \mathbf{elif}\;x \leq 1.55 \cdot 10^{-152}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 10^{+145}:\\ \;\;\;\;\mathsf{fma}\left(x, t_0, -z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right)\\ \end{array} \]
Alternative 5
Error4.6
Cost13644
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+226}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-171}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\ \mathbf{elif}\;x \leq 10^{-307}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \]
Alternative 6
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 7
Error22.9
Cost7048
\[\begin{array}{l} t_0 := x \cdot \left(-\log \left(\frac{y}{x}\right)\right)\\ \mathbf{if}\;x \leq -490000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{-90}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error23.4
Cost6984
\[\begin{array}{l} t_0 := x \cdot \log \left(\frac{x}{y}\right)\\ \mathbf{if}\;x \leq -490000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{-90}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error31.2
Cost128
\[-z \]

Error

Reproduce

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