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

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original15.8
Target7.7
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.8

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

    \[\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. Simplified15.8

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

    [Start]15.8

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

    log-pow [=>]15.8

    \[ 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 \]

    *-lft-identity [<=]15.8

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

    distribute-rgt-out [=>]15.8

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

    metadata-eval [=>]15.8

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

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

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

    [Start]0.2

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

    associate-*r/ [=>]0.2

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

    associate-*l/ [<=]0.2

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

    *-rgt-identity [=>]0.2

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

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

Alternatives

Alternative 1
Error8.4
Cost20425
\[\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 5 \cdot 10^{+293}\right):\\ \;\;\;\;x \cdot \log \left(x \cdot y\right) - z\\ \mathbf{else}:\\ \;\;\;\;t_0 - z\\ \end{array} \]
Alternative 2
Error8.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 5 \cdot 10^{+293}:\\ \;\;\;\;t_0 - z\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
Alternative 3
Error4.3
Cost13644
\[\begin{array}{l} \mathbf{if}\;x \leq -1.6 \cdot 10^{+165}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\\ \mathbf{elif}\;x \leq -4.4 \cdot 10^{-111}:\\ \;\;\;\;\left(-x\right) \cdot \log \left(\frac{y}{x}\right) - z\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-308}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \]
Alternative 4
Error6.0
Cost13512
\[\begin{array}{l} \mathbf{if}\;x \leq -6 \cdot 10^{-116}:\\ \;\;\;\;\left(-x\right) \cdot \log \left(\frac{y}{x}\right) - z\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-307}:\\ \;\;\;\;-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 -2 \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} \]
Alternative 6
Error24.3
Cost7250
\[\begin{array}{l} \mathbf{if}\;x \leq -1.92 \cdot 10^{+96} \lor \neg \left(x \leq 4.5 \cdot 10^{+21} \lor \neg \left(x \leq 1.05 \cdot 10^{+68}\right) \land x \leq 1.06 \cdot 10^{+96}\right):\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
Alternative 7
Error23.8
Cost7249
\[\begin{array}{l} \mathbf{if}\;x \leq -2.2 \cdot 10^{+62}:\\ \;\;\;\;\left(-x\right) \cdot \log \left(\frac{y}{x}\right)\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{+26} \lor \neg \left(x \leq 9.5 \cdot 10^{+67}\right) \land x \leq 1.06 \cdot 10^{+96}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\ \end{array} \]
Alternative 8
Error32.1
Cost128
\[-z \]
Alternative 9
Error62.5
Cost64
\[z \]

Error

Reproduce

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