Saturday, July 9, 2022

๐Ÿ†• OCT$ Function

(Using the GW-BASIC User's Guide documentation for OCT$ as a template.)

Purpose:

To convert a decimal value to an octal value.

Syntax:

OCT$(x)

Comments:

  • Although GW-BASIC will round x to an integer before OCT$(x) is evaluated, BAM does not round the number, instead also coverting the numeric part after the point from decimal to octal too.
  • Octal numbers are numbers to the base 8 rather than base 10 (decimal numbers).


Examples:

PRINT OCT$(18)

Result: 22

(Decimal 18 equals octal 22.)

No comments:

Post a Comment

๐Ÿ–ฅ Animated "100 Doors"

EDIT 2026-05-11: Something was causing this program to not work on mobile devices.  I'm guessing I had exported and uploaded the wrong v...