Depending on the format type, different record fields are used
for output and input. The variable x
stands for the
written or read value.
%f
):x=(OVAL-AOFF)/ASLO
VAL=x*ASLO+AOFF
ASLO==0.0
, it is treated as 1.0
.
Default values are ASLO=1.0
, AOFF=0.0
.OVAL
is not necessarily equal to VAL
if OROC!=0.0
.
%i
):x=RVAL
RBV=RVAL=x
RVAL=(((OVAL-EOFF)/ESLO)-AOFF)/ASLO
if
LINR=="LINEAR"
. ESLO
and EOFF
might be set in the record definition. StreamDevice does not set it.
For example, EOFF=-10
and ESLO=0.000305180437934
(=20.0/0xFFFF) maps -10.0 to 0x0000, 0.0 to 0x7FFF and 10.0 to 0xFFFF.
Using unsigned formats with values ≥ 0x800000 gives different results
on 64 bit machines.
If LINR=="NO CONVERSION"
(the default), OVAL
is directly converted to long
without going through
RVAL
. This allows for more bits on 64 bit machines.
To get the old behavior, use LINR=="LINEAR"
.
%{
):%s
):
During initialization, the @init
handler is executed, if
present. In contrast to normal operation, output in DOUBLE format uses
VAL
instead of OVAL
. Note that the record
initializes VAL
from DOL
if that is a constant.