Average Error: 0.0 → 0.1
Time: 32.5s
Precision: 64
\[\frac{x - y}{z - y}\]
\[\frac{x}{z - y} - \frac{1}{\frac{z - y}{y}}\]
\frac{x - y}{z - y}
\frac{x}{z - y} - \frac{1}{\frac{z - y}{y}}
double f(double x, double y, double z) {
        double r25346996 = x;
        double r25346997 = y;
        double r25346998 = r25346996 - r25346997;
        double r25346999 = z;
        double r25347000 = r25346999 - r25346997;
        double r25347001 = r25346998 / r25347000;
        return r25347001;
}

double f(double x, double y, double z) {
        double r25347002 = x;
        double r25347003 = z;
        double r25347004 = y;
        double r25347005 = r25347003 - r25347004;
        double r25347006 = r25347002 / r25347005;
        double r25347007 = 1.0;
        double r25347008 = r25347005 / r25347004;
        double r25347009 = r25347007 / r25347008;
        double r25347010 = r25347006 - r25347009;
        return r25347010;
}

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.1
\[\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.1

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

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

Reproduce

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

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

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