Average Error: 0.0 → 0.2
Time: 14.9s
Precision: 64
\[\frac{x - y}{z - y}\]
\[\frac{1}{\frac{z - y}{x}} - \frac{y}{z - y}\]
\frac{x - y}{z - y}
\frac{1}{\frac{z - y}{x}} - \frac{y}{z - y}
double f(double x, double y, double z) {
        double r374426 = x;
        double r374427 = y;
        double r374428 = r374426 - r374427;
        double r374429 = z;
        double r374430 = r374429 - r374427;
        double r374431 = r374428 / r374430;
        return r374431;
}

double f(double x, double y, double z) {
        double r374432 = 1.0;
        double r374433 = z;
        double r374434 = y;
        double r374435 = r374433 - r374434;
        double r374436 = x;
        double r374437 = r374435 / r374436;
        double r374438 = r374432 / r374437;
        double r374439 = r374434 / r374435;
        double r374440 = r374438 - r374439;
        return r374440;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{\frac{x}{z - y} - \frac{y}{z - y}}\]
  4. Using strategy rm
  5. Applied clear-num0.2

    \[\leadsto \color{blue}{\frac{1}{\frac{z - y}{x}}} - \frac{y}{z - y}\]
  6. Final simplification0.2

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

Reproduce

herbie shell --seed 2019326 +o rules:numerics
(FPCore (x y z)
  :name "Graphics.Rasterific.Shading:$sgradientColorAt from Rasterific-0.6.1"
  :precision binary64

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

  (/ (- x y) (- z y)))