Binary numbers

 BBS: Inland Empire Archive
Date: 04-23-92 (09:22)             Number: 114
From: MATT HART                    Refer#: 66
  To: CORIDON HENSHAW               Recvd: NO  
Subj: Binary numbers                 Conf: (2) Quik_Bas
 CH> In PDS, is there a way to convert BINARY numbers to DECIMAL
 CH> numbers and vice-versa?  (There is no BIN$ function in PDS)

DEFINT A-Z
FUNCTION Bin(Num$)
     N$ = LTRIM$(RTRIM$(Num$))
     B = 0
     L = LEN(N$)
     FOR i = 1 TO L
          B = B + (-(MID$(N$,i,1) = "1")) * 2 ^ (L-i)
     NEXT
     Bin = B
END FUNCTION
---
 * Origin: Midnight Micro!  V.32/REL  (918)451-3306 (1:170/600)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET