?

Average Accuracy: 76.2% → 99.7%
Time: 15.1s
Precision: binary64
Cost: 19904

?

\[x \cdot \log \left(\frac{x}{y}\right) - z \]
\[\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right) \cdot \left(x + x \cdot 2\right) - z \]
(FPCore (x y z) :precision binary64 (- (* x (log (/ x y))) z))
(FPCore (x y z)
 :precision binary64
 (- (* (log (/ (cbrt x) (cbrt y))) (+ x (* x 2.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 (log((cbrt(x) / cbrt(y))) * (x + (x * 2.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 (Math.log((Math.cbrt(x) / Math.cbrt(y))) * (x + (x * 2.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(log(Float64(cbrt(x) / cbrt(y))) * Float64(x + Float64(x * 2.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[(N[Log[N[(N[Power[x, 1/3], $MachinePrecision] / N[Power[y, 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(x + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
x \cdot \log \left(\frac{x}{y}\right) - z
\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right) \cdot \left(x + x \cdot 2\right) - z

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original76.2%
Target87.7%
Herbie99.7%
\[\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 76.2%

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

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

    [Start]76.2

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

    add-cube-cbrt [=>]76.2

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

    log-prod [=>]76.1

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

    distribute-rgt-in [=>]76.1

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

    pow2 [=>]76.1

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

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

    [Start]76.1

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

    *-commutative [=>]76.1

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

    fma-def [=>]76.2

    \[ \color{blue}{\mathsf{fma}\left(x, \log \left({\left(\sqrt[3]{\frac{x}{y}}\right)}^{2}\right), \log \left(\sqrt[3]{\frac{x}{y}}\right) \cdot x\right)} - z \]

    log-pow [=>]76.2

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

    *-commutative [=>]76.2

    \[ \mathsf{fma}\left(x, 2 \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right), \color{blue}{x \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right)}\right) - z \]
  4. Simplified76.1%

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

    [Start]76.2

    \[ \mathsf{fma}\left(x, 2 \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right), x \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right)\right) - z \]

    fma-udef [=>]76.1

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

    associate-*l* [<=]76.1

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

    distribute-rgt-out [=>]76.1

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

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

    [Start]76.1

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

    cbrt-div [=>]99.7

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

    div-inv [=>]99.7

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

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

    [Start]99.7

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

    associate-*r/ [=>]99.7

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

    *-rgt-identity [=>]99.7

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

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

Alternatives

Alternative 1
Accuracy87.3%
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^{+299}:\\ \;\;\;\;t_0 - z\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
Alternative 2
Accuracy86.6%
Cost13776
\[\begin{array}{l} t_0 := \log \left(\frac{y}{x}\right)\\ \mathbf{if}\;x \leq -1.14 \cdot 10^{+114}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\ \mathbf{elif}\;x \leq -7.5 \cdot 10^{-177}:\\ \;\;\;\;\frac{x}{\frac{1}{-t_0}} - z\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-243}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{+199}:\\ \;\;\;\;\left(-z\right) - x \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log x - x \cdot \log y\\ \end{array} \]
Alternative 3
Accuracy86.8%
Cost13648
\[\begin{array}{l} t_0 := \log \left(\frac{y}{x}\right)\\ \mathbf{if}\;x \leq -3.8 \cdot 10^{+114}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\ \mathbf{elif}\;x \leq -1.22 \cdot 10^{-175}:\\ \;\;\;\;\frac{x}{\frac{1}{-t_0}} - z\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-243}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 6 \cdot 10^{+165}:\\ \;\;\;\;\left(-z\right) - x \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right)\\ \end{array} \]
Alternative 4
Accuracy93.0%
Cost13644
\[\begin{array}{l} \mathbf{if}\;x \leq -3.3 \cdot 10^{+112}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\ \mathbf{elif}\;x \leq -3.2 \cdot 10^{-177}:\\ \;\;\;\;\frac{x}{\frac{1}{-\log \left(\frac{y}{x}\right)}} - z\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-303}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \]
Alternative 5
Accuracy99.5%
Cost13636
\[\begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-311}:\\ \;\;\;\;\frac{x}{\frac{1}{\log \left(-x\right) - \log \left(-y\right)}} - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \]
Alternative 6
Accuracy99.5%
Cost13508
\[\begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-311}:\\ \;\;\;\;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
Accuracy67.2%
Cost7048
\[\begin{array}{l} \mathbf{if}\;z \leq -2.15 \cdot 10^{-39}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 3.45 \cdot 10^{-35}:\\ \;\;\;\;x \cdot \left(-\log \left(\frac{y}{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
Alternative 8
Accuracy67.1%
Cost6984
\[\begin{array}{l} \mathbf{if}\;z \leq -4.6 \cdot 10^{-36}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-37}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
Alternative 9
Accuracy49.7%
Cost128
\[-z \]

Error

Reproduce?

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