浮點型轉換為整形 如何將整型轉換為浮點型,如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系統(tǒng)輸出打?。╥%t) 系統(tǒng)輸出打印(T%I)/T}T}T結果(t0.400000-t4.6)表示無論浮點數(shù)據(jù)在“%”的左側,整數(shù)都可以自動升級和轉換或在“%”的右側