Average Error: 0.0 → 0.0
Time: 1.5s
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 r473345 = x;
        double r473346 = y;
        double r473347 = r473345 - r473346;
        double r473348 = r473347 / r473345;
        return r473348;
}

double f(double x, double y) {
        double r473349 = 1.0;
        double r473350 = y;
        double r473351 = x;
        double r473352 = r473350 / r473351;
        double r473353 = r473349 - r473352;
        return r473353;
}

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

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

  (/ (- x y) x))