Average Error: 29.9 → 0.4
Time: 2.5s
Precision: binary64
\[\sqrt{2 \cdot {x}^{2}} \]
\[\left|{2}^{0.25} \cdot \left({2}^{0.25} \cdot x\right)\right| \]
\sqrt{2 \cdot {x}^{2}}
\left|{2}^{0.25} \cdot \left({2}^{0.25} \cdot x\right)\right|
(FPCore (x) :precision binary64 (sqrt (* 2.0 (pow x 2.0))))
(FPCore (x) :precision binary64 (fabs (* (pow 2.0 0.25) (* (pow 2.0 0.25) x))))
double code(double x) {
	return sqrt((2.0 * pow(x, 2.0)));
}
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{2 \cdot {x}^{2}} \]
  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 D"
  :precision binary64
  (sqrt (* 2.0 (pow x 2.0))))