double uint64_t
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.   union double_uint64_t
  5.   {
  6.     uint64_t uint64_t_;
  7.     double double_;
  8.   };
  9.  
  10.   union double_int64_t
  11.   {
  12.       int64_t int64_t_;
  13.       double double_;
  14.   };
  15.  
  16.   static uint64_t double_to_uint64_t (double d)
  17.   {
  18.     double_uint64_t du;
  19.     du.double_ = d;
  20.     return du.uint64_t_;
  21. }
  22.  
  23.   static double uint64_t_to_double (uint64_t u)
  24.   {
  25.     double_uint64_t du;
  26.     du.uint64_t_ = u;
  27.     return du.double_;
  28.   }
  29.  
  30.  
  31. int main() {
  32.         // your code goes here
  33.         std::cout << double_to_uint64_t((double)4834258800548954544) << std::endl;
  34.         std::cout << double_to_uint64_t((double)4834258800548953604) << std::endl;
  35.  
  36.         return 0;
  37. }
  38.  
Parsed in 0.008 seconds