zoukankan      html  css  js  c++  java
  • 打印出C# 中float ,double 在内存中的存放形式

     1             float floatA = 2.2f;
     2             uint a = BitConverter.ToUInt32(BitConverter.GetBytes(floatA), 0);
     3             for (int i = 0; i < 32;++i )
     4             {
     5                 uint temp = 0x80000000 & (a << i);
     6                 if (temp==0)
     7                 {
     8                     Console.Write("0 ");
     9                 }
    10                 else
    11                 {
    12                     Console.Write("1 ");
    13                 }
    14             }
    15 
    16             Console.WriteLine();
    17 
    18             double doubleA = 2.2;
    19             ulong b = BitConverter.ToUInt64(BitConverter.GetBytes(doubleA), 0);
    20             for (int i = 0; i < 64; ++i)
    21             {
    22                 ulong temp = 0x8000000000000000 & (b << i);
    23                 if (temp == 0)
    24                 {
    25                     Console.Write("0 ");
    26                 }
    27                 else
    28                 {
    29                     Console.Write("1 ");
    30                 }
    31             }
  • 相关阅读:
    LSTM
    Realsense D435i
    ubuntu18 realsenseD435i
    net
    test
    LSTM Accuracy
    boost x64 lib
    E0443类模板 "std::unordered_set" 的参数太多
    PropertySheet
    freetype 编译
  • 原文地址:https://www.cnblogs.com/hshuzhao/p/4284417.html
Copyright © 2011-2022 走看看