'Funcion que convierte un numero en formato float a real
Public Function Hex_Float(Exp As Integer, Mantisa As Long) As Single
Dim Sign As Boolean
Dim Man_bin(23) As Byte
Dim i As Byte
Dim Res_float As Single
'determino exponente, en base a 0x7F
Exp = Exp - &H7F
'Extraigo signo
If Mantisa >= &H800000 Then
Sign = True
Else
Sign = False
End If
'Normalizo a 1.xxx
Mantisa = Mantisa Or &H800000
'Convierto a real
i = 23
Do
Man_bin(i) = Mantisa Mod 2
If Man_bin(i) = 1 Then
Res_float = Res_float + 2 ^ (-1 * i)
End If
Mantisa = Mantisa \ 2
i = i - 1
Loop While Mantisa > 1
Man_bin(i) = Mantisa
Res_float = Res_float + 2 ^ (-1 * i)
'Signo?
If Sign Then
Res_float = -1 * Res_float
End If
'Multiplico por el exponente
Res_float = Res_float * (2 ^ Exp)
Hex_Float = Res_float
End Function