&O

From QB64.org wiki
Revision as of 18:18, 22 August 2012 by Clippy (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The &O prefix denotes that a integer value is expressed in an Octal base 8 format.


==Syntax== a& = &O12345671234


  • The base eight numbering system only uses octal digit values of 0 to 7.
  • Leading zero values can be omitted 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. The program "overflow" error limits are listed as:
* INTEGER: 6 octal digits or a decimal value range from -32,768 to 32,767
* LONG: 11 octal digits or a decimal value range from -2,147,483,648 to 2,147,483,647
* _INTEGER64: 22 octal digits or decimal values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
  • LONG Octal values can be expressed by appending & after the number. Example: &O100000& = 32768


Example: 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$)

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


See also:



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page