Average Error: 0.0 → 0.0
Time: 2.9s
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 r721790 = x;
        double r721791 = y;
        double r721792 = r721790 - r721791;
        double r721793 = r721792 / r721790;
        return r721793;
}

double f(double x, double y) {
        double r721794 = 1.0;
        double r721795 = y;
        double r721796 = x;
        double r721797 = r721795 / r721796;
        double r721798 = r721794 - r721797;
        return r721798;
}

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

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

  (/ (- x y) x))