De Hex To FloadSingle (IEEE754)

No es nuevo, pero la pregunta se repite y la respuesta también:-)

    Private Function HexToFloadSingle_IEEE754(ByVal Hex As String) As Single

        Dim Resultado(3) As Byte

        Dim Indice = 0

        For Entrada As Integer = 0 To Hex.Length – 1 Step 2

            Resultado(Indice) = Byte.Parse(Hex.Substring(Entrada, 2), Globalization.NumberStyles.HexNumber)

            Indice += 1



        Return BitConverter.ToSingle(Resultado, 0)

    End Function 


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.