mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-06 01:10:23 +00:00
6912727753
Help file snapshot as of 07/31/2022.
61 lines
3.4 KiB
Plaintext
61 lines
3.4 KiB
Plaintext
{{QBDLDATE:07-31-2022}}
|
|
{{QBDLTIME:23:54:03}}
|
|
The [[&O]] prefix denotes that an integer value is expressed in a Octal base 8 format.
|
|
|
|
|
|
{{PageSyntax}}
|
|
: {{Parameter|a&}} = [[&O]]377
|
|
|
|
|
|
{{PageDescription}}
|
|
* 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 [[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]]: 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}}
|
|
c&& = -1: d& = -1: e% = -1: f%% = -1
|
|
oc$ = {{Cl|OCT$}}(f%%)
|
|
{{Cl|PRINT}} "Max octal {{Cl|_BYTE}} = "; oc$; " with"; {{Cl|LEN}}(oc$); "digits ="; {{Cl|VAL}}("{{Cl|&O}}" + oc$)
|
|
oc$ = {{Cl|OCT$}}(e%)
|
|
{{Cl|PRINT}} "Max octal {{Cl|INTEGER}} = "; oc$; " with"; {{Cl|LEN}}(oc$); "digits ="; {{Cl|VAL}}("{{Cl|&O}}" + oc$)
|
|
oc$ = {{Cl|OCT$}}(d&)
|
|
{{Cl|PRINT}} "Max octal {{Cl|LONG}} = "; oc$; " with"; {{Cl|LEN}}(oc$); "digits ="; {{Cl|VAL}}("{{Cl|&O}}" + oc$)
|
|
oc$ = {{Cl|OCT$}}(c&&)
|
|
{{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}}
|
|
{{OutputStart}}
|
|
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
|
|
{{OutputEnd}}
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[_BIN$]], [[HEX$]], [[OCT$]], [[STR$]]
|
|
* [[&B]] (binary), [[&H]] (hexadecimal), [[VAL]]
|
|
* [[Base Comparisons]]
|
|
|
|
|
|
{{PageNavigation}}
|
|
|
|
[[Category:Final]]
|