Average Error: 0.0 → 0.0
Time: 42.3s
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
Error15.8
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -8.148757402396204 \cdot 10^{-60} \lor \neg \left(y \leq 15209305513240696\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{y}{x}\\ \end{array}\]
Alternative 2
Error15.8
Cost520
\[\begin{array}{l} \mathbf{if}\;y \leq -1.3338772661658133 \cdot 10^{-53} \lor \neg \left(y \leq 10019188617662314\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 3
Error28.1
Cost706
\[\begin{array}{l} \mathbf{if}\;x \leq -3.874652219877624 \cdot 10^{-214}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 9.234413159601361 \cdot 10^{-203}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 4
Error31.6
Cost64
\[1\]

Error

Time

Derivation

  1. Initial program 0.0

    \[\frac{x}{x + y}\]
  2. Using strategy rm
  3. Applied pow1_binary64_117330.0

    \[\leadsto \color{blue}{{\left(\frac{x}{x + y}\right)}^{1}}\]
  4. Using strategy rm
  5. Applied *-un-lft-identity_binary64_116720.0

    \[\leadsto {\left(\frac{x}{\color{blue}{1 \cdot \left(x + y\right)}}\right)}^{1}\]
  6. Applied *-un-lft-identity_binary64_116720.0

    \[\leadsto {\left(\frac{\color{blue}{1 \cdot x}}{1 \cdot \left(x + y\right)}\right)}^{1}\]
  7. Applied times-frac_binary64_116780.0

    \[\leadsto {\color{blue}{\left(\frac{1}{1} \cdot \frac{x}{x + y}\right)}}^{1}\]
  8. Simplified0.0

    \[\leadsto {\left(\color{blue}{1} \cdot \frac{x}{x + y}\right)}^{1}\]
  9. Simplified0.0

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

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

Reproduce

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