HEXA to REAL :parsereal(string,int) as REAL in ba4

alan1968

Active Member
Licensed User
Longtime User
HEXA to Float :parseFloat(string,int) as Float in ba4

hello

I would like to convert a hex 4 byte string into a Float (C4C6728F = -1587.58), but I can not find this function

a idea ?

alan
 
Last edited:

alan1968

Active Member
Licensed User
Longtime User
yes ,but no solution only
HexToBytes (hex As String) As Byte()
and no
HexToFLoat(hex As String) As Float()
:(
 
Upvote 0

alan1968

Active Member
Licensed User
Longtime User
Erel,you want to give me a small example of the use of these two functions
I do not see how used

Thx!
 
Upvote 0

alan1968

Active Member
Licensed User
Longtime User
SUPER !

:sign0188:

your are my master :)

one question, why (0) after (bc.HexToBytes (hex)) ?
 
Last edited:
Upvote 0

alan1968

Active Member
Licensed User
Longtime User
thx! for all Erel
Now I will like to do the opposite (float to hex), but it does not work
I use the same as you metode

I did not find other example on the forum

B4X:
Sub Activity_Create(FirstTime As Boolean) 
 Log(FloatToHex(-1258.25))
End Sub

Sub FloatToHex(Fl As Float) As String
Dim bc As ByteConverter 
Return bc.HexFromBytes(bc.FloatsToBytes(Fl)(0))
 
Upvote 0
Top