Average Error: 0.0 → 0.0
Time: 1.9s
Precision: binary64
Cost: 320
\[\frac{x}{x + y}\]
\[\frac{x}{x + y}\]
\frac{x}{x + y}
\frac{x}{x + y}
(FPCore (x y) :precision binary64 (/ x (+ x y)))
(FPCore (x y) :precision binary64 (/ x (+ x y)))
double code(double x, double y) {
	return x / (x + y);
}
double code(double x, double y) {
	return x / (x + y);
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error17.3
Cost973
\[\begin{array}{l} \mathbf{if}\;x \leq -7.447499202074567 \cdot 10^{+89}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 3.5485864177846564 \cdot 10^{-110} \lor \neg \left(x \leq 2195591.659336635\right) \land x \leq 8.799338892252848 \cdot 10^{+40}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 2
Error27.7
Cost706
\[\begin{array}{l} \mathbf{if}\;x \leq -1.6859891939883077 \cdot 10^{-79}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 8.496609286332174 \cdot 10^{-114}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 3
Error31.6
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.0

    \[\frac{x}{x + y}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\frac{x}{x + y}}\]
  3. Final simplification0.0

    \[\leadsto \frac{x}{x + y}\]

Reproduce

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