Average Error: 0.0 → 0.2
Time: 15.6s
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 r353028 = x;
        double r353029 = y;
        double r353030 = r353028 - r353029;
        double r353031 = z;
        double r353032 = r353031 - r353029;
        double r353033 = r353030 / r353032;
        return r353033;
}

double f(double x, double y, double z) {
        double r353034 = 1.0;
        double r353035 = z;
        double r353036 = y;
        double r353037 = r353035 - r353036;
        double r353038 = x;
        double r353039 = r353037 / r353038;
        double r353040 = r353034 / r353039;
        double r353041 = r353036 / r353037;
        double r353042 = r353040 - r353041;
        return r353042;
}

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