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 r921472 = x;
        double r921473 = y;
        double r921474 = r921473 - r921472;
        double r921475 = z;
        double r921476 = r921474 / r921475;
        double r921477 = r921472 + r921476;
        return r921477;
}

double f(double x, double y, double z) {
        double r921478 = x;
        double r921479 = y;
        double r921480 = r921479 - r921478;
        double r921481 = 1.0;
        double r921482 = z;
        double r921483 = r921481 / r921482;
        double r921484 = r921480 * r921483;
        double r921485 = r921478 + r921484;
        return r921485;
}

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