&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 |
||
Line 1: | Line 1: | ||
The | The [[&O]] prefix denotes that an integer value is expressed in a Octal base 8 format. | ||
{{PageSyntax}} | {{PageSyntax}} | ||
: | : {{Parameter|a&}} = [[&O]]377 | ||
* The base | {{PageDescription}} | ||
* Leading zero values | * The base 8 numbering system uses octal digit values of 0 to 7 only. | ||
* 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. The program [[ERROR Codes|"overflow"]] error limits are listed as: | * Leading zero values can be omitted just like in decimal values as they add nothing to the return value. | ||
:: * [[INTEGER]]: 6 octal digits or a decimal value range from -32,768 to 32,767 | * 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 [[ERROR Codes|"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]] | :* [[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: [[&O]]100000 = -32768: [[&O]]100000'''&''' = 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 {{InlineCode}}{{Cl|VAL}}("&O377"){{InlineCodeEnd}} or {{InlineCode}}{{Cl|VAL}}("&O" + octvalue$){{InlineCodeEnd}}. | |||
{{PageExamples}} | |||
;Example 1:The maximum octal values of decimal value -1 in each numerical type are: | |||
{{CodeStart}} | {{CodeStart}} | ||
c&& = -1: d& = -1: e% = -1: f%% = -1 | c&& = -1: d& = -1: e% = -1: f%% = -1 | ||
Line 25: | Line 32: | ||
{{Cl|PRINT}} "Max octal {{Cl|LONG}} = "; oc$; " with"; {{Cl|LEN}}(oc$); "digits ="; {{Cl|VAL}}("{{Cl|&O}}" + oc$) | {{Cl|PRINT}} "Max octal {{Cl|LONG}} = "; oc$; " with"; {{Cl|LEN}}(oc$); "digits ="; {{Cl|VAL}}("{{Cl|&O}}" + oc$) | ||
oc$ = {{Cl|OCT$}}(c&&) | oc$ = {{Cl|OCT$}}(c&&) | ||
{{Cl|PRINT}} "Max octal {{Cl|_INTEGER64}} = "; oc$; " with"; {{Cl|LEN}}(oc$); "digits ="; {{Cl|VAL}}("{{Cl|&O}}" + oc$) | {{Cl|PRINT}} "Max octal {{Cl|_INTEGER64}} = "; oc$; " with"; {{Cl|LEN}}(oc$); "digits ="; {{Cl|VAL}}("{{Cl|&O}}" + oc$) | ||
oc$ = {{Cl|OCT$}}(9223372036854775807) | |||
{{Cl|PRINT}} "Max {{Cl|_INTEGER64}} value = "; oc$; " with"; {{Cl|LEN}}(oc$); "digits" | |||
oc$ = {{Cl|OCT$}}(-9223372036854775808) | |||
{{Cl|PRINT}} "Min {{Cl|_INTEGER64}} value = "; oc$; " with"; {{Cl|LEN}}(oc$); "digits" | |||
{{CodeEnd}} | {{CodeEnd}} | ||
{{OutputStart}}Max octal _BYTE = 377 with 3 digits = 255 | {{OutputStart}} | ||
Max octal _BYTE = 377 with 3 digits = 255 | |||
Max octal INTEGER = 177777 with 6 digits = 65535 | Max octal INTEGER = 177777 with 6 digits = 65535 | ||
Max octal LONG = 37777777777 with 11 digits = 4294967295 | Max octal LONG = 37777777777 with 11 digits = 4294967295 | ||
Max octal _INTEGER64 = 1777777777777777777777 with 22 digits =-1 | Max octal _INTEGER64 = 1777777777777777777777 with 22 digits =-1 | ||
Max _INTEGER64 value = 777777777777777777777 with 21 digits | |||
Min _INTEGER64 value = 1000000000000000000000 with 22 digits | |||
{{OutputEnd}} | {{OutputEnd}} | ||
{{PageSeeAlso}} | |||
* [[ | * [[_BIN$]], [[HEX$]], [[OCT$]], [[STR$]] | ||
* [[&B]] (binary), [[&H]] (hexadecimal) | * [[&B]] (binary), [[&H]] (hexadecimal), [[VAL]] | ||
* [[Base Comparisons]] | * [[Base Comparisons]] | ||
{{PageNavigation}} | {{PageNavigation}} |
Revision as of 22:35, 12 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