Average Error: 0.2 → 0.1
Time: 3.1s
Precision: binary64
\[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right)\]
\[0.5 \cdot x + y \cdot \left(0.5 \cdot \sqrt{z}\right)\]
\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right)
0.5 \cdot x + y \cdot \left(0.5 \cdot \sqrt{z}\right)
(FPCore (x y z) :precision binary64 (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))
(FPCore (x y z) :precision binary64 (+ (* 0.5 x) (* y (* 0.5 (sqrt z)))))
double code(double x, double y, double z) {
	return (1.0 / 2.0) * (x + (y * sqrt(z)));
}
double code(double x, double y, double z) {
	return (0.5 * x) + (y * (0.5 * sqrt(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.2

    \[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right)\]
  2. Simplified0.2

    \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt_binary64_65790.3

    \[\leadsto 0.5 \cdot \left(x + y \cdot \color{blue}{\left(\sqrt{\sqrt{z}} \cdot \sqrt{\sqrt{z}}\right)}\right)\]
  5. Applied associate-*r*_binary64_64970.3

    \[\leadsto 0.5 \cdot \left(x + \color{blue}{\left(y \cdot \sqrt{\sqrt{z}}\right) \cdot \sqrt{\sqrt{z}}}\right)\]
  6. Using strategy rm
  7. Applied pow1/2_binary64_66370.3

    \[\leadsto 0.5 \cdot \left(x + \left(y \cdot \sqrt{\sqrt{z}}\right) \cdot \sqrt{\color{blue}{{z}^{0.5}}}\right)\]
  8. Applied sqrt-pow1_binary64_65750.3

    \[\leadsto 0.5 \cdot \left(x + \left(y \cdot \sqrt{\sqrt{z}}\right) \cdot \color{blue}{{z}^{\left(\frac{0.5}{2}\right)}}\right)\]
  9. Simplified0.3

    \[\leadsto 0.5 \cdot \left(x + \left(y \cdot \sqrt{\sqrt{z}}\right) \cdot {z}^{\color{blue}{0.25}}\right)\]
  10. Using strategy rm
  11. Applied pow1/2_binary64_66370.3

    \[\leadsto 0.5 \cdot \left(x + \left(y \cdot \sqrt{\color{blue}{{z}^{0.5}}}\right) \cdot {z}^{0.25}\right)\]
  12. Applied sqrt-pow1_binary64_65750.3

    \[\leadsto 0.5 \cdot \left(x + \left(y \cdot \color{blue}{{z}^{\left(\frac{0.5}{2}\right)}}\right) \cdot {z}^{0.25}\right)\]
  13. Simplified0.3

    \[\leadsto 0.5 \cdot \left(x + \left(y \cdot {z}^{\color{blue}{0.25}}\right) \cdot {z}^{0.25}\right)\]
  14. Using strategy rm
  15. Applied distribute-rgt-in_binary64_65070.3

    \[\leadsto \color{blue}{x \cdot 0.5 + \left(\left(y \cdot {z}^{0.25}\right) \cdot {z}^{0.25}\right) \cdot 0.5}\]
  16. Simplified0.3

    \[\leadsto \color{blue}{0.5 \cdot x} + \left(\left(y \cdot {z}^{0.25}\right) \cdot {z}^{0.25}\right) \cdot 0.5\]
  17. Simplified0.1

    \[\leadsto 0.5 \cdot x + \color{blue}{y \cdot \left(\sqrt{z} \cdot 0.5\right)}\]
  18. Final simplification0.1

    \[\leadsto 0.5 \cdot x + y \cdot \left(0.5 \cdot \sqrt{z}\right)\]

Reproduce

herbie shell --seed 2020355 
(FPCore (x y z)
  :name "Diagrams.Solve.Polynomial:quadForm from diagrams-solve-0.1, B"
  :precision binary64
  (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))