[an error occurred while processing this directive]
|
Код в Exel Basic.
Полученная строка - в tmp2$ в виде строки 16-ричных символов младшим байтом вперед.
Sign = 1
FirstByte = Val("&H" + Left(Right(tmp2$, 10), 2))
SecondByte = Val("&H" + Left(Right(tmp2$, 8), 2))
ThirdByte = Val("&H" + Left(Right(tmp2$, 6), 2))
Exponent = Val("&H" + Left(Right(tmp2$, 4), 2))
If Exponent >= 128 Then
Exponent = (Exponent - 128) * 2
Sign = -1
Else
Exponent = Exponent * 2
End If
If ThirdByte >= 128 Then
ThirdByte = ThirdByte - 128
Exponent = Exponent + 1
End If
temp1 = CLng(FirstByte)
temp2 = CLng(SecondByte) * CLng(256)
temp3 = CLng(ThirdByte) * CLng(256) * CLng(256)
Mantissa = 1 + (temp1 + temp2 + temp3) / 8388608
Value = Sign * Mantissa * (2 ^ (Exponent - 127))
E-mail: info@telesys.ru