| Posted: 10:47pm 20 Jun 2025 |
|
|
|
Thank Gerry, that should be useful. I have a routine to read *.OPT files and there are 2 floats in the structure. This is what I came up with:
CASE "float" b1%= ASC(INPUT$(1,#3)) : b2%= ASC(INPUT$(1,#3)) :b3%= ASC(INPUT$(1,#3)) :b4%= ASC(INPUT$(1,#3)) tempint% = ((b4%*256+b3%)*256+b2%)*256+b1% mantissa = tempint% AND &h7FFFFF mantissa = mantissa +&h800000 exponent = (tempint% >>23)AND &hFF exponent = exponent - 127 sign = (tempint% >>31)AND 1 tempfloat! = mantissa*2^-23*2^exponent * 10000 ' multiply by 10k to match OPTION LIST IF sign THEN tempfloat!=0-tempfloat! readdata$ = STR$(INT(tempfloat!))+" ("+STR$(b1%)+" "+STR$(b2%)+" "+STR$(b3%)+" "+STR$(b4%)+")" I didn't think of converting to 64bit at the bit level.
Jim |