1 #include <algorithm> 2 #include <stdint.h> 3 #include <iostream> 4 to_double(uint64_t x)5double to_double(uint64_t x) 6 { 7 union {double d; uint64_t x;} u; 8 u.x = x; 9 return u.d; 10 } 11 main()12int main() 13 { 14 std::vector<double> v = { 15 to_double(4606672070890243784), 16 to_double(4606672025854247510), 17 to_double(4606671800674266141), 18 to_double(4606671575494284772), 19 to_double(4606672115926240057), 20 to_double(4606672160962236330), 21 to_double(4606672070890243784), 22 }; 23 24 for (auto i : v) 25 std::cout << i << std::endl; 26 27 std::nth_element(v.begin(), v.begin() + 3, v.end()); 28 return 0; 29 } 30