Average Error: 30.4 → 0.5
Time: 1.9s
Precision: binary64
\[\sqrt{2 \cdot \left(x \cdot x\right)} \]
\[\sqrt{\sqrt{2} \cdot \left|x\right|} \cdot \left(\sqrt{\sqrt{2}} \cdot \sqrt{\left|x\right|}\right) \]
\sqrt{2 \cdot \left(x \cdot x\right)}
\sqrt{\sqrt{2} \cdot \left|x\right|} \cdot \left(\sqrt{\sqrt{2}} \cdot \sqrt{\left|x\right|}\right)
(FPCore (x) :precision binary64 (sqrt (* 2.0 (* x x))))
(FPCore (x)
 :precision binary64
 (* (sqrt (* (sqrt 2.0) (fabs x))) (* (sqrt (sqrt 2.0)) (sqrt (fabs x)))))
double code(double x) {
	return sqrt(2.0 * (x * x));
}
double code(double x) {
	return sqrt(sqrt(2.0) * fabs(x)) * (sqrt(sqrt(2.0)) * sqrt(fabs(x)));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 30.4

    \[\sqrt{2 \cdot \left(x \cdot x\right)} \]
  2. Applied add-sqr-sqrt_binary6430.6

    \[\leadsto \color{blue}{\sqrt{\sqrt{2 \cdot \left(x \cdot x\right)}} \cdot \sqrt{\sqrt{2 \cdot \left(x \cdot x\right)}}} \]
  3. Applied sqrt-prod_binary6430.6

    \[\leadsto \sqrt{\sqrt{2 \cdot \left(x \cdot x\right)}} \cdot \sqrt{\color{blue}{\sqrt{2} \cdot \sqrt{x \cdot x}}} \]
  4. Applied sqrt-prod_binary6430.6

    \[\leadsto \sqrt{\sqrt{2 \cdot \left(x \cdot x\right)}} \cdot \color{blue}{\left(\sqrt{\sqrt{2}} \cdot \sqrt{\sqrt{x \cdot x}}\right)} \]
  5. Simplified30.6

    \[\leadsto \sqrt{\sqrt{2 \cdot \left(x \cdot x\right)}} \cdot \left(\sqrt{\sqrt{2}} \cdot \color{blue}{\sqrt{\left|x\right|}}\right) \]
  6. Applied sqrt-prod_binary6430.5

    \[\leadsto \sqrt{\color{blue}{\sqrt{2} \cdot \sqrt{x \cdot x}}} \cdot \left(\sqrt{\sqrt{2}} \cdot \sqrt{\left|x\right|}\right) \]
  7. Simplified0.5

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

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

Reproduce

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