Average Error: 0.0 → 0.0
Time: 587.0ms
Precision: 64
\[\frac{x - y}{x}\]
\[1 - \frac{y}{x}\]
\frac{x - y}{x}
1 - \frac{y}{x}
double f(double x, double y) {
        double r871985 = x;
        double r871986 = y;
        double r871987 = r871985 - r871986;
        double r871988 = r871987 / r871985;
        return r871988;
}

double f(double x, double y) {
        double r871989 = 1.0;
        double r871990 = y;
        double r871991 = x;
        double r871992 = r871990 / r871991;
        double r871993 = r871989 - r871992;
        return r871993;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[1 - \frac{y}{x}\]

Derivation

  1. Initial program 0.0

    \[\frac{x - y}{x}\]
  2. Using strategy rm
  3. Applied *-un-lft-identity0.0

    \[\leadsto \frac{x - y}{\color{blue}{1 \cdot x}}\]
  4. Applied *-un-lft-identity0.0

    \[\leadsto \frac{\color{blue}{1 \cdot \left(x - y\right)}}{1 \cdot x}\]
  5. Applied times-frac0.0

    \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{x - y}{x}}\]
  6. Simplified0.0

    \[\leadsto \color{blue}{1} \cdot \frac{x - y}{x}\]
  7. Simplified0.0

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

    \[\leadsto 1 - \frac{y}{x}\]

Reproduce

herbie shell --seed 2019354 
(FPCore (x y)
  :name "Data.Colour.RGB:hslsv from colour-2.3.3, E"
  :precision binary64

  :herbie-target
  (- 1 (/ y x))

  (/ (- x y) x))