Average Error: 29.9 → 0.4
Time: 2.0s
Precision: binary64
\[\sqrt{\left(2 \cdot x\right) \cdot x} \]
\[\left|{2}^{0.25} \cdot \left({2}^{0.25} \cdot x\right)\right| \]
\sqrt{\left(2 \cdot x\right) \cdot x}
\left|{2}^{0.25} \cdot \left({2}^{0.25} \cdot x\right)\right|
(FPCore (x) :precision binary64 (sqrt (* (* 2.0 x) x)))
(FPCore (x) :precision binary64 (fabs (* (pow 2.0 0.25) (* (pow 2.0 0.25) x))))
double code(double x) {
	return sqrt(((2.0 * x) * x));
}
double code(double x) {
	return fabs((pow(2.0, 0.25) * (pow(2.0, 0.25) * x)));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 29.9

    \[\sqrt{\left(2 \cdot x\right) \cdot x} \]
  2. Applied egg-rr0.4

    \[\leadsto \color{blue}{\left|x \cdot \sqrt{2}\right|} \]
  3. Applied egg-rr1.4

    \[\leadsto \left|\color{blue}{{\left(\sqrt[3]{x \cdot \sqrt{2}}\right)}^{3}}\right| \]
  4. Applied egg-rr0.4

    \[\leadsto \left|\color{blue}{{2}^{0.25} \cdot \left({2}^{0.25} \cdot x\right)}\right| \]
  5. Final simplification0.4

    \[\leadsto \left|{2}^{0.25} \cdot \left({2}^{0.25} \cdot x\right)\right| \]

Reproduce

herbie shell --seed 2022129 
(FPCore (x)
  :name "sqrt B"
  :precision binary64
  (sqrt (* (* 2.0 x) x)))