Average Error: 29.9 → 0.4
Time: 3.1s
Precision: binary64
\[\sqrt{2 \cdot {x}^{2}}\]
\[\begin{array}{l} \mathbf{if}\;x \leq 3.4495751359478 \cdot 10^{-311}:\\ \;\;\;\;-x \cdot \sqrt{2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\sqrt{2}} \cdot \left(x \cdot {\left(\sqrt[3]{\sqrt{2}}\right)}^{2}\right)\\ \end{array}\]
\sqrt{2 \cdot {x}^{2}}
\begin{array}{l}
\mathbf{if}\;x \leq 3.4495751359478 \cdot 10^{-311}:\\
\;\;\;\;-x \cdot \sqrt{2}\\

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\sqrt{2}} \cdot \left(x \cdot {\left(\sqrt[3]{\sqrt{2}}\right)}^{2}\right)\\

\end{array}
(FPCore (x) :precision binary64 (sqrt (* 2.0 (pow x 2.0))))
(FPCore (x)
 :precision binary64
 (if (<= x 3.4495751359478e-311)
   (- (* x (sqrt 2.0)))
   (* (cbrt (sqrt 2.0)) (* x (pow (cbrt (sqrt 2.0)) 2.0)))))
double code(double x) {
	return sqrt(2.0 * pow(x, 2.0));
}
double code(double x) {
	double tmp;
	if (x <= 3.4495751359478e-311) {
		tmp = -(x * sqrt(2.0));
	} else {
		tmp = cbrt(sqrt(2.0)) * (x * pow(cbrt(sqrt(2.0)), 2.0));
	}
	return tmp;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < 3.44957513594777e-311

    1. Initial program 30.1

      \[\sqrt{2 \cdot {x}^{2}}\]
    2. Taylor expanded around -inf 0.4

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \sqrt{2}\right)}\]

    if 3.44957513594777e-311 < x

    1. Initial program 29.7

      \[\sqrt{2 \cdot {x}^{2}}\]
    2. Taylor expanded around 0 0.4

      \[\leadsto \color{blue}{x \cdot \sqrt{2}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt_binary640.4

      \[\leadsto x \cdot \color{blue}{\left(\left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right) \cdot \sqrt[3]{\sqrt{2}}\right)}\]
    5. Applied associate-*r*_binary640.4

      \[\leadsto \color{blue}{\left(x \cdot \left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right)\right) \cdot \sqrt[3]{\sqrt{2}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity_binary640.4

      \[\leadsto \left(x \cdot \left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right)\right) \cdot \color{blue}{\left(1 \cdot \sqrt[3]{\sqrt{2}}\right)}\]
    8. Applied associate-*r*_binary640.4

      \[\leadsto \color{blue}{\left(\left(x \cdot \left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right)\right) \cdot 1\right) \cdot \sqrt[3]{\sqrt{2}}}\]
    9. Simplified0.4

      \[\leadsto \color{blue}{\left(x \cdot {\left(\sqrt[3]{\sqrt{2}}\right)}^{2}\right)} \cdot \sqrt[3]{\sqrt{2}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3.4495751359478 \cdot 10^{-311}:\\ \;\;\;\;-x \cdot \sqrt{2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\sqrt{2}} \cdot \left(x \cdot {\left(\sqrt[3]{\sqrt{2}}\right)}^{2}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2021032 
(FPCore (x)
  :name "sqrt D"
  :precision binary64
  (sqrt (* 2.0 (pow x 2.0))))