SERVER-14015: Fix S2 Compilation on GCC 4.9/Solaris by choosing sqrt(double)

(cherry picked from commit 885e11b64dae39b4a90304e754caa26254442180)