Average Error: 1.0 → 1.0
Time: 17.9s
Precision: 64
\[\frac{z - y}{x - y} \cdot a + \frac{x - z}{x - y} \cdot b\]
\[\frac{x - z}{x - y} \cdot b + \frac{a}{\frac{x - y}{z - y}}\]
\frac{z - y}{x - y} \cdot a + \frac{x - z}{x - y} \cdot b
\frac{x - z}{x - y} \cdot b + \frac{a}{\frac{x - y}{z - y}}
double f(double z, double y, double x, double a, double b) {
        double r1433969 = z;
        double r1433970 = y;
        double r1433971 = r1433969 - r1433970;
        double r1433972 = x;
        double r1433973 = r1433972 - r1433970;
        double r1433974 = r1433971 / r1433973;
        double r1433975 = a;
        double r1433976 = r1433974 * r1433975;
        double r1433977 = r1433972 - r1433969;
        double r1433978 = r1433977 / r1433973;
        double r1433979 = b;
        double r1433980 = r1433978 * r1433979;
        double r1433981 = r1433976 + r1433980;
        return r1433981;
}

double f(double z, double y, double x, double a, double b) {
        double r1433982 = x;
        double r1433983 = z;
        double r1433984 = r1433982 - r1433983;
        double r1433985 = y;
        double r1433986 = r1433982 - r1433985;
        double r1433987 = r1433984 / r1433986;
        double r1433988 = b;
        double r1433989 = r1433987 * r1433988;
        double r1433990 = a;
        double r1433991 = r1433983 - r1433985;
        double r1433992 = r1433986 / r1433991;
        double r1433993 = r1433990 / r1433992;
        double r1433994 = r1433989 + r1433993;
        return r1433994;
}

Error

Bits error versus z

Bits error versus y

Bits error versus x

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 1.0

    \[\frac{z - y}{x - y} \cdot a + \frac{x - z}{x - y} \cdot b\]
  2. Using strategy rm
  3. Applied clear-num1.0

    \[\leadsto \color{blue}{\frac{1}{\frac{x - y}{z - y}}} \cdot a + \frac{x - z}{x - y} \cdot b\]
  4. Using strategy rm
  5. Applied *-un-lft-identity1.0

    \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{\frac{x - y}{z - y}}\right)} \cdot a + \frac{x - z}{x - y} \cdot b\]
  6. Applied associate-*l*1.0

    \[\leadsto \color{blue}{1 \cdot \left(\frac{1}{\frac{x - y}{z - y}} \cdot a\right)} + \frac{x - z}{x - y} \cdot b\]
  7. Simplified1.0

    \[\leadsto 1 \cdot \color{blue}{\frac{a}{\frac{x - y}{z - y}}} + \frac{x - z}{x - y} \cdot b\]
  8. Final simplification1.0

    \[\leadsto \frac{x - z}{x - y} \cdot b + \frac{a}{\frac{x - y}{z - y}}\]

Reproduce

herbie shell --seed 1 
(FPCore (z y x a b)
  :name "(z-y)/(x-y)*a + (x-z)/(x-y)*b"
  :precision binary64
  (+ (* (/ (- z y) (- x y)) a) (* (/ (- x z) (- x y)) b)))