Fix Double.ToString performance on Linux and OSX (#10572)