fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. unsigned char b[] = { 4, 0x00, 0x00, 0x00, 0x1B, 0xE4 };
  7. unsigned int n = b[0];
  8. unsigned int SI = (b[1] & 0x80) >> 7;
  9. unsigned int SE = (b[1] & 0x40) >> 6;
  10. unsigned int exponent = b[1] & 0x3f;
  11. unsigned int integer = 0;
  12. for (int i = 0; i < n; ++i)
  13. integer = (integer << 8) + b[2+i];
  14. double d = pow(-1, SI) * integer * pow(10, pow(-1, SE) * exponent);
  15. cout << d << endl;
  16. return 0;
  17. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
7140