HTBasic Help
×
Menu
Index

DVAL

Converts a binary, octal, decimal or hexadecimal string to a real number.
 
 DVAL( string-expression, radix )
 
Usage:
Value=DVAL(Binary$,Two)
PRINT DVAL("EFA50",16)
 
Example: DVAL.BAS
 
Description:
DVAL converts a binary, octal, decimal or hexadecimal string to a real number, whereas VAL can only convert strings containing decimal numbers.
 
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 32 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 32 bit signed integer. The range restrictions are as follows:
 
Radiz
Legal Range
binary
0 through 11111111111111111111111111111111
octal
0 through 37777777777
decimal
-2147483648 through 2147483647
hexadecimal
0 through FFFFFFFF
 
See Also: