C Control The I Unit-M Advanced 5 Vdc Inputs / outputs 16 x digital I/Os / 8 x analogue or digital I/Os Program memory 2 198805 Datenbogen
Produktcode
198805
The FLOATING POINT MATH BASIC++ LIBRARY
Not all floating point operations are done on operating system level. Some special operations are available
as extension, and are executed as BASIC Code. The functions are provided at the FLOTMATH.BLIB and
described here. The FLOATMATH.BLIB contains the declaration of all used variables:
as extension, and are executed as BASIC Code. The functions are provided at the FLOTMATH.BLIB and
described here. The FLOATMATH.BLIB contains the declaration of all used variables:
define BVALUE1 as byte
define BVALUE2 as word
define FVALUE1 as float
define FVALUE2 as float
define FVALUE3 as float
define FVALUE4 as float
define RESULT ref FVALUE2
define BVALUE2 as word
define FVALUE1 as float
define FVALUE2 as float
define FVALUE3 as float
define FVALUE4 as float
define RESULT ref FVALUE2
the variables must not be declared a second time, but can be referenced.
The Library contains the following functions:
The Library contains the following functions:
LN(x)
LOG(x)
EXP(x,y)
TAN(x) (x in degrees)
LOG(x)
EXP(x,y)
TAN(x) (x in degrees)
All Functions are called with one or more parameter. The result is contained in the variable RESULT,
always. assignments like this: MyFloat=LN(MyFloat) are not possible
Please review 6_EXTENDED_FLOAT_MATH.BAS for examples
always. assignments like this: MyFloat=LN(MyFloat) are not possible
Please review 6_EXTENDED_FLOAT_MATH.BAS for examples
-----------------------------------------------------------------------------------------------
LN(MyFloat)
Is calculated with a precision of better than 4 digits. To gain precision the corresponding function can be
modified by changing the loopcounter from 9 to 13 or any other odd number.
FOR BVALUE1=3 TO 9 STEP 2
LN(MyFloat)
LN(12.345)
LN((FLOAT(MyWord))
The variable RESULT contains calculation result
LN(12.345)
LN((FLOAT(MyWord))
The variable RESULT contains calculation result
-----------------------------------------------------------------------------------------------
LOG(MyFloat)
LOG calculations are based on the LN function and is equal in pecision. Modify LN as described to gain
precision for LOG.
39
LOG(MyFloat)
LOG(12.345)
LOG((FLOAT(MyWord))
The variable RESULT contains calculation result
LOG(12.345)
LOG((FLOAT(MyWord))
The variable RESULT contains calculation result