Being a KAREL newbie, maybe there's some subtle setting I'm missing, but this has me utterly baffled.
Using the following KAREL code:
VAR
bRFlag : BOOLEAN -- GET_REG flag
rVal : REAL -- GET_REG result
iVal : INTEGER -- GET_REG result
iStatus : INTEGER -- GET_REG status
BEGIN
GET_REG(30, bRFlag, iVal, rVal, iStatus)
END
If the value of Register 30 is, say, 5 (not 5.0, just integer 5), what I get for output is 5.00000E+00. And the bRFlag is set True.
If I set R[30] to, say, 5.7, I get back 5.70000E+00
In all cases, iVal is 0. bRFlag is always True. iStatus is always 0.
I'm just trying to use the value of R[30], which should always be an integer, in a SELECT CASE switch, but this... I originally had the GET_REG followed by some "sanitizing" checks for iStatus and bRFLag, but those checks kept failing (due to bRFlag always being True), which is what sent me chasing down this rabbit hole.
What's worse is that every piece of working example code I can find from other people, use GET_REG the same way I am, and get expected integer results. I'm not finding any functions for converting between real and integer in the KAREL reference manual, and setting iVal=rVal throws a compilation error.