4MELFA-BASIC IV
Detailed Explanation of Functions
4-314
CkSum
[Function]
Calculates the checksum of the string.
[Format]
[Terminology]
<Character String>
Specifies the string from which the checksum should be calculated.
<Equation 1>
Specifies the first character position from where the checksum calculation
starts.
<Equation 2>
Specifies the first character position from where the checksum calculation
ends.
[Reference Program]
1 M1=CkSum("ABCDEFG",1,3) ' &H41("A")+&H42("B")+&H43("C")=&HC6 is assigned to M1.
[Explanation]
(1) Adds the character codes of all characters in the string from the starting position to the end position and
returns a value between 0 and 255.
(2) If the starting position is outside the range of the string, an error will be generated.
(3) If the end position exceeds the end of the string, checksum from the starting position to the last character
in the string will be calculated.
(4) If the result of addition exceeds 255, a degenerated value of 255 or less will be returned.
(5) It is not possible to describe a function that contains an argument in <Character String>, <Equation 1>
and <Equation 2>. If such a function is described, an error will be generated during execution.
Cos
[Function]
Gives the cosine.
[Format]
[Reference Program]
1 M1=Cos(Rad(60))
[Explanation]
(1) Calculates the cosine of the equation.
(2) The range of arguments will be the entire range of values that are allowed.
(3) The range of the return value will be from -1 to 1.
(4) The unit of arguments is in radians.
[Reference]
,
<Numeric Variable>=CkSum(<Character String>, <Equation 1>, <Equation 2>)
<Numeric Variable>=Cos(<Equation>)