Average Error: 0.0 → 0.0
Time: 5.0s
Precision: binary64
\[x + \frac{y - x}{z} \]
\[x + \frac{y - x}{z} \]
x + \frac{y - x}{z}
x + \frac{y - x}{z}
(FPCore (x y z) :precision binary64 (+ x (/ (- y x) z)))
(FPCore (x y z) :precision binary64 (+ x (/ (- y x) z)))
double code(double x, double y, double z) {
	return x + ((y - x) / z);
}
double code(double x, double y, double z) {
	return x + ((y - x) / z);
}

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. Taylor expanded in y around 0 0.0

    \[\leadsto x + \color{blue}{\left(\frac{y}{z} - \frac{x}{z}\right)} \]
  3. Applied add-cube-cbrt_binary640.2

    \[\leadsto x + \left(\frac{y}{z} - \color{blue}{\left(\sqrt[3]{\frac{x}{z}} \cdot \sqrt[3]{\frac{x}{z}}\right) \cdot \sqrt[3]{\frac{x}{z}}}\right) \]
  4. Applied add-cube-cbrt_binary640.7

    \[\leadsto x + \left(\color{blue}{\left(\sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{\frac{y}{z}}\right) \cdot \sqrt[3]{\frac{y}{z}}} - \left(\sqrt[3]{\frac{x}{z}} \cdot \sqrt[3]{\frac{x}{z}}\right) \cdot \sqrt[3]{\frac{x}{z}}\right) \]
  5. Applied prod-diff_binary640.7

    \[\leadsto x + \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{\frac{y}{z}}, \sqrt[3]{\frac{y}{z}}, -\sqrt[3]{\frac{x}{z}} \cdot \left(\sqrt[3]{\frac{x}{z}} \cdot \sqrt[3]{\frac{x}{z}}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{\frac{x}{z}}, \sqrt[3]{\frac{x}{z}} \cdot \sqrt[3]{\frac{x}{z}}, \sqrt[3]{\frac{x}{z}} \cdot \left(\sqrt[3]{\frac{x}{z}} \cdot \sqrt[3]{\frac{x}{z}}\right)\right)\right)} \]
  6. Simplified0.0

    \[\leadsto x + \left(\color{blue}{\frac{y - x}{z}} + \mathsf{fma}\left(-\sqrt[3]{\frac{x}{z}}, \sqrt[3]{\frac{x}{z}} \cdot \sqrt[3]{\frac{x}{z}}, \sqrt[3]{\frac{x}{z}} \cdot \left(\sqrt[3]{\frac{x}{z}} \cdot \sqrt[3]{\frac{x}{z}}\right)\right)\right) \]
  7. Simplified0.0

    \[\leadsto x + \left(\frac{y - x}{z} + \color{blue}{0}\right) \]
  8. Final simplification0.0

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

Reproduce

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