HTBasic Help
×
Menu
Index

IVAL

Converts a binary, octal, decimal or hexadecimal string to an INTEGER.
 
 IVAL( string-expression, radix)
 
Usage:
Value=IVAL(Binary$,Two)
PRINT IVAL("FA50",16)
 
Example:           IVAL.BAS
 
Description:
IVAL is like VAL, in that a number in string form is converted to numeric form. Unlike VAL, which can only convert decimal numbers, IVAL can convert numbers in binary, octal, decimal and hexadecimal.
 
The string expression contains the number to be converted and the radix must be either 2, 8, 10 or 16. The characters in the string must be legal digits in the specified radix. For example, a binary number can only have characters "0" and "1". Only decimal numbers are allowed to have a minus sign preceding them.
The number expressed in the string is first converted to a 16 bit integer. If the most significant bit is set, the result will be negative. Thus, the string must represent a number within the range of a 16 bit signed integer. The range restrictions are as follows:      
 
Radix
Legal Range
binary
0 through 1111111111111111
octal
0 through 177777
decimal
-32768 through 32767
hexadecimal
0 through FFFF
 
See Also: