Average Error: 0.0 → 0.2
Time: 15.7s
Precision: 64
\[x + \frac{y - x}{z}\]
\[x + \left(y - x\right) \cdot \frac{1}{z}\]
x + \frac{y - x}{z}
x + \left(y - x\right) \cdot \frac{1}{z}
double f(double x, double y, double z) {
        double r1343916 = x;
        double r1343917 = y;
        double r1343918 = r1343917 - r1343916;
        double r1343919 = z;
        double r1343920 = r1343918 / r1343919;
        double r1343921 = r1343916 + r1343920;
        return r1343921;
}

double f(double x, double y, double z) {
        double r1343922 = x;
        double r1343923 = y;
        double r1343924 = r1343923 - r1343922;
        double r1343925 = 1.0;
        double r1343926 = z;
        double r1343927 = r1343925 / r1343926;
        double r1343928 = r1343924 * r1343927;
        double r1343929 = r1343922 + r1343928;
        return r1343929;
}

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

Derivation

  1. Initial program 0.0

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

    \[\leadsto x + \color{blue}{\left(y - x\right) \cdot \frac{1}{z}}\]
  4. Final simplification0.2

    \[\leadsto x + \left(y - x\right) \cdot \frac{1}{z}\]

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (x y z)
  :name "Statistics.Sample:$swelfordMean from math-functions-0.1.5.2"
  (+ x (/ (- y x) z)))