Average Error: 0.0 → 0.0
Time: 1.7s
Precision: 64
\[\frac{x}{x + y}\]
\[\frac{-x}{-\left(x + y\right)}\]
\frac{x}{x + y}
\frac{-x}{-\left(x + y\right)}
double f(double x, double y) {
        double r214650 = x;
        double r214651 = y;
        double r214652 = r214650 + r214651;
        double r214653 = r214650 / r214652;
        return r214653;
}

double f(double x, double y) {
        double r214654 = x;
        double r214655 = -r214654;
        double r214656 = y;
        double r214657 = r214654 + r214656;
        double r214658 = -r214657;
        double r214659 = r214655 / r214658;
        return r214659;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{\frac{-x}{-\left(x + y\right)}}\]
  4. Final simplification0.0

    \[\leadsto \frac{-x}{-\left(x + y\right)}\]

Reproduce

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