| Alternative 1 | |
|---|---|
| Error | 16.5 |
| Cost | 456 |
\[\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-39}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.04 \cdot 10^{-63}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\]
(FPCore (x y) :precision binary64 (/ x (+ y x)))
(FPCore (x y) :precision binary64 (expm1 (log1p (/ x (+ x y)))))
double code(double x, double y) {
return x / (y + x);
}
double code(double x, double y) {
return expm1(log1p((x / (x + y))));
}
public static double code(double x, double y) {
return x / (y + x);
}
public static double code(double x, double y) {
return Math.expm1(Math.log1p((x / (x + y))));
}
def code(x, y): return x / (y + x)
def code(x, y): return math.expm1(math.log1p((x / (x + y))))
function code(x, y) return Float64(x / Float64(y + x)) end
function code(x, y) return expm1(log1p(Float64(x / Float64(x + y)))) end
code[x_, y_] := N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(Exp[N[Log[1 + N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]
\frac{x}{y + x}
\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{x + y}\right)\right)
Results
Initial program 0.0
Applied egg-rr0.0
Final simplification0.0
| Alternative 1 | |
|---|---|
| Error | 16.5 |
| Cost | 456 |
| Alternative 2 | |
|---|---|
| Error | 0.0 |
| Cost | 320 |
| Alternative 3 | |
|---|---|
| Error | 31.0 |
| Cost | 64 |
herbie shell --seed 2023040
(FPCore (x y)
:name "AI.Clustering.Hierarchical.Internal:average from clustering-0.2.1, B"
:precision binary64
(/ x (+ y x)))