代码之家  ›  专栏  ›  技术社区  ›  Pod

内联浮点数到uint“representation”类型的双关语不起作用?

c c++
  •  0
  • Pod  · 技术社区  · 17 年前

    float flt = (float) inVal;
    outVal = *((unsigned long*)&flt);
    

    但这不是吗?

    outVal = *((unsigned long*)&((float)inVal));
    

    this function

    class hello
    {
        public static void main(String[] args)
        {
            int inside = Float.floatToIntBits(128.0f);
            System.out.printf("0x%08X", inside);
        }
    }
    
    3 回复  |  直到 3 年前