?

Average Error: 24.54% → 0.3%
Time: 11.0s
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

Original24.54%
Target12.7%
Herbie0.3%
\[\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 24.54

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

    \[\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 \]
  3. Applied egg-rr24.55

    \[\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 \]
  4. Simplified24.6

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

    [Start]24.55

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

    \[ \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* [<=]24.6

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

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

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

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

    [Start]0.3

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

    associate-*r/ [=>]0.3

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

    *-rgt-identity [=>]0.3

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

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

Alternatives

Alternative 1
Error12%
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^{+306}:\\ \;\;\;\;t_0 - z\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
Alternative 2
Error0.5%
Cost19844
\[\begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{-311}:\\ \;\;\;\;\mathsf{fma}\left(\log \left(-x\right) - \log \left(-y\right), x, -z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \]
Alternative 3
Error13.19%
Cost13648
\[\begin{array}{l} t_0 := x \cdot \log \left(\frac{x}{y}\right) - z\\ \mathbf{if}\;x \leq -1.16 \cdot 10^{+119}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{-141}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{-126}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{+124}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right)\\ \end{array} \]
Alternative 4
Error7.21%
Cost13644
\[\begin{array}{l} \mathbf{if}\;x \leq -1.85 \cdot 10^{+119}:\\ \;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-142}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\ \mathbf{elif}\;x \leq -1 \cdot 10^{-304}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\log x - \log y\right) - z\\ \end{array} \]
Alternative 5
Error0.5%
Cost13508
\[\begin{array}{l} \mathbf{if}\;y \leq -5 \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
Error32.53%
Cost6984
\[\begin{array}{l} \mathbf{if}\;z \leq -5.9 \cdot 10^{-56}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 410:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
Alternative 7
Error49.33%
Cost128
\[-z \]

Error

Reproduce?

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