Converting binary Float to a Iris/Cache' value from a file
I'm trying to read data from a file and it contains single precision (4 byte) float values. Does Iris/Cache' have a way to convert the binary into a Cache' variable that is accurate?
ZW RECORD
RECORD="EDID"_$c(17,0)_"fLargeRefMinSize"_$c(0)_"DATA"_$c(4,0,0,0,0)_"DGMST&"_$c(0,0,0,0,0,0,0)_"d"_$c(14,0,0,30)_"h+"_$c(0)_"("_$c(0,0,0)_"EDID"_$c(22,0)_"fBribeSpeechcraftMult"_$c(0)_"DATA"_$c(4,0)_"ÍÌÌ=GMST"_$c(28,0,0,0,0,0,0,0)_"c"_$c(14,0,0,30)_"h+"_$c(0)_"("_$c(0,0,0)_"EDID"_$c(12)
The float DATA value for "f" LargeRefMinSize is $c(0,0,0,0) which is obviously 0.
The float DATA value for "f" BribeSpeechcraftMult is $c(0)_"ÍÌÌ". I have tried various things that haven't worked and I'm hoping that I don't have to implement a conversion bit by bit per the IEEE spec in Cache'.
I'm 99% sure that the leading $C(4) is the data length and the trailing = is a terminator.
Comments
Instead of ZW RECORD (which only gives an ASCII rubbish) please give some examples as hex-dump (ZZDUMP RECORD or something similar). A few values together with hex-dump.
Here is the data in ZZDUMP format.
ZZDUMP RECORD
0000: 45 44 49 44 11 00 66 4C 61 72 67 65 52 65 66 4D EDID..fLargeRefM
0010: 69 6E 53 69 7A 65 00 44 41 54 41 04 00 00 00 00 inSize.DATA.....
0020: 44 47 4D 53 54 26 00 00 00 00 00 00 00 64 0E 00 DGMST&.......d..
0030: 00 1E 68 2B 00 28 00 00 00 45 44 49 44 16 00 66 ..h+.(...EDID..f
0040: 42 72 69 62 65 53 70 65 65 63 68 63 72 61 66 74 BribeSpeechcraft
0050: 4D 75 6C 74 00 44 41 54 41 04 00 CD CC CC 3D 47 Mult.DATA..ÍÌÌ=G
0060: 4D 53 54 1C 00 00 00 00 00 00 00 63 0E 00 00 1E MST........c....
0070: 68 2B 00 28 00 00 00 45 44 49 44 0C h+.(...EDID.
Nice, and where are those 4 byte floating point data? Do you have some information about that record?
also, you could try the
$SCONVERT(s,format,endian,position)
function (Format: F4)
Thanks Julius. $SConvert using F4 looks like what I need. It isn't working, but that is something for me to figure out. I might be mis-understanding the layout and the data.
Thanks!
I got $SConvert to work. The format is "DATA" 2 byte length actual data.
"DATA"_$C(4,0)_$C(205,204,204,61) means that the data length is 4 so I'm doing $SConvert($C(205,204,204,61),"F4") which is .10000000149011611938. I was slightly wrong about the length and data locations. I need both the $C(4) and the $c(0) at the beginning for the data length, and the $C(61)="=" at the end is part of the data.
I'm saving off the float/double and the original value in case I need it.
$lb($double(.10000000149011611938),"ÍÌÌ=")
Thanks again Julius. I wasn't finding this in the documentation.