?

Average Error: 0.0 → 0.0
Time: 3.9s
Precision: binary64
Cost: 13120

?

\[\frac{x}{y + x} \]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{x + y}\right)\right) \]
(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)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{x + y}\right)\right)} \]
  3. Final simplification0.0

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{x + y}\right)\right) \]

Alternatives

Alternative 1
Error16.5
Cost456
\[\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} \]
Alternative 2
Error0.0
Cost320
\[\frac{x}{x + y} \]
Alternative 3
Error31.0
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023040 
(FPCore (x y)
  :name "AI.Clustering.Hierarchical.Internal:average from clustering-0.2.1, B"
  :precision binary64
  (/ x (+ y x)))