Advertisement
CSenshi

binary to double

Apr 9th, 2019
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     string str = "011111111001001010100000000000000000000000000000000000000000000";
  8.     long long a = stol(str, nullptr, 0);
  9.     long long *b = (long long *)malloc(sizeof(long long));
  10.     *b = a;
  11.     cout << *(double *)b << endl;
  12.     return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement