Click to See Complete Forum and Search --> : How to convert 4 byte binary to single???
toby
July 14th, 1999, 06:16 AM
I'm stuck...
How do I convert binary to Single (Short real IEEE 32bit)
,01000001,11011001,01011011,00000011
Does anybody know if VB's single are the same as short real??? If not what does the bits represent?
Best Regars/ Toby
Lothar Haensler
July 14th, 1999, 07:12 AM
wanna try this one?
Function conv(byval strVal as string) as Single
Dim i as Integer
Dim j as Integer
Dim r as Single
for i = len(strVal) to 1 step -1
r = r + CInt(mid(strVal, i, 1)) * 2 ^ j
j = j + 1
next i
conv = r
End Function
to use it:
dim s as single
s = conv("your bytes goe here")
e.g.
s = conv("00101111")
toby
July 14th, 1999, 07:52 AM
Thanks for the tip,
But your code does not consider the mattisa and + or – sign. So the question remains, how is the Single built?
I’ve thing it is like this, but then the values are totally wrong
(+/-) eeeeeee
esssssss
ssssssss
ssssssss
Is it like that?! And how do I i convert it?
Best Regards Toby
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.