Average Error: 0.0 → 0.0
Time: 3.8s
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 r603830 = x;
        double r603831 = y;
        double r603832 = r603830 - r603831;
        double r603833 = r603832 / r603830;
        return r603833;
}

double f(double x, double y) {
        double r603834 = 1.0;
        double r603835 = y;
        double r603836 = x;
        double r603837 = r603835 / r603836;
        double r603838 = r603834 - r603837;
        return r603838;
}

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 2019303 
(FPCore (x y)
  :name "Data.Colour.RGB:hslsv from colour-2.3.3, E"
  :precision binary64

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

  (/ (- x y) x))