Average Error: 0.0 → 0.2
Time: 3.2s
Precision: 64
\[x + \frac{y - x}{z}\]
\[x + \frac{1}{\frac{z}{y - x}}\]
x + \frac{y - x}{z}
x + \frac{1}{\frac{z}{y - x}}
double code(double x, double y, double z) {
	return (x + ((y - x) / z));
}
double code(double x, double y, double z) {
	return (x + (1.0 / (z / (y - x))));
}

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 clear-num0.2

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

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

Reproduce

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