Average Error: 0.0 → 0.2
Time: 6.4s
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 r573128 = x;
        double r573129 = y;
        double r573130 = r573128 - r573129;
        double r573131 = z;
        double r573132 = r573131 - r573129;
        double r573133 = r573130 / r573132;
        return r573133;
}

double f(double x, double y, double z) {
        double r573134 = 1.0;
        double r573135 = z;
        double r573136 = y;
        double r573137 = r573135 - r573136;
        double r573138 = x;
        double r573139 = r573137 / r573138;
        double r573140 = r573134 / r573139;
        double r573141 = r573136 / r573137;
        double r573142 = r573140 - r573141;
        return r573142;
}

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 2020021 +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)))