&O: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
No edit summary |
No edit summary Tag: Reverted |
||
Line 55: | Line 55: | ||
{{PageNavigation}} | {{PageNavigation}} | ||
[[Category:Final]] |
Revision as of 20:30, 13 June 2022
The &O prefix denotes that an integer value is expressed in a Octal base 8 format.
Syntax
- a& = &O377
Description
- The base 8 numbering system uses octal digit values of 0 to 7 only.
- Leading zero values can be omitted just like in decimal values as they add nothing to the return value.
- Decimal values returned can be any signed INTEGER, LONG integer, or _INTEGER64 value so use those type of variables when converting directly as shown above in the Syntax. The program "overflow" error limits are listed as:
- _BYTE: 3 octal digits or a decimal value range from -128 to 127. _UNSIGNED: 0 to 255.
- INTEGER: 6 octal digits or a decimal value range from -32,768 to 32,767. _UNSIGNED: 0 to 65535.
- LONG: 11 octal digits or a decimal value range from -2,147,483,648 to 2,147,483,647. _UNSIGNED: 0 to 4294967295.
- _INTEGER64: 22 octal digits or decimal values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
- _UNSIGNED _INTEGER64: 0 to 18446744073709551615.
- The maximum octal value for each numerical type is the maximum number of digits listed above, each valued at 7 (except the first digit).
- If the maximum number of digits is used, then the first digit (usually the highest significant position) may not be maxed out to 7, but only up to 3 (_BYTE and LONG) and up to 1 (INTEGER and _INTEGER64).
- Convert octal to LONG values by appending the values with the suffix &. Example: &O100000 = -32768: &O100000& = 32768
- To convert octal strings returned from OCT$ with VAL you need to prefix the string with &O (for example, if the string is "377" you should do VAL("&O377") or VAL("&O" + octvalue$).
Examples
- Example 1
- The maximum octal values of decimal value -1 in each numerical type are:
c&& = -1: d& = -1: e% = -1: f%% = -1 oc$ = OCT$(f%%) PRINT "Max octal _BYTE = "; oc$; " with"; LEN(oc$); "digits ="; VAL("&O" + oc$) oc$ = OCT$(e%) PRINT "Max octal INTEGER = "; oc$; " with"; LEN(oc$); "digits ="; VAL("&O" + oc$) oc$ = OCT$(d&) PRINT "Max octal LONG = "; oc$; " with"; LEN(oc$); "digits ="; VAL("&O" + oc$) oc$ = OCT$(c&&) PRINT "Max octal _INTEGER64 = "; oc$; " with"; LEN(oc$); "digits ="; VAL("&O" + oc$) oc$ = OCT$(9223372036854775807) PRINT "Max _INTEGER64 value = "; oc$; " with"; LEN(oc$); "digits" oc$ = OCT$(-9223372036854775808) PRINT "Min _INTEGER64 value = "; oc$; " with"; LEN(oc$); "digits" |
Max octal _BYTE = 377 with 3 digits = 255 Max octal INTEGER = 177777 with 6 digits = 65535 Max octal LONG = 37777777777 with 11 digits = 4294967295 Max octal _INTEGER64 = 1777777777777777777777 with 22 digits =-1 Max _INTEGER64 value = 777777777777777777777 with 21 digits Min _INTEGER64 value = 1000000000000000000000 with 22 digits |
See also