Average Error: 0.0 → 0.0
Time: 7.2s
Precision: binary64
Cost: 320
\[\frac{x - y}{x}\]
\[1 - \frac{y}{x}\]
\frac{x - y}{x}
1 - \frac{y}{x}
(FPCore (x y) :precision binary64 (/ (- x y) x))
(FPCore (x y) :precision binary64 (- 1.0 (/ y x)))
double code(double x, double y) {
	return (x - y) / x;
}
double code(double x, double y) {
	return 1.0 - (y / x);
}

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}\]
Alternative 1
Accuracy1.3
Cost1024
\[\left(\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}\right) \cdot \frac{\sqrt[3]{x - y}}{x}\]

Derivation

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{{\left(\frac{x - y}{x}\right)}^{1}}\]
  4. Using strategy rm
  5. Applied div-sub_binary64_195200.0

    \[\leadsto {\color{blue}{\left(\frac{x}{x} - \frac{y}{x}\right)}}^{1}\]
  6. Simplified0.0

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

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

Reproduce

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

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

  (/ (- x y) x))