Average Error: 30.4 → 0.3
Time: 1.7s
Precision: binary64
\[\sqrt{\left(2 \cdot x\right) \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.02232331549204 \cdot 10^{-311}:\\ \;\;\;\;x \cdot \left(-\sqrt{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot {\left(\sqrt{\sqrt{2}}\right)}^{\frac{3}{2}}\right) \cdot \sqrt{\sqrt{\sqrt{2}}}\\ \end{array}\]

Error

Bits error versus x

Derivation

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

    1. Initial program 30.8

      \[\sqrt{\left(2 \cdot x\right) \cdot x}\]
    2. Taylor expanded around -inf 0.4

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

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

    if -2.02232331549204e-311 < x

    1. Initial program 30.0

      \[\sqrt{\left(2 \cdot x\right) \cdot x}\]
    2. Taylor expanded around 0 0.4

      \[\leadsto \color{blue}{\sqrt{2} \cdot x}\]
    3. Simplified0.4

      \[\leadsto \color{blue}{x \cdot \sqrt{2}}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt0.4

      \[\leadsto x \cdot \sqrt{\color{blue}{\sqrt{2} \cdot \sqrt{2}}}\]
    6. Applied sqrt-prod0.6

      \[\leadsto x \cdot \color{blue}{\left(\sqrt{\sqrt{2}} \cdot \sqrt{\sqrt{2}}\right)}\]
    7. Applied associate-*r*0.5

      \[\leadsto \color{blue}{\left(x \cdot \sqrt{\sqrt{2}}\right) \cdot \sqrt{\sqrt{2}}}\]
    8. Using strategy rm
    9. Applied add-sqr-sqrt0.5

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

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

      \[\leadsto \left(x \cdot \sqrt{\sqrt{2}}\right) \cdot \color{blue}{\left(\sqrt{\sqrt{\sqrt{2}}} \cdot \sqrt{\sqrt{\sqrt{2}}}\right)}\]
    12. Applied associate-*r*0.3

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

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

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

Reproduce

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