4MELFA-BASIC IV
Detailed Explanation of Functions
4-320
Hex$
[Function]
Converts the value of an equation (Between -32768 to 32767) into hexadecimal string.
[Format]
[Reference Program]
1 C1$=Hex$(&H41FF)
' "41FF" is assigned to C1$.
2 C2$=Hex$(&H41FF,2)
' "FF" is assigned to C2$.
[Explanation]
(1) Converts the value of an equation into hexadecimal string.
(2) If <Number of output characters> is specified, the right most part of the converted string is output for the
specified length.
(3) If the numerical value is not an integer, the integer value obtained by rounding the fraction will be con-
verted into hexadecimal string.
(4) Val is a command that performs this procedure in reverse.
(5) If <number of output characters> is specified, it is not possible to describe a function that contains an
argument in <Equation>. If such a function is described, an error will be generated during execution.
NG example C1$=Hex$(Asc("a"),1)
[Reference]
,
Int
[Function]
Returns the largest integer that does not exceed the value of the equation.
[Format]
[Reference Program]
1 M1=Int(3.3)
' 3 is assigned to M1.
[Explanation]
(1) Returns the largest integer that does not exceed the value of the equation.
(2) If the nquation evaluates to a positive value, the same number as Fix will be returned.
(3) If the equation evaluates to a negative value, then for instance Fix(-2.3) = -3.0 will be observed.
[Reference]
<Character String Variable >=Hex$(<Equation> [, <Number of output characters>])
<Numeric Variable>=Int(<Equation>)