2
如何在Actionscript中編寫這樣的C#代碼?如何將字節轉換爲數字(IEEE754到數字)Actionscript
Console.WriteLine(BitConverter.ToDouble(new byte[8]
{ 0x77, 0xBE, 0x9F, 0x1A, 0x2F, 0x0D, 0x4F, 0x40 }, 0));
如何在Actionscript中編寫這樣的C#代碼?如何將字節轉換爲數字(IEEE754到數字)Actionscript
Console.WriteLine(BitConverter.ToDouble(new byte[8]
{ 0x77, 0xBE, 0x9F, 0x1A, 0x2F, 0x0D, 0x4F, 0x40 }, 0));
可以依靠ByteArray做轉換爲你,但你寫字節的順序當心。
var bytes:Array = [0x77, 0xBE, 0x9F, 0x1A, 0x2F, 0x0D, 0x4F, 0x40];
var ba:ByteArray = new ByteArray();
for (var i:int = 7;i>=0;--i) ba.writeByte(bytes[i]);
ba.position = 0;
trace(ba.readDouble());