| Alternative 1 | |
|---|---|
| Error | 24.62% |
| Cost | 713 |
\[\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}
\]
(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}
Results
| Original | 0.04% |
|---|---|
| Target | 0.03% |
| Herbie | 0.06% |
Initial program 0.04
Applied egg-rr0.06
Applied egg-rr0.06
Final simplification0.06
| Alternative 1 | |
|---|---|
| Error | 24.62% |
| Cost | 713 |
| Alternative 2 | |
|---|---|
| Error | 24.12% |
| Cost | 713 |
| Alternative 3 | |
|---|---|
| Error | 0.04% |
| Cost | 448 |
| Alternative 4 | |
|---|---|
| Error | 25.17% |
| Cost | 328 |
| Alternative 5 | |
|---|---|
| Error | 50.26% |
| Cost | 64 |
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)))