?

Average Error: 0.04% → 0.06%
Time: 7.4s
Precision: binary64
Cost: 7872

?

\[\frac{x - y}{x + y} \]
\[\begin{array}{l} t_0 := \frac{x - y}{x + y}\\ \sqrt[3]{\frac{t_0}{\frac{\frac{x + y}{x - y}}{t_0}}} \end{array} \]
(FPCore (x y) :precision binary64 (/ (- x y) (+ x y)))
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (- x y) (+ x y)))) (cbrt (/ t_0 (/ (/ (+ x y) (- x y)) t_0)))))
double code(double x, double y) {
	return (x - y) / (x + y);
}
double code(double x, double y) {
	double t_0 = (x - y) / (x + y);
	return cbrt((t_0 / (((x + y) / (x - y)) / t_0)));
}
public static double code(double x, double y) {
	return (x - y) / (x + y);
}
public static double code(double x, double y) {
	double t_0 = (x - y) / (x + y);
	return Math.cbrt((t_0 / (((x + y) / (x - y)) / t_0)));
}
function code(x, y)
	return Float64(Float64(x - y) / Float64(x + y))
end
function code(x, y)
	t_0 = Float64(Float64(x - y) / Float64(x + y))
	return cbrt(Float64(t_0 / Float64(Float64(Float64(x + y) / Float64(x - y)) / t_0)))
end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[(N[(x - y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]}, N[Power[N[(t$95$0 / N[(N[(N[(x + y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]]
\frac{x - y}{x + y}
\begin{array}{l}
t_0 := \frac{x - y}{x + y}\\
\sqrt[3]{\frac{t_0}{\frac{\frac{x + y}{x - y}}{t_0}}}
\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.04%
Target0.03%
Herbie0.06%
\[\frac{x}{x + y} - \frac{y}{x + y} \]

Derivation?

  1. Initial program 0.04

    \[\frac{x - y}{x + y} \]
  2. Applied egg-rr0.06

    \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{x - y}{x + y}\right)}^{3}}} \]
  3. Applied egg-rr0.06

    \[\leadsto \sqrt[3]{\color{blue}{\frac{\frac{x - y}{x + y}}{\frac{\frac{x + y}{x - y}}{\frac{x - y}{x + y}}}}} \]
  4. Final simplification0.06

    \[\leadsto \sqrt[3]{\frac{\frac{x - y}{x + y}}{\frac{\frac{x + y}{x - y}}{\frac{x - y}{x + y}}}} \]

Alternatives

Alternative 1
Error24.62%
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -2.25 \cdot 10^{-28} \lor \neg \left(x \leq 2.95 \cdot 10^{-18}\right):\\ \;\;\;\;1 + -2 \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 2
Error24.12%
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -8 \cdot 10^{-24} \lor \neg \left(x \leq 5.8 \cdot 10^{-13}\right):\\ \;\;\;\;1 + -2 \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{x}{y} + -1\\ \end{array} \]
Alternative 3
Error0.04%
Cost448
\[\frac{x - y}{x + y} \]
Alternative 4
Error25.17%
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -6.6 \cdot 10^{-24}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{-11}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 5
Error50.26%
Cost64
\[-1 \]

Error

Reproduce?

herbie shell --seed 2023102 
(FPCore (x y)
  :name "Data.Colour.RGB:hslsv from colour-2.3.3, D"
  :precision binary64

  :herbie-target
  (- (/ x (+ x y)) (/ y (+ x y)))

  (/ (- x y) (+ x y)))