{{htmlmetatags>metatag-robots=()
metatag-title=(BIN | ugBASIC User Manual)
metatag-keywords=(ugBASIC,Commodore 64,Commodore PLUS/4,ZX Spectrum)
metatag-description=(Manual page for BIN)
metatag-media-og:image=(:ugbasic:logo-ugbasic-fb.png)
metatag-og:title=(BIN | ugBASIC User Manual)
metatag-og:description=(Manual page for BIN)
}}
====== ugBASIC User Manual ======
===== BIN =====
===== SYNTAX =====
= BIN( value [, digits] )
==== PURPOSE ====
The ''BIN'' command allows you to convert a decimal number into a binary
representation. In other words, it takes a number that we are used to
writing in base 10 (with the digits 0 through 9) and turns it into a
sequence of 0s and 1s, which is the base that computers use to represent
data internally. It decode from the most significant to the least significant.
It is also possible to indicate the number of digits to be represented.
If this parameter is omitted, the minimum number of digits for that data
format (8, 16 or 32 digits) will be used.
This command is essential for those who want to delve deeper into how
computers work at a lower level. Infact, this command allows you to
operate directly on individual bits of a number, which is useful in
some applications such as graphics or communications. Moreover,
many encryption algorithms rely on bit-level operations.
==== EXAMPLE ====
x = BIN(42)
z = BIN(42, 5)
==== ABBREVIATION ====
Bi
==== AVAILABLE ON ====
*
* Atari (400/800)
* Atari XL/XE
* Commodore 128 (MOS 8502)
* Commodore 128 (Zilog Z80)
* Commodore 64
* Commodore 64+REU
* TRS-80 Color Computer
* TRS-80 Color Computer 3
* ColecoVision
* Amstrad CPC 664
* Dragon 32
* Dragon 64
* Thomson MO5
* Thomson MO5
* Olivetti Prodest PC128
* Commodore PLUS/4
* SEGA SC-3000
* SEGA SG-1000
*
* VG-5000
* Commodore VIC-20
* ZX Spectrum 48
==== ANY PROBLEM? ====
If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please [[https://github.com/spotlessmind1975/ugbasic/issues/new?title=ISSUE ON BIN|open an issue]] for this keyword on GitHub. Thank you!===== POWERED BY =====
[[:ugbasic:user:index|{{ :ugbasic:user:logo-ugbasic.png?nolink&600 |}}]]