Re: HELP! Unsigned #'s

 BBS: Inland Empire Archive
Date: 11-24-92 (08:06)             Number: 387
From: DICK DENNISON                Refer#: NONE
  To: TOM HAMMOND                   Recvd: NO  
Subj: Re: HELP!  Unsigned #'s        Conf: (2) Quik_Bas
TH> I was confused that the value of this variable appeared to be a negati
TH> number.  Looking into the actual file, I found that the two bytes were
TH> &H73 and &H84.  I assumed that the two bytes were stored LOW HIGH, so
TH> reversed their position and ran them through a HEX-to-DEC calculator t
TH> obtain a confirmation of what I'd previously printed out.  The
TH> calculated value was 33907....  NOT the -31629 I'd come to expect.

To work with unsigned ints, you should conver them to a long ala:

If x% < 0 then xx& = 65536 - x% else xx& = x%

   so:   65536 - 31629 = 33907 !  Does that help?


--- VP [DOS] V4.09e
 * Origin: The MailMan  (914)374-3903 NY Quick Share Pt #7 *HST (1:272/34)
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