浮点型转换为整形 如何将整型转换为浮点型,如99转换为浮点型为多少?

如何将整型转换为浮点型,如99转换为浮点型为多少?浮点:float(99);double(99)result为99.0float(99)internal representation为0x42c600

如何将整型转换为浮点型,如99转换为浮点型为多少?

浮点:float(99);double(99)result为99.0

float(99)internal representation为0x42c60000,double(99)internal representation为0x40307442c60000

是,int升级为float,结果是float/Tclass test/T{T public static void main(string[]args)/T{T int i/T float T/T i=5T=4.6f/T系统输出打印(i%t) 系统输出打印(T%I)/T}T}T结果(t0.400000-t4.6)表示无论浮点数据在“%”的左侧,整数都可以自动升级和转换或在“%”的右侧